Skip to content

feat(status): add 'status consistency --fix' to delete orphan env branches - #409

Merged
joshua-temple merged 1 commit into
mainfrom
feat/status-consistency-fix
Jun 28, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
feat/status-consistency-fix

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

What

Adds cascade status consistency --fix (with --remote, default origin) so a user can self-serve clean orphan env/* branches, complementing the automatic self-heal in the hotfix preflight (#408).

How

  • New shared hotfix.HealOrphanEnvBranches helper: computes orphans via the existing OrphanEnvBranches predicate 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 consistency gains --fix/--remote; report-only stays the default (output byte-identical when --fix is off). JSON adds healed_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).

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple enabled auto-merge (squash) June 28, 2026 16:21
@joshua-temple
joshua-temple merged commit ee53391 into main Jun 28, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant