Repository navigation
feat(api): emit upstream's specific problem codes from the central helpers - #428
Conversation
…lpers Refs #352 Change-Id: I72b4769979195bcb1cc0f5e81f05bf8473cdc327 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 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a6b1afbde
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
…ilures Change-Id: Id3bd9b9168a7919f0e046f19620f1db491121606 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Delightful! 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. |
Plain problem bodies now carry three of upstream's specific
codevalues, emitted from central helpers. This is PR 2 of the plan in #352 (issuecomment-6143529650).insufficient_scoperequireAuth: "missing required scope X" on plain-body routes, and a fork whosebase_repo.auth.tokenlacksgit:readrepository_not_foundrepo-urls, and the alias read flavor), and a missing fork sourcerepo_name_mismatchrepoNameMismatchMsgsites (create, fork, sync create)What stays the same
erroranddetailtext, status codes, and theapplication/jsoncontent type.forbidden). A create that reuses a deleted repository's name keepsnot_found: upstream'srepository_deletedis a 409, and the status does not change.branch_not_found,ref_not_found,credential_*,repository_deleted).{"result":{...}}) do not change. They carry no problem fields (tier 3 in api: problem-details later tiers (specific codes, instance, result envelope, git/LFS writers, problem+json) — held on SDK trigger #352).How
writeProblem(w, status, code, msg)is now the only writer of the plain envelope.writeErrcalls it with the generic code.writeProblemasserts thatcodeis either the generic code forstatusor a specific code whose upstream status isstatus.specificProblemCodeslists the emitted codes with their upstream statuses.writeRepoNotFoundandaliasRepoNotFoundreplace the repeated "repository not found" writes.requireAuthWithpasses a code to its failure writer.writeAuthEnvelope(write routes) ignores it.Tests
TestSpecificProblemCodesMatchUpstreamparses the spec's "Specific codes:" list (22 items, guarded) and checks each emitted code and its status against it.assertProblemFieldsnow derives the expectedcodefrom the status and the message with a test-side oracle, independent of the implementation. It runs on every full-server plain-error assertion (requireEnvelope) on thepgandsqlitelanes. It catches both a missed site and a specific code in the wrong place.TestErrorBodiesCarryProblemFieldspins the exactcodefor each case. New cases: the alias claim lookup (404),repo_namemismatch (400), and an org token on a repo route (403forbidden, negative control).TestWriteProblemCodeAssertions: a specific code with the wrong status and unknown codes panic.Dogfood
The same requests ran on a real local-mode server (SQLite + files) built from
origin/main(c034b20) and from this branch (1a6b1af). The stable Go and TS SDKs (1.17.1) then read the same errors. Onlycodediffers, on the three mapped failures. SDK messages andFindOneon a missing repo (nil/null) are identical. The clips are real-time asciinema replays rendered with agg.pr2-ab.mp4
Docs:
docs/reference/http-api.md(Errors) and the RFC 9457 row ofdocs/explanation/wire-compatibility.md.Refs #352
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high