Skip to content

fix: drop before cursor on follow-up autoPagination requests - #1720

Open
tribble wants to merge 2 commits into
mainfrom
fix/auto-pagination-direction
Open

tribble wants to merge 2 commits into
mainfrom
fix/auto-pagination-direction

Conversation

@tribble

@tribble tribble commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

I hit the API's Please provide either "after" or "before" parameters. error when calling autoPagination() on a list fetched with before: the first follow-up request re-sends the stale before alongside the new after cursor, and the API rejects any request carrying both.

  • Follow-up auto-pagination requests no longer re-send the caller's before; they send only after (the previous page's listMetadata.after), so a walk started from a before cursor pages forward instead of failing on the second request.

Test plan

Red-first regression in src/common/utils/pagination.spec.ts ("paginates forward from a before cursor, dropping before on follow-up requests"), starting from {before: 'u21'}:

  • On main (3b1e398) it fails: follow-up call 2 goes out as {after: 'u12', before: 'u21', limit: 100} and call 3 as {after: 'u14', before: 'u21', limit: 100} — the both-cursors request the API rejects.
  • With the fix it passes: call 1 is {limit: 100, before: 'u21'}, follow-ups are {limit: 100, after: 'u12'} and {limit: 100, after: 'u14'} with no before, and the walk returns the three pages concatenated in order (u11, u12, u13, u14, u15).

@tribble
tribble requested review from a team as code owners October 3, 2026 06:04
@tribble
tribble requested a review from stanleyphu October 3, 2026 06:04
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no outstanding finding or new actionable issue was established.

Summary

The PR changes auto-pagination started with a before cursor to use that cursor only on the initial request, then continue with each page’s after cursor. The regression test checks the request sequence and resulting item order.

Reviews (2) · Last reviewed commit: "fix: keep autoPagination forward-only af..." · Reviewed by Greptile

Comment thread src/common/utils/pagination.ts Outdated
Comment thread src/common/utils/pagination.spec.ts
Comment thread src/common/utils/pagination.ts Outdated
@tribble tribble changed the title fix: page backward in autoPagination after a before cursor fix: drop before cursor on follow-up autoPagination requests Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants