You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 00fa748
Browse filesBrowse the repository at this point in the historyBrowse files
feat(operations): Expose idempotent flag in the operation catalog (#111)
Adds `idempotent: boolean` to every `ApiOperation` in
`@sentry/api/operations`. Retrying clients such as the CLI and MCP can
then decide from the catalog whether to resend a request after a timeout
or 5xx, instead of hard-coding that per call site.
Refs getsentry/sentry#128927. The Sentry side, getsentry/sentry#128930,
now stamps `x-sentry-idempotent: true` on operations whose endpoint
declares the method in `idempotent_methods`.
**Semantics**
- `GET`, `HEAD`, `OPTIONS`, `TRACE`: always `true` (RFC 9110 §9.2.1).
Clients get one field to check, with no method special-casing.
- Other methods: `true` only when the operation has
`x-sentry-idempotent: true`. `PUT` and `DELETE` are not assumed
idempotent because not every Sentry handler follows RFC 9110 §9.2.2.
Sentry makes the same choice.
- `false` means "not known to be idempotent", not "known to be unsafe".
It is documented that way in the type docs and the README.
**Current effect**
Today's `openapi-derefed.json` has no `x-sentry-idempotent` markers. The
endpoints declared so far (chunk upload, DIF assemble, artifact bundle
assemble) are all `PRIVATE`, so nothing non-safe is marked yet. In the
current build, 147 of 266 operations are `idempotent: true`, all safe
methods. Non-safe operations will be marked as they're published with
the declaration.
**Verification**
- `bun run build`, `bun run typecheck`, `bun test` (167 pass), `bun run
test:node`
- New test: a marked `POST` is `true`; an unmarked `POST`/`PUT`/`DELETE`
is `false`. Existing catalog fixtures assert `true` for `GET` and
`false` for an unmarked `POST`.
<!-- junior-request-attribution:start -->
via **BYK**.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A828b4ad5f18c5305232eec52 -->
--
[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A828b4ad5f18c5305232eec52/?project=4510944073809921)
<!-- junior-session-footer:end -->
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <burak.kaya@sentry.io>
Each `ApiOperation` records the actual exported `functionName`, original OpenAPI `operationId`, method, path, summary, description, tags, path parameter names, query metadata, and explicit deprecation flag. `ApiQueryParameter` includes the name, required flag, description, type, and declared enum values (item values for arrays). Operation parameters override inherited path parameters.
101
+
Each `ApiOperation` records the actual exported `functionName`, original OpenAPI `operationId`, method, path, summary, description, tags, path parameter names, query metadata, explicit deprecation flag, and `idempotent` flag. `ApiQueryParameter` includes the name, required flag, description, type, and declared enum values (item values for arrays). Operation parameters override inherited path parameters.
102
+
103
+
`idempotent` tells retrying clients whether resending an identical request after a timeout or 5xx response is safe. It is always `true` for `GET`, `HEAD`, `OPTIONS`, and `TRACE`. Other methods are `true` only when Sentry marks the operation with the `x-sentry-idempotent` OpenAPI extension; `false` means not known to be idempotent, not known to be unsafe.
102
104
103
105
The catalog is generated from the same schema and SDK output as each release. Consumers own search, grouping, ranking, and command aliases; the catalog does not fetch a live schema or infer undocumented API behavior.
0 commit comments