Repository navigation
feat(api)!: send application/problem+json on problem bodies - #660
Conversation
Every body that newProblem builds (writeErr, writeProblem, writeInvalid, the ref_guard_failed bodies and the git-surface 429) now has Content-Type application/problem+json, the type upstream's spec documents for problem details. Result envelopes and success bodies keep application/json. _Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high_ Change-Id: I1031f8f8f36505c402a72d1c1654e37c54636319 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Local race lanes on head
Generated with |
Every error body with the RFC 9457 problem members now has
Content-Type: application/problem+json. Before, it wasapplication/json. This is item 5 of #352. Result envelopes and success bodies keepapplication/json.Why
I checked the vendored spec
412b90c3and recorded the answer on #352 before coding (issuecomment-6628318574):application/problem+json".application/problem+jsoncarries the problem body andapplication/jsoncarries the result envelope (CommitWriteResponse,MergeConflict).application/problem+jsonfor everyAcceptvalue I tried.The desk rule for item 5: follow what the spec documents.
What changes
writeProblemJSON(internal/api/errors.go) writes every body thatnewProblembuilds asapplication/problem+json. That coverswriteErr,writeProblem,writeInvalid, theref_guard_failedbodies (merge guard, notes guard) and the git-surface 429.writeJSONkeepsapplication/jsonfor everything else: success bodies, and thewcFail,wmFailConflictandwrefNoteFailresult envelopes.docs/reference/http-api.md(Errors and the notes guard) and the RFC 9457 row ofdocs/explanation/wire-compatibility.md.SDK effect
response.json()with no type check.application/json. The error message becomes the raw body text instead oferror, andBodybecomes a string.Validation
go build ./...,golangci-lint run(2.15.0): 0 issues. Docs gate: 0 broken links, link-checker tests OK.afb8c3aawith CI's flags:./internal/api/...and./cmd/...pass.internal/githttplanes: see the comment below.requireEnvelopeanddecodeEnvelope, which back most error assertions in internal/api, now requireapplication/problem+json. So do the writeErr unit test, the merge and notes guard checks and the two 429 tests. The newTestResultEnvelopeContentTypepinsapplication/jsonon the result envelopes.Dogfood
I used the verify-openstorage harness: one local node built from
origin/main(63f81faa) and one from this head, each with 17 PASS checks.application/jsonapplication/problem+jsonapplication/jsonapplication/jsongo/v0.1.0) on the same five error calls gave the same type,code,detailand message on both nodes, includingRefGuardErrorwithguardandcurrent_sha.message="repository not found"on main and the raw problem JSON on this PR. That is the effect in the BREAKING CHANGE note below.openstorage mint, because SDK 0.1.0's own tokens fail here (Accept the tokens that SDK 0.1.0 signs: SDK sub claims and org-wide tokens without a repo claim #658).Refs #352
BREAKING CHANGE: error bodies with problem members (
code,detail, ...) are now sent asContent-Type: application/problem+json, as upstream documents. SDK 1.17.1 Go and TypeScript clients parse error JSON only forapplication/json, so their error message becomes the raw body text and the parsed body becomes a string. SDK 0.1.0 and the 1.17.1 Python client are not affected.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high