Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
f2d8d61 to
dae73bb
Compare
dae73bb to
58fdcac
Compare
082354f to
6f2f6e0
Compare
58fdcac to
76ea3f5
Compare
6f2f6e0 to
5e048bf
Compare
76ea3f5 to
880d622
Compare
5e048bf to
ba01419
Compare
880d622 to
ac63354
Compare
ba01419 to
d188a55
Compare
d188a55 to
e34210a
Compare
`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 cursor history for
`next`, `prev`, and `first`.
### Before
```sh
sentry api organizations/ -f per_page=1 --json
```
Even when another page existed, the output had no continuation (bodies
abbreviated):
```json
{"status":200,"statusText":"OK","body":[{"slug":"example-org"}]}
```
### After
The same command includes navigation metadata:
```json
{"status":200,"statusText":"OK","body":[{"slug":"example-org"}],"pagination":{"nextCursor":"1:1:0","hasPrev":false}}
```
Repeat the endpoint and filters to navigate:
```sh
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 shared custom bookmarks are accepted, including legacy
`cli1~` bookmarks. Resuming restores the required page size and skips
rows already read; forward/back navigation retains that exact bookmark.
Arrays and Events `{data, meta}` envelopes are supported, preserving
envelope metadata.
### Shared SDK ownership
Uses published `@sentry/[email protected]`, including
getsentry/sentry-api-schema#116 and getsentry/sentry-api-schema#117. The
SDK owns generic URL, header, and body preparation through
`client.prepareRequest()`, plus partial-page consumption and bounded
traversal through `consumePage` and `paginateUpTo`. The API command uses
the same prepared `Request` for preview and dispatch, removing its
duplicate URL/header builders.
Toolkit keeps authentication and trusted-host checks, raw response
decoding, request/identity fingerprints, bookmark encoding, page-sizing
policy, and navigation history. The SDK accepts decoded server cursors
and offsets without depending on CLI storage or cursor formats. Existing
MCP and frontend consumers do not need to opt into request preparation.
Each `api` 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. Raw text, binary downloads, explicit Content-Type
headers, and non-2xx response bodies retain their behavior. URL
fragments are excluded without losing encoded `#` characters. Command
help, docs, and the generated skill reference are updated.
Continuing without an endpoint is stacked in #1691. Native logs
pagination remains a separate follow-up.
Generic request preparation is tested in `@sentry/api`. Additional
coverage for continuation across short and empty pages is in
getsentry/sentry-api-schema#118, a tests-only follow-up that requires no
SDK release. The consumer tests concentrate on CLI navigation/history,
identity isolation, raw response policy, and bookmark adaptation.
### Validation
- Workspace typecheck and lint pass with published
`@sentry/[email protected]`.
- API and library E2E pass against the bundled CLI. Consolidated flows
retain navigation, dry-run/error recovery, raw-file preview and
dispatch, shared/legacy bookmarks, Events metadata, and request/identity
isolation. The silent request starts without JSON mode, then resumes
through the same saved history.
- Full workspace `pnpm run test` passes on Linux x64 on the final
source: 12,669 CLI tests, 337 shared tests, and all MCP, Cloudflare,
frontend, and remaining workspace suites. Existing skips remain
unchanged.
- Review and cleanup completed with no remaining findings. Production
code is unchanged by the test consolidation.
e34210a to
d4498e0
Compare
BYK
left a comment
There was a problem hiding this comment.
I think the best way to do this is get a snapshot of the initial api call including the CWD etc if needed, serialize that deterministically along with deterministic keys and go from there. If we get the full invocation state and manage to serialize/deserialize it, it should be trivial to implement this feature properly and it may even be extended to other commands.
| choose the most recent query or switch to another when a query reaches its end. | ||
|
|
||
| Only successful GETs save a query. The saved URL expires with its cursor history | ||
| after five minutes. Explicit headers (`-H`) and request bodies are not saved; |
There was a problem hiding this comment.
Y THO?
This breaks the reliability. We can still cache them on disk if DB is too expensive. This can be a follow up but I think we should either go all in or none otherwise people won't use it if they cannot trust it will work every time.
| }); | ||
|
|
||
| describe("runMigrations", () => { | ||
| test("migration 20→21 preserves cursor stacks without assigning a request", () => { |
Continuing an API query currently requires copying its endpoint and every request argument. This adds
sentry api --cursor next,prev, andfirstwithout an endpoint when there is one recent paginated query in the current working directory, configured host, and authenticated identity.Builds on the pagination support merged in #1659. This PR targets
mainand contains only endpoint-free continuation.Before
After
The saved request URL shares the existing cursor stack and five-minute expiry. It retains the original query parameters, including repeated parameters and the context needed for custom cursors. Presentation options apply to the current invocation.
If multiple paginated queries are saved, the command asks for an explicit endpoint and filters. Exhausted queries and requests requiring explicit headers or a body still count, so navigation cannot silently switch to another query. Header/body values are not saved; configured headers are re-read and checked against the original request. Detail requests without pagination do not replace a saved query. Dry-runs and failed requests do not advance it.
Uses published
@sentry/[email protected], already adopted onmain. The SDK prepares the request used for preview and dispatch. Saved context uses the caller's URL before a custom bookmark overrides its cursor or page size; storage, query selection, and navigation remain CLI policy.Validation
mainafter feat(cli): expose api pagination and shared cursor navigation #1659 merged.range-diffconfirms the feature diff is unchanged; the PR contains no duplicate parent changes.