Repository navigation
fix(api): add ref_guard_failed problem members to the notes 409s - #573
Conversation
Refs #568 _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ Change-Id: I4bc70a1df227e6121e34473aa8832ee047b13e0e 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. Chef's kiss. 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. |
A stale
expected_notes_ref_shaonPOST /api/repos/{repo_name}/notes/appendand on theDELETE .../notesquery parameter form now answers 409 with upstream'sNotesWriteRefGuardProblemDetailsbody: the note members as before, plus the problem members with coderef_guard_failed,guardandcurrent_sha. This is PR 2 of 2 and completes #568.What
sha,notes_ref,target_ref,base_commit,new_ref_sha,result). The body keeps those members unchanged and addstype,title,status,code: ref_guard_failed,detail,error,instance,guard: expected_notes_ref_shaandcurrent_sha.current_shais the notes ref's tip, or 40 zeros when the notes ref does not exist.new_ref_shaalready repeated that value. A request that sends the deprecatedexpected_ref_shagets the standard guard name, as upstream documents.detail,errorandresult.messageare the same text as before.POST .../notesand the deprecatedDELETEbody) keep 412precondition_failedwith no problem members (desk decision on api: a stale expected_*_sha on commit-pack and diff-commit answers 412; the upstream spec lists only 409 #533), and the content type staysapplication/json(the api: problem-details later tiers (specific codes, instance, result envelope, git/LFS writers, problem+json) — held on SDK trigger #352 SDK gate has not fired).errors.go: the problem builder now returns the envelope, so the notes body embeds the same checked members that every other problem body uses.Why
The upstream docs OpenAPI of 2026-10-27 (
c494c01b, vendored by #571) documents this body for a stale notes guard. It also covers item 3 of #352 for these two routes only.Proof
DELETEquery-form stale guard. The body has no problem members there. With the fix they pass.sha,notes_ref,target_ref,new_ref_sha, a failedconflictresult whose message equalsdetail) and the guard members. Then it strips the note members and runs the shared problem oracle,assertProblemFields, on the rest.TestProblemMembersMatchUpstreampins the note members toNotesWriteRefGuardProblemDetailsin the vendored spec.current_sha40 zeros, and the deprecatedexpected_ref_shagivesguard: expected_notes_ref_sha. The append body'sinstanceis the path. TheDELETEbody form keeps 412 with nocodemember.current_sha, a wrong guard name, the note members dropped, problem members on the body forms, aresult.messagethat differs fromdetail, an extra member in the spec schema, and an oracle without the notes message.go test -race ./internal/api/...ok (PostgreSQL and SQLite), golangci-lint v2.15.0 0 issues, and the docs gate (0 broken links, the link-checker tests pass).Fixes #568
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high