feat(hotfix): add finalize verb writing diverged state, tag, and release - #104
Merged
Merged
Conversation
Promote and hotfix finalize both write manifest state to trunk with the same commit-and-push-with-rebase-retry sequence. Extract it into internal/git as CommitAndPushWithRetry and ListTags, and have promote's CommitAndPush delegate so behavior stays identical. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
After a hotfix resolution PR merges and its build and deploy succeed, finalize cross-checks the merge SHA against the env branch tip, allocates the next free hotfix version (nested rc hotfix segment for rc-based versions, reconciled patch bump for published bases), snapshots prior state into the rollback ring, writes the divergence fields and build/deploy substates, commits the manifest to trunk, and creates the hotfix tag and release object. Prerelease-env targets promote the release to a prerelease. The verb is idempotent on identical inputs. Adds regression tests proving RC tag and draft cleanup ignore hotfix tags. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Prior to this change, createRelease was passed prior.Version after it had already been overwritten with the newly allocated hotfix version, causing the release body to read "based on <hotfix>" rather than the true pre-hotfix base version. Capture baseVersion before the mutation and pass that instead. Tighten the release-body test to assert the exact "based on v1.4.0-rc.2," phrase and assert the hotfix version does not appear in the based-on position, so the test would have caught the original bug. Remove the dead --repo flag from the finalize subcommand; it was wired but never consumed and was documented as an unused placeholder. 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
A merged hotfix resolution leaves the integration branch ahead of the recorded
environment state. Nothing yet writes the diverged state back to trunk, mints the
hotfix version, or creates the release object, so the environment cannot rejoin
the pointer model cleanly.
Fix
Adds
cascade hotfix finalizeto theinternal/hotfixpackage. After theresolution PR merges and the build and deploy succeed, the verb:
env/<target>branch tip (fails on drift)vX.Y.Z-rc.N.hotfix.Msegmentfor rc-based versions, or a reconciled patch bump (skipping existing tags) for
published bases, so it never collides with the normal release sequence
previousrollback ring (its firstproducer) and writes
sha/version/ref/base_sha/patches/committed_*plus thebuild and deploy substates
base_shaforward and appends topatcheswhen stacking a second hotfix[skip ci]conventionrelease.Managewith a bodyrecording the base version and the carried trunk commit; prerelease-env targets
promote the release to a GitHub prerelease
The verb is idempotent on identical inputs: a rerun after the state already
records the merge SHA is a no-op (no double-applied patches, no re-snapshot).
A companion refactor extracts promote's commit-and-push-with-rebase-retry into
internal/git(CommitAndPushWithRetry, plusListTags); promote delegates toit so its behavior is unchanged and its existing tests stay green.
Adds regression tests in
internal/releaseproving the RC tag and draft cleanuppaths (
parseRCTag,cleanupRCTags,cleanupStaleDrafts) ignore hotfix tags.Verification
go build ./...go test ./...(1107 passing across 20 packages)go test -race ./internal/hotfix/... ./internal/release/...golangci-lint run ./internal/hotfix/... ./internal/release/... ./internal/promote/... ./internal/git/...(no issues)cd e2e && go build ./...)Coverage is unit tests plus committed scratch-repo and release-stub integration
tests (plan, manual merge, finalize end to end). The act/gitea e2e for the hotfix
flow, including finalize, lands in the e2e harness unit per the implementation
plan; this PR does not wire the verb into a generated workflow yet.