feat(status): add 'status consistency --fix' to delete orphan env branches - #409
Merged
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
joshua-temple
enabled auto-merge (squash)
June 28, 2026 16:21
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.
What
Adds
cascade status consistency --fix(with--remote, default origin) so a user can self-serve clean orphanenv/*branches, complementing the automatic self-heal in the hotfix preflight (#408).How
hotfix.HealOrphanEnvBrancheshelper: computes orphans via the existingOrphanEnvBranchespredicate and deletes each through an injected deleter. Delete-only, idempotent (absent branch is a no-op), and structurally cannot touch a diverged env's live branch (the deletion set is exactly the orphan set).status consistencygains--fix/--remote; report-only stays the default (output byte-identical when --fix is off). JSON addshealed_env_branches(omitempty).Tests
Unit: --fix deletes only orphans and never the diverged-env branch; idempotent no-op on re-run/absent; report-only default unchanged; JSON reflects deletions. Helper-level: deletes-only-orphans, idempotent, error propagation. go build/test (2030 pass), golangci-lint clean.
e2e
Pure CLI/cleanup reusing git.DeleteRemoteBranch (integration-tested) and the unit-covered orphan predicate; no new generator topology or manifest field. The orphan self-heal e2e lives in #408; the optional --fix lane can fold into the fleet orphan-recovery coverage.
Second PR of the hotfix-orphan goal (after #408).