fix(repo-hygiene): emit RESTORED>0 warning on git-tree-reset exit-7 failure path (#605)#655
Conversation
…ailure path (#605) The exit-7 clean-failure path (git clean -fdx failed for a non-locked-file cause) emitted `RestoredTracked: N` but skipped the human-visible `WARNING: restored N tracked file(s)` message the success path prints when RESTORED>0. An operator on the failure path could therefore miss that the reparse-point restore guard fired (data-loss recovery), even though the machine-readable line was present. Mirror the success path's exact warning (same wording, same RESTORED>0 condition) onto the failure path so both paths surface restore-guard activity identically. Add a test that drives the exit-7 path with a partial clean that deletes a tracked file before failing (RESTORED=1) and asserts the warning now appears; verified it fails without the fix. Bump repo-hygiene 0.4.0 -> 0.4.1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 2m 17s —— View job PR Review
SummaryThis is a clean, tightly-scoped fix. The 8-line addition to Fix correctness —
|
Post-green review classificationNo findings requiring action. Reviewer confirmed the fix is byte-for-byte identical to the success path's existing warning pattern, correctly placed, no injection risk, well-tested (test #12 asserts both the warning text and the actual file restoration). One noted-but-intentional test omission (already covered elsewhere). CI green (16/16). Flipping to ready for review. |
|
Claude finished @kyle-sexton's task in 2m 2s —— View job PR Review
SummaryClean, tightly-scoped fix with good test coverage. The 8-line addition exactly mirrors the existing success-path warning onto the exit-7 failure path with no other behavioral changes. Recommend merge. Fix correctness —
|
Post-green review classification (round 2)Second reviewer pass (job run 29729803370, 09:00:35Z) also lands no blocking findings — recommend merge, confirming the earlier classification. Its one non-blocking nit differs from round 1: it flags that Head unchanged ( |
Summary
On the
git-tree-reset.shexit-7 clean-failure path (git clean -fdx failed for a non-locked-file cause), the script emitted the machine-readableRestoredTracked: Nline but skipped the human-visibleWARNING: restored N tracked file(s)message that the success path already prints whenRESTORED>0. An operator hitting the failure path could therefore miss that the reparse-point restore guard fired — i.e. that data-loss recovery mutated the working tree back — even though a clean that errors mid-run may have deleted tracked files before failing.Fix
Mirror the success path's warning onto the exit-7 failure path: under the same
RESTORED>0condition, emit the sameWARNING: restored N tracked file(s) deleted via reparse-point traversal (junction/symlink into tracked dir).message (identical wording, same stderr stream) at the point whereRestoredTracked: Nis emitted alone. Both paths now surface restore-guard activity identically for this signal. No other behavior changes.Verification
Added test case #12 to
git-tree-reset.test.sh. It drives the exit-7 path with a git shim whose fakedcleandeletes a tracked file (simulating a partial clean that deleted tracked files via reparse-point traversal) and then exits non-zero, sogit ls-files --deletedreports the file and the restore guard recovers it (RESTORED=1) on the failure path. It asserts exit 7,RestoredTracked: 1, and that the warning now appears.Full suite (50 assertions) passes:
Negative check — stashing only the source fix and re-running proves the new test is meaningful (it fails without the fix):
shellcheckon both the script and the test reports no findings.Closes #605
Related
AppliedCleanfalse-success gate that introduced the exit-7 failure path this warning-parity fix completes🤖 Generated with a Claude Code implementation subagent (issue #605)