Worktree Guard Integration Tests
Three CLI commands hard-block execution when run from inside a worktree: `init`, `setup complete`, and `work complete`. A fourth (`scan --save`) warns but continues. These guards prevent repo corruption — running `init` from a worktree creates a nested `.ana/`, running `work complete` corrupts the proof chain. All four guards are verified only by source inspection (A028, A030, A031, A032 in the worktree-isolation verify report). No integration test verifies that the guard actually fires when a command runs from inside a worktree. This scope adds those tests.
verdict PASSscore 10 / 10findings 3 (1 risk · 2 debt · 0 obs)duration 28mrejection cycles 0shipped May 15, 2026surface cli
Pipeline timeline
Intent to proven code in 28m across Think, Plan, Build, and Verify.
Think4m
Plan3m
Build3m
Verify4m
Assertion ledger
10 claims, each independently verified. Showing 8 — show all →
| ID | Says | Matcher | |
|---|---|---|---|
| A001 | Running init from a worktree exits with an error | verified | ok |
| A002 | The init worktree error tells the user to use the main directory | verified | ok |
| A003 | Running setup complete from a worktree exits with an error | verified | ok |
| A004 | The setup complete worktree error tells the user to use the main directory | verified | ok |
| A005 | Running work complete from a worktree exits with an error | verified | ok |
| A006 | The work complete worktree error tells the user to use the main directory | verified | ok |
| A007 | Running scan --save from a worktree warns but does not exit | verified | ok |
| A008 | The scan --save worktree warning mentions being in a worktree | verified | ok |
Findings 3 total
debtpackages/cli/tests/commands/worktree-guards.test.ts→ closed
A009 test only verifies cwd restoration, not process.exit or console spy cleanup
riskpackages/cli/tests/commands/worktree-guards.test.ts→ closed
Console and process.exit spies restored inline after assertions — leak on assertion failure
debtpackages/cli/tests/commands/worktree-guards.test.ts→ closed
A009 test is order-dependent — relies on running after the other describe blocks
Integrity seal
scopesha256:0bc4ee861115a...
contractsha256:47f9e1c0190bb...
plansha256:11b5256d1fda6...
specsha256:2ea64253795c4...
build-reportsha256:4c066b693da37...
build-datasha256:9f1424bb781bd...
verify-reportsha256:ebd5549fcfd5f...
verify-datasha256:b517e916d6e6b...
audit cmd$ ana proof audit worktree-guard-tests → all hashes match