Repository navigation
Description
Discord Username / User ID
shadowsecurity_
Display name: shadow security
PR
What does this improvement do?
This merged PR improves paginate() so the CLI no longer risks looping forever when an API repeatedly returns a non-null cursor without making progress.
The fix preserves valid cursor-pagination behavior: it keeps consuming legitimately empty pages, because filtered cursor stores can return an empty page before later pages contain matching results. Instead of stopping on any empty page, it adds explicit safety bounds:
- detects repeated non-null
nextTokenvalues and rejects with a typedUNAVAILABLEerror - caps auto-pagination with
MAX_AUTO_PAGES = 1000 - keeps valid empty cursor pages working when later pages contain data
This prevents infinite pagination loops without silently truncating legitimate tail results.
Impact
Without this guard, a backend/API pagination bug or unstable cursor source can keep the CLI in an unbounded pagination loop. That can hang contributor workflows, CI runs, or agent-driven verification loops.
This matters for the TestSprite CLI loop because the checker needs to fail loudly and return actionable errors rather than appearing stuck or consuming pages forever.
Implementation summary
src/lib/pagination.ts- adds
MAX_AUTO_PAGES - tracks seen non-null cursors
- throws typed pagination safety errors for
repeated_next_tokenandmax_pages_exceeded
- adds
src/lib/pagination.test.ts- verifies empty cursor pages can lead to later data
- verifies repeated cursor detection
- verifies max-page safety cap behavior
Local verification performed
The PR was locally verified with:
npm test -- src/lib/pagination.test.ts
npm run format:check
npm run lint
npm run typecheck
npm run build
npm testFull suite result recorded in the PR:
42 files / 1486 tests passed
Current status
PR #48 was merged on 2026-07-05:
In PR #61, a maintainer also noted that "the pagination-bounding half of this PR just landed via #48", confirming that #48 carried the accepted pagination safety shape.
CLI Improvement Bonus coordination
I am opening this issue as the public tracking anchor for the Season 3 CLI Improvement Bonus, matching the hackathon issue format used by other contributors.
Could the TestSprite team please confirm whether PR #48 is recorded for the CLI Improvement Bonus payout process?
I have joined/will join the TestSprite Discord and will reach out to Kairui | TestSprite directly.
Confirmations
- I have searched existing issues and did not find an existing tracking issue for PR fix(paginate): bound cursor loops without dropping empty pages #48 under my GitHub account.
- I have provided my Discord identity above for reward coordination.
Activity
aldorizona10-glitch commentedon Jul 28, 2026
Hi, adding the coordination details explicitly here as well:
Discord username: shadowsecurity_
Discord display name: shadow security
GitHub account: @aldorizona10-glitch
Merged PR: #48
I opened this issue as the tracking anchor for PR #48 because the PR was merged before I had a dedicated hackathon issue in this format. I will also reach out to Kairui | TestSprite directly in the TestSprite Discord for the Season 3 CLI Improvement Bonus coordination step.
Please let me know if any additional information is needed. Thank you.
aldorizona10-glitch commentedon Jul 28, 2026
@zeshi-du one more context note so this issue can be routed the same way as the other Season 3 CLI Improvement Bonus tracking issues:
The official Season 3 page says the Project Awards are closed, but the CLI Improvement Bonus is a separate standing bounty for merged CLI improvements and remains open until the $2,000 pool is exhausted.
This submission matches that path:
Could you please confirm whether this should be recorded for the Season 3 CLI Improvement Bonus coordination process, or route me to the correct admin step if this issue was created after the PR had already merged?
zeshi-du commentedon Aug 13, 2026
Thanks for flagging this, and sorry for the slow reply.
On the technical side, to be clear: #48 is merged and the pagination bounds are live —
MAX_AUTO_PAGES, repeated-cursor detection, and typedmax_pages_exceeded/repeated_next_tokenerrors are all insrc/lib/pagination.ts. Nothing further is needed in the code, and the work counts.Season 3 reward coordination doesn't run through the issue tracker, so I'll follow up on Discord rather than here. Closing this issue since there's no engineering action attached to it — that isn't a decision about eligibility, and your contribution is recorded either way.