Skip to content

feat(operations): Expose idempotent flag in the operation catalog - #111

Merged
BYK merged 1 commit into
mainfrom
feat/operation-idempotent
Oct 27, 2026
Merged

BYK merged 1 commit into
mainfrom
feat/operation-idempotent

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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.

via BYK.

--

View Junior Session in Sentry

Read Sentry's x-sentry-idempotent operation extension so retrying clients
can tell which operations are safe to resend after a timeout or 5xx,
instead of hard-coding it per call site.

Refs getsentry/sentry#128927

Co-Authored-By: BYK <burak.kaya@sentry.io>
@BYK
BYK merged commit 00fa748 into main Oct 27, 2026
10 checks passed
@BYK
BYK deleted the feat/operation-idempotent branch October 27, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant