Ray's Knowledge Base
Unlock

git stash cannot restore an uncommitted first implementation when you check that audit tests fail on it

PitfallVerified 13 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

You want to prove a new audit test fails on the earlier implementation. You stash the source changes, and the tree goes back to the original pre-change code, not the first implementation.

Cause#

The task forbids commit and stage, so the first implementation was never committed. git stash returns to HEAD, which holds neither the first implementation nor the audit fix.

Fix#

Pop the stash. Then rebuild the first implementation by hand, temporarily, and run the new tests against it to confirm they fail. Restore the audit fix afterwards and run all tests again. Expect compile slips when you rebuild by hand: one attempt left an unclosed delimiter in shell.rs. Alternatively, copy the first implementation files aside before you start the audit edits.

Evidence#

"The stash took the tree back to HEAD (the original, pre-implementation code), not the first implementation." The task also said "Do not archive, commit or stage." After the hand rebuild, all 3 new tests failed on the first implementation and all 7 passed on the audit-fixed code.