Repository navigation
Description
Verified against (commit SHA or released version)
Discord Username / User ID
sandman.sh
What does this improvement do?
Reject empty and whitespace-only pagination cursors before making an API request.
Details / implementation notes
What is broken?
The CLI accepts empty pagination cursor values instead of rejecting them as invalid input.
Affected flags include:
--starting-token ""
--cursor ""
Relevant code:
src/lib/pagination.tssrc/commands/test.ts
The shared pagination validation checks numeric flags such as --page-size and --max-items, but does not validate that an explicitly supplied cursor is non-empty.
Reproduction
Run:
testsprite project list --starting-token "" --output json
Also run:
testsprite test list --project <PROJECT_ID> --starting-token "" --output json
And:
testsprite test result <TEST_ID> --history --cursor "" --output json
The commands accept the empty cursor instead of returning a local validation error.
Expected behavior
An explicitly supplied empty or whitespace-only cursor should fail before any API request:
VALIDATION_ERROR
exit code 5
The error should identify the relevant flag, for example:
--starting-token must be a non-empty cursor
Omitting the flag entirely should continue to mean “start from the first page.”
Actual behavior
The empty cursor is accepted and can be forwarded to the API as an empty cursor value.
This makes an explicitly empty cursor behave differently from an omitted cursor.
Impact
Shell variables often expand to empty strings:
testsprite project list --starting-token "$NEXT_TOKEN"If NEXT_TOKEN is empty, the CLI should reject the input instead of sending an invalid cursor.
This can cause inconsistent behavior between API endpoints and makes pagination scripts harder to debug.
Suggested fix
Add shared validation for explicitly supplied cursor values:
- reject empty strings;
- reject whitespace-only values;
- preserve valid opaque cursor values unchanged;
- keep omitted cursors as
undefined.
Apply the validation consistently to:
project list --starting-token;test list --starting-token;test result --history --cursor;- other commands using the shared pagination helper.
Add unit tests confirming:
- empty cursors exit with code 5;
- whitespace-only cursors exit with code 5;
- omitted cursors remain valid;
- non-empty opaque cursors are forwarded unchanged;
- no API request occurs for invalid input.
Related work checked
Issue #603 covers pagination flags being skipped on the test steps --run-id path. This issue concerns blank cursor values on active pagination paths.
Issue #376 covers flags being used without --history. This issue concerns an explicitly supplied blank cursor while history is active.
I searched existing issues and pull requests for blank cursors, empty cursors, --starting-token, and --cursor. I found no existing issue or PR specifically covering this problem.
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
sandman-sh commentedon Oct 25, 2026
/assign
testsprite-hob commentedon Oct 25, 2026
Thanks for the interest, @sandman-sh! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it
acceptedonce it is). Feel free to check back, or ping us on Discord if it's been quiet.ruili-testsprite commentedon Oct 31, 2026
Thanks @sandman-sh, confirmed: a blank
--starting-tokenor--cursoris read as the first page. #577, #582, #604, #646 and #663 all come from the same place, a blank option value read as an omitted one, so we'll fix it once for every option ourselves instead of flag by flag. Closing as not planned.