feat: add cascade hotfix plan verb - #103
Merged
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Establish the internal/hotfix package and register a cobra hotfix command with a plan subcommand. plan validates a hotfix request against trunk ancestry, target-env eligibility (configured, not first; prod allowed), no-op detection, env branch reconciliation, and a single-flight open-PR gate, then emits the env branch, base SHA, hotfix version candidate, and ready-to-run branch-protection command suggestions as JSON or GitHub Actions outputs. dry-run mutates nothing. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
A blocked single-flight check previously ran after env/<target> branch creation, leaving a partial git mutation on a failed plan. Reorder so the open-PR gate runs before any branch reconciliation; a blocked plan now leaves no git state. Extends the single-flight test to assert env/<target> is not created when blocked. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Exercises the full plan flow over a real temporary git repository: branch reconciliation at the recorded state SHA, all emitted outputs, and a dry-run that mutates nothing. 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 per-environment hotfix applies a trunk commit onto an environment pinned to an
older trunk base. cascade needs a verb that validates and computes that plan
before the generated workflow performs the cherry-pick, build, deploy, and state
write.
Fix
Adds the
cascade hotfix planverb. Given a fix ref and a target environment, itenforces, in order: trunk ancestry of the fix, target-env eligibility (the first
environment is rejected; prod is eligible, gated at the workflow layer), no-op
detection when the fix is already contained in the target state SHA, a
single-flight open-PR gate, and env branch reconciliation. The single-flight gate
runs before any branch mutation, so a blocked plan leaves no git state changes.
It emits the branch, base SHA, hotfix version candidate, and ready-to-run branch
protection suggestions as JSON and step outputs.
--dry-runcomputes everythingand mutates nothing.
Verification
go build ./...go test ./...green, including comprehensive unit tests and scratch-repointegration tests that run the full plan flow over a real temporary git
repository (branch reconciliation at the recorded state SHA, every emitted
output, single-flight leaving no branch, and dry-run mutating nothing).
golangci-lint run ./...clean.Scope note
End-to-end scenarios for the hotfix capability, including exercising the plan
verb through the generated workflow under the act and gitea harness, are owned by
the e2e harness unit per the implementation plan; the plan verb is not yet wired
into any generated workflow template. This PR ships comprehensive unit and
scratch-repo integration coverage for the verb itself.