Skip to content

feat(cli): expose api pagination and shared cursor navigation - #1659

Open
betegon wants to merge 3 commits into
mainfrom
bt/api-pagination-cursor
Open

betegon wants to merge 3 commits into
mainfrom
bt/api-pagination-cursor

Conversation

@betegon

@betegon betegon commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

sentry api --json discarded pagination metadata, leaving agents without a way to continue a successful query. It now exposes continuation metadata and uses the CLI's shared pagination history and custom cursor decoding, so next, prev, and first work consistently with native list commands.

Before

sentry api organizations/ -f per_page=1 --json

Even when another page existed, the output had no continuation (bodies abbreviated):

{"status":200,"statusText":"OK","body":[{"slug":"example-org"}]}

After

The same command includes navigation metadata:

{"status":200,"statusText":"OK","body":[{"slug":"example-org"}],"pagination":{"nextCursor":"1:1:0","hasPrev":false}}

Repeat the endpoint and filters to navigate:

sentry api organizations/ -f per_page=1 --cursor next --json
sentry api organizations/ -f per_page=1 --cursor prev --json
sentry api organizations/ -f per_page=1 --cursor first --json

Raw cursors and custom bookmarks from the shared paginator are also accepted, including legacy cli1~ bookmarks. Resuming restores the cursor's required page size and skips rows already read; going forward and back retains that exact bookmark. This works for arrays and Events {data, meta} envelopes while preserving envelope metadata.

Each invocation still fetches one server page, and the endpoint remains required. History is scoped to the request and identity; dry-runs and failed requests do not advance it. hasPrev describes local navigation, while prevCursor is server-provided. --fields filters only the body, and raw/binary output stays unchanged. URL fragments are excluded without losing encoded # characters. Command help, docs, and the generated skill reference are updated.

Continuing without an endpoint and native logs pagination remain separate follow-ups.

Validation

  • 58 CLI/SDK E2E tests passed against the rebuilt bundle, including full navigation, custom cursor interoperability, Events envelopes, failed-request retries, and request/identity isolation.
  • Shared pagination property tests and API/history unit/model tests passed. Regression cases were also checked against the previous implementation.
  • Workspace typecheck, lint, and all package test suites passed on Linux (x64 for typecheck/tests; native ARM64 for lint). The full CLI suite passed 11,404 tests with 49 existing skips.

@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 27, 2026 7:30pm UTC

Request Review

@betegon
betegon marked this pull request as ready for review October 26, 2026 15:13
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 26, 2026
@betegon
betegon force-pushed the bt/api-pagination-cursor branch from b4cb377 to 4fe80fe Compare October 26, 2026 15:16

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the common pagination system in the repo now. We even have some custom cursors now. I'm surprised the lint rule did not catch this.

Otherwise, great change thanks a lot!

@BYK

BYK commented Oct 26, 2026

Copy link
Copy Markdown
Member

I'd even argue we should let omitting the endpoint and other args or something so one can do sentry api --cursor next to keep paging through? Or something closer to this?

@betegon betegon changed the title feat(cli): expose api pagination and cursor continuation feat(cli): expose api pagination and shared cursor navigation Oct 27, 2026

This branch was previously deployed

1 inactive deployment
Preview — b754e534 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants