Skip to content

feat: add pagination integration tests, fix backward pagination bug#1694

Merged
shrugs merged 6 commits intofeat/graphql-api-integration-testfrom
feat/additional-integration-tests
Feb 27, 2026
Merged

feat: add pagination integration tests, fix backward pagination bug#1694
shrugs merged 6 commits intofeat/graphql-api-integration-testfrom
feat/additional-integration-tests

Conversation

@shrugs
Copy link
Collaborator

@shrugs shrugs commented Feb 26, 2026

closes #1622

Summary

  • added reusable pagination integration tests across all domain connection fields (Query.domains, Domain.subdomains, Account.domains, Registry.domains) covering all 6 ordering permutations × forward/backward pagination
  • fixed backward pagination bug in cursorFilter — removed the effectiveDesc parameter and derived direction comparison directly from queryOrderDir, which was incorrect when inverted flipped the sort
  • extracted shared pagination queries, types, and a generic testDomainPagination test harness into reusable test utilities

Why

  • backward pagination was broken for certain order/direction combos due to effectiveDesc being passed through from the caller (which accounted for inverted) while cursorFilter only needs the declared queryOrderDir
  • no integration test coverage existed for pagination or ordering correctness

Testing

  • all tests run against the devnet via the existing integration test setup
  • tests paginate with page size 2 to force multiple pages, then assert ordering correctness and that forward/backward collection yields identical results

Add generic testDomainPagination helper that tests all 6 ordering
permutations (3 orderBy × 2 dir) with forward and backward relay
cursor iteration for Query.domains, Domain.subdomains, Account.domains,
and Registry.domains.

Fix cursorFilter using effectiveDesc (which includes the Relay inverted
XOR) instead of the raw user orderDir for comparison operator selection.
This caused backward pagination (last/before) to select rows after the
cursor instead of before it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shrugs shrugs requested a review from a team as a code owner February 26, 2026 22:58
Copilot AI review requested due to automatic review settings February 26, 2026 22:58
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: 2f59e12

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Feb 26, 2026 11:30pm
ensnode.io Skipped Skipped Feb 26, 2026 11:30pm
ensrainbow.io Skipped Skipped Feb 26, 2026 11:30pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/additional-integration-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

Fixed critical backward pagination bug where cursorFilter incorrectly used effectiveDesc (includes Relay's inverted XOR) instead of raw queryOrderDir for comparison operator selection. Added comprehensive integration tests covering all 6 ordering permutations (3 orderBy × 2 directions) with both forward and backward pagination for Query.domains, Domain.subdomains, Account.domains, and Registry.domains.

Key Changes:

  • Fixed cursor filter logic to use queryOrderDir === "DESC" instead of effectiveDesc for determining comparison operators
  • This ensures backward pagination (last/before) correctly selects rows before the cursor, not after it
  • Added reusable testDomainPagination helper that validates ordering correctness and forward/backward pagination equivalence
  • Tests verify that backward pagination yields identical results to forward pagination for all ordering permutations

Confidence Score: 5/5

  • This PR is safe to merge - fixes a critical pagination bug with comprehensive test coverage
  • The bug fix is well-reasoned and correct, addressing the root cause of backward pagination selecting wrong rows. Comprehensive integration tests now cover all pagination scenarios, ensuring the fix works properly. Only minor style suggestion about async describe pattern.
  • No files require special attention

Important Files Changed

Filename Overview
apps/ensapi/src/graphql-api/lib/find-domains/find-domains-resolver-helpers.ts Fixed cursor filter to use raw orderDir instead of effectiveDesc for comparison operator selection
apps/ensapi/src/graphql-api/lib/find-domains/find-domains-resolver.ts Removed effectiveDesc calculation and parameter passing to cursorFilter calls
apps/ensapi/src/test/integration/test-domain-pagination.ts Added comprehensive pagination test helper covering 6 ordering permutations with forward/backward iteration

Last reviewed commit: 80c55d4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reusable integration test suite to validate Relay-style forward/backward pagination across multiple domain connection fields, and updates the findDomains keyset cursor filtering logic intended to fix a backward-pagination (last/before) bug.

Changes:

  • Introduce generic testDomainPagination() helper plus shared pagination GraphQL queries/fragments.
  • Expand integration tests for Query.domains, Domain.subdomains, Account.domains, and Registry.domains to cover all order permutations and both pagination directions.
  • Modify findDomains cursor filtering and resolver wiring related to effective ordering during inverted (backward) pagination.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
apps/ensapi/src/test/integration/test-domain-pagination.ts New shared integration test helper to iterate forward/backward through domain connections and assert ordering.
apps/ensapi/src/test/integration/graphql-utils.ts Extends GraphQLConnection test type to include cursor + pageInfo.
apps/ensapi/src/test/integration/domain-pagination-queries.ts New shared GraphQL queries/fragments for paginated domain connections.
apps/ensapi/src/graphql-api/schema/query.integration.test.ts Adds Query.domains pagination integration coverage using the new helper.
apps/ensapi/src/graphql-api/schema/domain.integration.test.ts Adds Domain.subdomains pagination integration coverage using the new helper.
apps/ensapi/src/graphql-api/schema/account.integration.test.ts Adds Account.domains pagination integration coverage using the new helper.
apps/ensapi/src/graphql-api/schema/registry.integration.test.ts Adds Registry.domains pagination integration coverage using the new helper.
apps/ensapi/src/graphql-api/lib/find-domains/find-domains-resolver.ts Updates resolver cursor filtering calls as part of the backward pagination fix.
apps/ensapi/src/graphql-api/lib/find-domains/find-domains-resolver-helpers.ts Updates cursorFilter comparison-operator selection logic for keyset pagination.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io February 26, 2026 23:18 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io February 26, 2026 23:18 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io February 26, 2026 23:18 Inactive
Copilot AI review requested due to automatic review settings February 26, 2026 23:21
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io February 26, 2026 23:21 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io February 26, 2026 23:21 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io February 26, 2026 23:21 Inactive
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel vercel bot temporarily deployed to Preview – ensrainbow.io February 26, 2026 23:30 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io February 26, 2026 23:30 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io February 26, 2026 23:30 Inactive
Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shrugs Also looks great 👍

@shrugs shrugs merged commit ec46900 into feat/graphql-api-integration-test Feb 27, 2026
11 of 12 checks passed
@shrugs shrugs deleted the feat/additional-integration-tests branch February 27, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants