test(repo-guards): fail when an ADR cites a missing repository file
Summary
Adds the last #4205 completion condition: a repo guard (test/repo-guards/adr-citations.test.ts) that fails when an ADR cites a repository file that does not exist. Stacked on #4323, which removes ADR 0023's stale citations. Merge #4323 first; this PR then retargets to main.
The guard checks every backticked token in docs/adr/NNNN-*.md that has a source or config extension:
- A repository path (it contains
/) must name a tracked file. - A bare test file name (
*.test.ts) must match a tracked file's name.
It skips device or host paths (/sdcard/..., ~/...), globs, and bare runtime state names (daemon.json). A self-test pins both the rejection rules and the skip rules. docs/adr/FORMAT.md now says the guard exists.
Follow-ups from the slimming reviews
- ADR 0005 named a test file that was renamed: it is now
index-busy-resend.test.ts. The guard found this one. - ADR 0012: the exclusive
linkSyncrefusal applies only without--force/--overwrite(#4331 review). - ADR 0019: Android test-IME startup recovery is already gated on evidence. Only web orphan cleanup is still ungated (#4330 review).
- ADR 0024: perf capture already keeps its retry material, so Status, rule 6 and the amendment no longer list it as unchanged (#4326 review).
- The
platform-plugin.tscomment credited ADR 0009 with the PlatformPlugin contract. It now names ADR 0019 (from the #4325 review).
Validation
At 402ec6dc1e: pnpm check:affected --run --head 402ec6dc1e passed with exactCommit=true. Mutation control: putting ADR 0005's old test name back makes the guard fail and name it.
Closes #4205 together with #4323.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.