config-audit/tests
Kjell Tore Guttormsen 1d63492617 fix(acr): optimize lens scopes out plugin-bundled CLAUDE.md + unique candidate paths (M-BUG-11)
The optimize lens CLI fed its precision-gate agent every CLAUDE.md that discovery
returned, including the 256 files under ~/.claude/plugins/ — vendored plugin
CLAUDE.md across every cached version (7 config-audit, 6 ms-ai-architect, 5 okr,
...) plus their bundled tests/fixtures and examples. Running `optimize --global`
on this machine produced 454 candidates across 92 "files", ~250 of them sourced
from plugin-internal files a user cannot act on (the plugin overwrites them on
update). Same class as M-BUG-2: plugin-bundled config is not the user's cascade.

Second defect: candidates were keyed by `relPath || absPath`, but relPath
collides across scopes — a repo-root `CLAUDE.md` and the user-global
`~/.claude/CLAUDE.md` both relPath to `CLAUDE.md`. The two files that actually
matter were merged into one indistinguishable bucket (21 candidates), the agent's
Read(file) would resolve the wrong one, and cache-file relPaths were not readable
relative to cwd at all.

Fix (lens-CLI-local, surgical):
- Filter isPluginBundled (absPath under `.claude/plugins/`) from discovery for
  BOTH halves of the motor (candidate loop + the OPT scanner, which reads
  discovery.files directly). Drops vendored files regardless of active/stale
  version, so excludeCache is unnecessary here.
- Key each candidate by absPath: unique + readable.
No change to file-discovery.mjs or the OPT scanner, so their byte-stable
snapshots are untouched.

Suite 1348/0 (+4: candidate scoping, real-config survives, deterministic scoping,
absolute-path identity). Frozen v5.0.0 + SC-5 snapshots untouched (the lens CLI
has no snapshot; the command is agent-driven, not byte-stable). Dogfood ~/.claude
`optimize --global`: candidates 454->45, deterministic 2->0 (both were stale
plugin-cache copies), distinct files 92->11, repo vs user-global now distinct
(12 + 9 = 21). Residual 45 includes config-audit's own tests/fixtures CLAUDE.md
(repo-specific dogfooding artifact, not a general bug — left alone).
2026-06-30 06:44:36 +02:00
..
agents feat(humanizer): update agent system prompts [skip-docs] 2026-05-01 19:53:59 +02:00
commands feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
fixtures fix(acr): CPS ignores fenced/inline code + CC-stable path vars (M-BUG-7) 2026-06-26 12:45:14 +02:00
helpers feat(scanner): add AGT agent-listing always-loaded budget finding (v5.9 B1) 2026-06-23 15:02:59 +02:00
hooks feat(ultraplan-local): v1.6.0 — /ultraresearch-local deep research command 2026-04-08 08:58:35 +02:00
knowledge fix(tokens): refresh stale "Opus 4.7" framing to model-neutral + Opus 4.8 anchor 2026-06-18 15:27:36 +02:00
lib fix(acr): SET typo-gates unknown-key false positives (M-BUG-10) 2026-06-26 15:15:14 +02:00
scanners fix(acr): optimize lens scopes out plugin-bundled CLAUDE.md + unique candidate paths (M-BUG-11) 2026-06-30 06:44:36 +02:00
scenarios feat(humanizer): scenario read-test corpus + runner (SC-4) [skip-docs] 2026-05-01 18:16:23 +02:00
snapshots feat(scanner): add AGT agent-listing always-loaded budget finding (v5.9 B1) 2026-06-23 15:02:59 +02:00
json-backcompat.test.mjs feat(ost): v5.6 C — output-style scanner (CA-OST, count 13→14) 2026-06-20 21:02:44 +02:00
lint-default-output.mjs feat(humanizer): forbidden-words lint runner + test wrapper (SC-3) [skip-docs] 2026-05-01 18:11:15 +02:00
lint-forbidden-words.json feat(humanizer): forbidden-words data file (tier1/2/3) 2026-05-01 16:53:37 +02:00
raw-backcompat.test.mjs feat(ost): v5.6 C — output-style scanner (CA-OST, count 13→14) 2026-06-20 21:02:44 +02:00
scenario-read-test.mjs feat(humanizer): scenario read-test corpus + runner (SC-4) [skip-docs] 2026-05-01 18:16:23 +02:00
scenario-read-test.test.mjs feat(humanizer): scenario read-test corpus + runner (SC-4) [skip-docs] 2026-05-01 18:16:23 +02:00
snapshot-default-output.test.mjs test(snapshots): make byte/snapshot tests hermetic + re-seed baseline 2026-06-18 12:26:00 +02:00