Skip to content

fix(api): send target_branch and every RefUpdateResult member in commit-write results - #668

Merged
ThomasK33 merged 5 commits into
mainfrom
fix-refupdate-target-branch-665
Nov 4, 2026
Merged

ThomasK33 merged 5 commits into
mainfrom
fix-refupdate-target-branch-665

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Why

Go SDK 0.1.0 decodes the result of every commit write into RefUpdateResult and reads Result.TargetBranch. open.storage never sent target_branch, so every SDK caller got "" on commit-pack, diff-commit and restore-commit. Failure bodies also left out empty members and commit, while upstream's RefUpdateResult and CommitWriteResponse require them. This PR follows the desk decision on #665: send the spec's members exactly.

What changes for clients

Before, from a local node: "result":{"branch":"main","old_sha":"…","new_sha":"…","success":true,"status":"ok","message":"commit created"}. After: the same plus "target_branch":"main".

How

  • wcResult is now the full RefUpdateResult. wcRefUpdate builds every one, so target_branch and branch cannot differ and success is true only for status ok. The separate guard type wcGuardResult from fix(api)!: answer stale commit and notes guards with 409 ref_guard_failed #661 is gone.
  • wcEnvelope.commit has no omitempty.
  • Scope choice: the merge failure result keeps its short form (wmFailResult, unchanged on the wire). Upstream documents merge failures as problem bodies, not RefUpdateResult. The other write routes (branches, tags, notes, credentials) are unchanged too.
  • reset-commits also uses RefUpdateResult in the spec, but open.storage does not serve it (recorded deviation).

Tests

  • TestRefUpdateResultMatchesUpstream pins the members to the vendored spec: RefUpdateResult required list and properties, and the CommitWriteResponse and ReposCommitsRestoreResponse required lists.
  • wctRequireOK and wctRequireFail now check the raw body of every commit-write answer in the suite: every required member, no extra member, target_branch == branch, and commit present (null on failures other than a lost CAS).
  • Three mutations (drop target_branch from the builder, put omitempty back on commit or on old_sha) each fail a test.
  • Local gates: go build ./..., golangci-lint run (0 issues), docs link check and its unit tests, and the race lane for ./internal/api/... with CI's flags.

Dogfood

Real Go SDK github.com/pierrecomputer/sdk/go v0.1.0 with its own signed tokens (option.WithPrivateKey) against a local node. 15 checks over the three routes. Nine read Result.TargetBranch from the success answers and from the 400, 409 and 412 RefUpdateErrors (including the stale guard), and check the raw failure body for every member and commit: null. Six check that the 401s and 404s are typed problem errors (AuthenticationError, NotFoundError).

  • main (74c9684): 8 of 15 pass. TargetBranch is "" on every commit write.
  • this branch: 15 of 15 pass.

verify-openstorage recipes on this branch: commit-pack 50 PASS, 0 FAIL (main fails at the new cp-target-branch check), and token-scopes 37 PASS, 0 FAIL. On main, token-scopes fails at auth-ro-commit-status since #663, because the commit-pack 403 has no result any more. This PR updates that check to code insufficient_scope.

Docs

docs/explanation/streaming-commit-protocols.md §3 (envelope, failure example, 413 row), docs/reference/http-api.md conventions, the mirror sentence in docs/explanation/wire-compatibility.md, and the verify-openstorage commit-pack and token-scopes recipes.

Fixes #665


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…it-write results

Change-Id: Icfba172afa1a80e308621a91e58659603b380321
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I3ba86a922e6aa42a4a0d616a401468612055a3db
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T17:21:41.086093Z 0f8b211 Manual request
🔒 Security Review ✅ Completed 2026-11-04T17:22:48.565387Z 0f8b211 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 73907ab88d

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 73907ab88d

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Change-Id: I68a4913144dccf47fd3c39543337c2f647e220d3
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 2f8d7068f5

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2f8d7068f5

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Change-Id: Idd92749b23ecedffe54d3f0adffb07ff465d3e3c
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: If157de9c372f7e590caeedb682a769abbfc896a5
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 0f8b211696

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 0f8b211696

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 50b4071 Nov 4, 2026
9 of 10 checks passed
@ThomasK33
ThomasK33 deleted the fix-refupdate-target-branch-665 branch November 4, 2026 18:17
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.

Upstream drift: commit-write result objects omit target_branch (and failure envelopes omit empty members and commit: null)

1 participant