fix(release): cut the git tag unconditionally when updating an existing release - #551
Merged
Merged
Conversation
update() only materialized the git tag on the create path. When a release object already existed (a draft matched by tag or target SHA) it PATCHed and returned without cutting the tag, so under a concurrent shared-path wave a pre-existing tagless draft advanced the state leaf while the git tag stayed absent. The state write is an unconditional CAS loop; tag creation was conditional and unretried, and that asymmetry left the tag permanently missing. Make the tag cut unconditional and idempotent on both update branches, mirroring create(). createGitTag already treats a 422 as success, so a convergence rerun is a no-op. Tag-only mode is unchanged. Adds TestManager_Update_CutsGitTag covering the existing-draft, no-release, and already-present-tag cases. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Manager.update()only cuts the git tag on the create path (when no release object exists). If a release object already exists for the version (for example a draft release), it PATCHes the release and returns without ever callingcreateGitTag. So the git tag is only ever guaranteed on the create branch. If a tagless draft release for that version pre-exists, the git tag is permanently missing even though the state write (an unconditional 10-attempt CAS loop) still advances the leaf.Because the bug itself produces tagless draft releases, they accumulate and keep starving the tag on subsequent runs. Surfaced live under a concurrent shared-path wave: the draft release
web-0.2.0-rc.0existed but the git tagweb-0.2.0-rc.0did not, while the orchestrate run concluded success and the state leaf advanced. The state write is a guaranteed CAS loop; tag creation was conditional and unretried, and that asymmetry is the defect.Fix
internal/release/release.go: inupdate(), cut the git tag unconditionally whenCreateTagis set, on the pre-existing-release (PATCH) branch as well as the create branch.createGitTagalready treats a 422 "already exists" as success, so re-cutting a present tag is a no-op. Tag-only mode is untouched (it returns viacreate()and never PATCHes), and the PATCH payload semantics are unchanged.Verification
Regression test
TestManager_Update_CutsGitTag(red before, green after): update against a pre-existing draft with no git tag now cuts the tag; the no-release path still cuts viacreate(); a second update with the tag present is an idempotent no-op.go build ./...,go test ./...(2711 pass),go test ./... -race,golangci-lint run ./...all clean; no emitted-workflow or golden change.Caught by the v1-readiness fleet's shared-path concurrency wave.