Skip to content

[#229] Add bounded cursor pagination to collection reads - #238

Merged
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Baskarayelu:feat/issue-229-cursor-pagination
Aug 30, 2026
Merged

[#229] Add bounded cursor pagination to collection reads#238
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Baskarayelu:feat/issue-229-cursor-pagination

Conversation

@Baskarayelu

Copy link
Copy Markdown
Contributor

Summary

Implements issue #229 with bounded cursor pagination for every unbounded list endpoint, while preserving the existing offset-based API for clients that send page and retaining full CSV exports.

What changed

  • Added a shared opaque cursor helper with strict positive-integer parsing, a server-side maximum page size of 100, direction/scope validation, stable snapshot boundaries, unique ordering-key checks, and deterministic continuation.
  • Added canonical cursor traversal to anchors, anchor-scoped settlements, settlements, liquidity pools, global liquidity entries, withdrawals, and anchor-scoped liquidity entries.
  • Added stable compound ordering for entries and timestamp-plus-insertion-index ordering for withdrawals so ties cannot skip records.
  • Preserved the existing response collection keys and added pagination.pageSize and pagination.nextCursor in cursor mode.
  • Rejected custom sort/order with cursors because those orderings do not match the canonical cursor key; legacy custom sorting remains available with offset pagination.
  • Documented request/response behavior, snapshot semantics, filter scopes, compatibility, client traversal, and the database migration path.
  • Added helper and route tests covering complete traversal, no duplicates/gaps, filters, malformed and cross-scope cursors, insertion during traversal, empty results, page-size clamping, tie-breakers, and no input mutation.
  • Resolved the duplicate config validation definitions present in the pulled main merge so TypeScript and the application can execute the new route tests.

Verification

  • npm run typecheck
  • npm run lint
  • Focused route/helper/OpenAPI suites: 92 tests passing ✅
  • Full Jest run: 508 passing; two pre-existing quote-route tests still fail independently of this pagination change (amountValidationConsistency and quote traffic rate budget).

Closes #229

@Jagadeeshftw
Jagadeeshftw merged commit 8a75488 into AnchorNet-Org:main Aug 30, 2026
1 check passed
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.

List endpoints return unbounded collections from in-memory stores with no pagination

2 participants