fix(cli): expose pagination cursors and fetch complete inventories - #7590
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cubic-dev-ai review this PR |
@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete. |
Greptile SummaryThe PR updates CLI pagination so structured output exposes continuation cursors, bounded requests preserve an accurate cursor, and inventory commands fetch complete datasets by default.
Confidence Score: 5/5The PR appears safe to merge; the previously identified repeated-cursor loop is addressed without introducing a new actionable failure. Cursor history is now validated before additional pages are accumulated or rendered, including immediate repetition of a user-supplied continuation cursor. Remaining-limit request sizing preserves accurate continuation semantics, and the accompanying tests cover query- and body-based pagination, bounded and unbounded traversal, malformed pages, and cursor cycles.
|
| Filename | Overview |
|---|---|
| packages/sim-cli/src/runtime/execute.ts | Implements bounded and unbounded pagination, cursor continuation, cycle detection, page-size validation, and structured page rendering. |
| packages/sim-cli/src/http/client.ts | Consolidates complete-page traversal and rejects repeated pagination cursors. |
| packages/sim-cli/src/runtime/options.ts | Separates request page size from command defaults and classifies inventory commands for complete traversal. |
| packages/sim-cli/src/runtime/result.ts | Emits data and nextCursor envelopes for paginated JSON and YAML output. |
| packages/sim-cli/src/commands/protocol/resource-directory.ts | Fetches complete paginated resource inventories for directory listings by default. |
| packages/sim-cli/src/runtime/build.test.ts | Adds broad regression coverage for limits, continuation, cursor cycles, page sizing, and output envelopes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Invoke paginated CLI command] --> B{Explicit/default limit}
B -->|0| C[Use unbounded total]
B -->|N > 0| D[Use bounded total N]
C --> E[Request up to 100 items]
D --> F[Request min of 100 and remaining limit]
E --> G[Validate page size and nextCursor]
F --> G
G -->|Repeated or invalid cursor| H[Fail without printing partial output]
G -->|Valid page| I[Accumulate data]
I --> J{Cursor remains and total limit not reached?}
J -->|Yes| E
J -->|No| K[Render data and nextCursor]
Reviews (2): Last reviewed commit: "fix(cli): reject pagination cursor cycle..." | Re-trigger Greptile
|
Addressed the repeated-cursor finding in 1dd8165. Both pagination loops now use the same cursor-cycle check and throw before appending the offending page. Resumed commands seed the seen set with the supplied cursor, so a response that echoes it fails immediately. Regression tests cover repeated cursors, longer cycles, and query/body continuation without partial output. Also corrected the example run ID flagged by the docs test. The CLI suite (976 passed, 1 skipped), repository script tests (283 passed), type checking, lint, and all 46 audits pass locally. |
|
@cubic-dev-ai review this PR |
@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete. |
Summary
{ data, nextCursor }and remove the pagination notice. Scripts now read items from.datainstead of a bare array.ls. Keep table rows, logs, histories, documents, and chunks capped at 100 by default with--cursorto continue;--limit 0still fetches all remaining results.Type of Change
Testing
Checklist