config-audit/tests/commands
Kjell Tore Guttormsen 33bfd5ff5b fix(commands): the removal gate was classified against the wrong root
Found by review after the SUB-WRITE commit, and both defects were in the
template rather than the engine every prediction in the fasit was about.

`--repo` is what a write target is classified AGAINST. The template passed the
SCAN target, and under `--global` that target IS ~/.claude -- so
~/.claude/CLAUDE.md matched `in-repo` and the gate went `silent`. Measured
against the real config: gate silent, scopeClass in-repo, 29 removals applied
with no approval asked. That is the same silent downgrade #62 measured for a
naive .git-upward walk, arriving through a different door, on the one target
this chunk was sequenced behind M-BUG-41 to protect. Every other gated template
already passed `--repo "$PWD"`; this one was the only outlier.

The dry run also could not validate the machine-wide case -- the case that is
mandatory in v1. The gate returned before any file was read, so a dry run there
reported 29 scope-gate refusals and zero checked spans, and the first run able
to find a stale approval would have been the one that writes. A gate guards a
WRITE, and a dry run is not one: `requiresApproval` and the disclosures are
still reported, so the operator is still asked.

The new caller-arm guard was itself red against the corrected template, matching
prose that merely NAMES the CLI. Narrowed to lines that invoke it.

Guards seen red against the original defects: `--repo "<target-path>"` red,
`--repo` omitted red, gate-blocks-dry-run red. Re-dogfooded as the template now
calls it: require-ok / user-scope / 29 spans validated / 0 files written.

Suite 1659 -> 1662/0. Frozen baselines untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017A6vrtPKsVuM4DJ27p7jzw
2026-08-10 06:15:25 +02:00
..
action-commands-shape.test.mjs fix(commands): stop assuming shell state survives between blocks 2026-08-01 20:12:17 +02:00
analyze-report-persistence.test.mjs fix(acr): analyze persists agent-returned report (M-BUG-18) 2026-07-16 20:24:12 +02:00
command-flag-value-portability.test.mjs fix(commands): stop answering questions the caller did not ask 2026-08-01 21:26:39 +02:00
command-output-discipline.test.mjs fix(commands): stop writing files no later step can read, and payloads nobody asked for 2026-08-01 20:40:07 +02:00
command-placeholder-shell-safety.test.mjs fix(commands): router dogfood — five seam defects, plus the placeholder class 2026-08-09 21:18:05 +02:00
command-shell-state-shape.test.mjs fix(commands): router dogfood — five seam defects, plus the placeholder class 2026-08-09 21:18:05 +02:00
group-a-shape.test.mjs feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00
group-b-shape.test.mjs fix(commands): stop assuming shell state survives between blocks 2026-08-01 20:12:17 +02:00
implement-log-append.test.mjs fix(acr): pin Bash >> append discipline on shared implementation log (M-BUG-20) 2026-07-17 03:53:06 +02:00
interview-chunk-shape.test.mjs fix(commands): close the promises the command templates could not keep 2026-07-31 21:27:07 +02:00
knowledge-refresh-write-target.test.mjs fix(commands): stop answering questions the caller did not ask 2026-08-01 21:26:39 +02:00
router-shape.test.mjs fix(commands): router dogfood — five seam defects, plus the placeholder class 2026-08-09 21:18:05 +02:00
subtraction-write-shape.test.mjs fix(commands): the removal gate was classified against the wrong root 2026-08-10 06:15:25 +02:00
write-scope-gate-shape.test.mjs feat(commands): a write that leaves the repo says so before you approve it (M-BUG-41) 2026-08-10 05:40:12 +02:00