config-audit/tests/scanners
Kjell Tore Guttormsen 1543830c52 feat(commands): a write that leaves the repo says so before you approve it (M-BUG-41)
The chain observed configuration across repos but presented every write it then
proposed as though it landed where the session stands. STATE named two arms;
measuring found five, and two of them are worse than the two already known:

- implement — the approval prompt named NO path at all, only a count, so a plan
  editing ~/.claude/CLAUDE.md and one editing ./CLAUDE.md produced byte-identical
  prompts.
- rollback — the file list rendered `.claude/settings.json`, a repo-relative
  FORM, while the restore writes to the absolute original. The other arms were
  silent; this one pointed the wrong way.
- fix — paths were visible but unclassified, and --global mixed machine-wide and
  project rows into one unmarked table.

The gate's strength comes from the target's scope class, never from the command
asking: five command-owned policies would drift apart the way five copies of the
lever table did. SCOPE_CLASSES is one source for class, gate, wording and
predicate; templates render `disclosures[]` from the CLI instead of restating
what a class means.

Two orderings in that table are load-bearing, and both were measured:

- plugin-managed before user-scope. Both ~/.claude/config-audit/ and the legacy
  ~/.config-audit/ are live, and every command writes session state there. The
  other order fires the gate on every write ever made and gets it switched off,
  which is worse than no gate.
- user-scope before cross-repo. ~/.claude/.git EXISTS, so a plain .git-upward
  walk answers "another repo" for ~/.claude/CLAUDE.md and silently downgrades
  the strongest gate on the subtraction axis's primary target to disclosure.

disclose is not require-ok: campaign export is cross-repo by design, so the gate
there says so rather than refusing. Distinct from require-target-dir.mjs, which
asks whether a scan ROOT is readable (exit 3) — a different invariant, left
unmerged along with its four inline copies.

Also structural, both found while building this: the hand-maintained GUARDED
list in the unknown-flag sweep now derives its completeness from the directory
(measured complete at 14 of 14 first, so nothing was hiding — but the 15th CLI
would have been swept by nothing); and prose shape-guards use whitespace-
tolerant patterns, after one went red against a command file that did say the
right thing, line-wrapped.

Gated: implement, fix, rollback, plan, campaign export. Suite 1596 -> 1625/0,
frozen v5.0.0 and default-output baselines 0 changed files. No new GAP dimension,
no lever, no finding code — utilization denominators untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013941cEohSD5Aw56FVAtBgZ
2026-08-10 05:40:12 +02:00
..
accurate-tokens.test.mjs test: isolate HOME in all CLI-spawning tests (close leak class) 2026-06-18 18:17:09 +02:00
agent-listing-scanner.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
cache-prefix.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
campaign-cli.test.mjs feat(campaign): machine-wide always-loaded token roll-up — pure layer (v5.9 B2a) 2026-06-23 16:57:31 +02:00
campaign-export-cli.test.mjs feat(campaign): plan export + execution-by-reuse (v5.7 Fase 2 Block 4c) 2026-06-23 10:08:04 +02:00
campaign-write-cli.test.mjs fix(commands): stop answering questions the caller did not ask 2026-08-01 21:26:39 +02:00
claude-md-linter.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
cli-humanizer.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
cli-missing-target-rejection.test.mjs fix(scanners): a target path that does not exist is an error, not a grade 2026-08-09 21:18:18 +02:00
cli-pipe-integrity.test.mjs fix(scanners): stop discarding our own stdout when it is a pipe 2026-07-31 21:40:15 +02:00
cli-unknown-flag-rejection.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
collision.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
conflict-detector.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
disabled-in-schema.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
drift-cli.test.mjs fix(commands): close the promises the command templates could not keep 2026-07-31 21:27:07 +02:00
feature-gap-scanner.test.mjs feat(scanners): model/effort routing becomes a lever, not a 25th dimension (C4) 2026-08-10 05:07:23 +02:00
finding-code-coverage.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
finding-id-stability.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
fix-cli.test.mjs fix(fix): validate the arguments, back up renames, and verify the scope it fixed 2026-07-31 18:41:27 +02:00
fix-engine.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
fix-verify-instance-identity.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
gap-agent-model-routing.test.mjs feat(scanners): model/effort routing becomes a lever, not a 25th dimension (C4) 2026-08-10 05:07:23 +02:00
hook-additional-context.test.mjs feat(hooks): additionalContext injection advisory + filter-before lever (v5.10 B5) [skip-docs] 2026-06-23 20:28:33 +02:00
hook-validator.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
import-resolver.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
knowledge-refresh-cli.test.mjs feat(knowledge): model + effort routing enter the register, dated [skip-docs] 2026-08-10 04:36:09 +02:00
lint-default-output.test.mjs test(snapshots): make byte/snapshot tests hermetic + re-seed baseline 2026-06-18 12:26:00 +02:00
manifest.test.mjs feat(scanners): model/effort routing becomes a lever, not a 25th dimension (C4) 2026-08-10 05:07:23 +02:00
mcp-config-validator.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
mcp-deferral.test.mjs feat(tokens): MCP tool-schema deferral check + CLI-over-MCP lever (v5.10 B4) 2026-06-23 19:59:14 +02:00
optimization-lens-scanner.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
optimize-lens-cli.test.mjs fix(acr): optimize lens scopes out plugin-bundled CLAUDE.md + unique candidate paths (M-BUG-11) 2026-06-30 06:44:36 +02:00
output-file-robustness.test.mjs fix(commands): stop answering questions the caller did not ask 2026-08-01 21:26:39 +02:00
output-style-scanner.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
plugin-health-scanner.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
posture-grade-stability.test.mjs feat(skill-listing): add CA-SKL-002 aggregate listing-budget check 2026-06-18 18:06:17 +02:00
posture-humanizer.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
posture.test.mjs test: isolate HOME in all CLI-spawning tests (close leak class) 2026-06-18 18:17:09 +02:00
published-ids-on-real-output.test.mjs test(scanners): assert the published IDs off real output, by title 2026-08-09 23:34:02 +02:00
rollback-engine.test.mjs fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
rollback-paths.test.mjs fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
rules-validator.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
scan-orchestrator-humanizer.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
scan-orchestrator.test.mjs feat(ultraplan-local): v1.6.0 — /ultraresearch-local deep research command 2026-04-08 08:58:35 +02:00
self-audit.test.mjs feat(config-audit): self-audit --check-readme flag (v5 F6) [skip-docs] 2026-05-01 07:09:26 +02:00
settings-validator.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
skill-listing-scanner.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
token-hotspots-cli.test.mjs test: isolate HOME in all CLI-spawning tests (close leak class) 2026-06-18 18:17:09 +02:00
token-hotspots-deferral.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00
token-hotspots.test.mjs fix(scanners)!: a finding ID names the check, not the emission (M-BUG-28) 2026-08-09 23:26:36 +02:00