feat(tools): fail the gate when docs cite a path that no longer exists

docs/architecture is declared authoritative for settled design, so a page that
cites code which has moved actively misleads every session and every subagent
brief that reads it. Nothing in the gate compared a prose citation against the
tree: docsgen checks the contract schema against Go types, docsite checks
generated artifacts against their Markdown sources, prdlint checks PRD writing
style. All three verify internal consistency, so a page can describe a package
deleted months ago and every check stays green -- which is how a page describing
a removed system survives behind a hand-written "removed" banner.

Add tools/docdrift. It resolves every internal/... citation under docs/ against
the tree and fails on one that dangles, handling the shapes prose actually uses:
a package with a symbol (internal/config.Config), a test with its package
(internal/app/archieui/TestFoo), a file-shape template
(internal/webui/api_<concern>.go), and a Go package pattern (internal/...).
Generated artifacts are skipped so embedded page bodies are not double-counted.

The baseline is a burn-down list of the 48 citations already broken -- packages
that moved (internal/store, internal/memory, internal/nats) and ones never built
(internal/policy, the image and research capability docs). It is not a licence:
the check also fails when an allowlisted citation starts resolving again, so an
exemption cannot outlive its reason. Regenerate with `docdrift list`.

Wire it into `task check` as docs:drift.

Also correct AGENTS.md, which listed `policy` among the cross-cutting packages
sitting under internal/. No such package has ever existed in this tree; the
design is approved and unbuilt (docs/architecture/policy.md). That is exactly
the class of stale claim this check now catches.
This commit is contained in:
sam committed 2026-10-03 00:31:06 +10:00
1 parent dd3abd2c95
commit 0ca1189a33
5 files changed
+647 -2

No files matched your search

+6
View File
@@ -61,6 +61,11 @@ tasks:
cmds:
- go -C tools run -mod=readonly ./prdlint --repo-root ..
docs:drift:
desc: Reject docs that cite a repository path which no longer exists
cmds:
- go -C tools run -mod=readonly ./docdrift check --repo-root ..
news:
desc: Regenerate the release data artifacts from the changelog
cmds:
@@ -300,6 +305,7 @@ tasks:
- task: proto:lint
- task: docs:check
- task: docs:prds
- task: docs:drift
- task: news:check
- task: docs:artifact:check
- task: vet