Skip to content

feat: add cascade hotfix plan verb - #103

Merged
joshua-temple merged 4 commits into
mainfrom
feat/hotfix-plan-verb
Jun 11, 2026
Merged

joshua-temple merged 4 commits into
mainfrom
feat/hotfix-plan-verb

Conversation

@joshua-temple

@joshua-temple joshua-temple commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

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 plan verb. Given a fix ref and a target environment, it
enforces, 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-run computes everything
and mutates nothing.

Verification

  • go build ./...
  • go test ./... green, including comprehensive unit tests and scratch-repo
    integration 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.

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>
@joshua-temple
joshua-temple merged commit d15db4b into main Jun 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant