Skip to content

fix(repo-hygiene): git-tree-reset dry-run doesn't validate @{u}, so dry-run success != apply success #396

Description

@kyle-sexton

Summary

git-tree-reset.sh --dry-run does not validate that the upstream (@{u}) actually resolves, so a clean-looking dry-run (Blocked: none) does not predict that --apply will fail. Dry-run/apply parity is broken for the deleted-upstream case.

Component

plugins/repo-hygiene/skills/clean/scripts/git-tree-reset.sh.

Root cause

The dry-run branch (lines ~154–165) prints PlannedReset: git reset --hard <UPSTREAM> and previews git clean -fdxn, but never verifies the upstream ref exists. When UPSTREAM is the literal @{u} (see companion unresolved-upstream issue), dry-run still reports Blocked: none and a nonzero wouldRemove count, implying the apply will proceed cleanly.

Evidence (this session)

Dry-run sweep across 16 repos reported blocked=none for the 6 feature-branch repos whose upstream was gone. The subsequent --apply then failed on every one of those 6 with fatal: ambiguous argument '@{u}'. The dry-run gave zero warning.

Impact

Dry-run is the safety gate the skill's own workflow mandates before --apply. If dry-run cannot surface a condition that will fail (or partially execute destructively) at apply time, the gate provides false assurance.

Expected

Dry-run performs the same upstream-resolution validation as apply and reports the blocked/unresolved state, so dry-run success ⇒ apply will not fail on upstream resolution.

Acceptance criteria

  • Move upstream-resolution validation ahead of the dry-run/apply split so both paths see it.
  • Dry-run prints the same Blocked: reason apply would (e.g. upstream-unresolved).
  • Regression test asserting dry-run and apply agree on the deleted-upstream branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumReal value, no hard deadline; normal backlog flow.status: needs-decisionAwaiting a human or maintainer judgment call.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions