All problems

Activity Cursor Pagination Skips the Next Item

Level 2 · node · API · Cursor pagination response contract error

Scenario

An administrator activity API pages through events sorted newest first using a cursor. The first page correctly returns the requested number of items, but nextCursor is set to the ID of the item immediately after the returned page. The client uses a repository contract that starts after nextCursor, so one boundary event is omitted whenever the client advances to the next page.

Requirements

- Each page returns at most limit events in newest-first order - nextCursor points to the last event returned on the current page - The next request continues after the event referenced by the cursor - Traversing all pages must not omit or duplicate events - The final page must not provide a nextCursor

Acceptance criteria

  • The first page returns the requested limit of newest events
  • The second page starts with the event immediately following the first page
  • Combining all pages yields each source event exactly once and in order
  • The final page has a null nextCursor
  • An unknown cursor produces an empty result