feat: add doc-accuracy reviewer to catch harmful documentation changes - #714
feat: add doc-accuracy reviewer to catch harmful documentation changes#714Iheanacho-ai wants to merge 1 commit into
Conversation
ada792b to
2dac14c
Compare
| args = append(args, | ||
| "--output-format", "stream-json", "--verbose", | ||
| "--permission-mode", "bypassPermissions", | ||
| "--allowedTools", "Read", "Grep", "Glob", "WebFetch", |
There was a problem hiding this comment.
From Claude:
--allowedTools is ignored under --permission-mode bypassPermissions (claude-code#12232). The whitelist here isn't actually a whitelist, so Bash is unrestricted and the read-only claim doesn't hold. --disallowedTools Edit,Write should still block those two. --permission-mode dontAsk with this allowedTools list, or --tools as a real whitelist, would do what this is aiming for.
| that previously made the procedure safe. Compare against the diff and the | ||
| upstream source; a deletion that makes a command *more* dangerous is a | ||
| top-priority finding even if what remains is valid. | ||
| - **Security downgrades / exposure** — disabling TLS or auth, `--insecure`, |
There was a problem hiding this comment.
--insecure as CRITICAL will fail half the Talos bootstrap corpus (talosctl apply-config --insecure). Worth carving out the documented bootstrap case so this doesn't train us to ignore the tool.
| DOC_ACCURACY_MODEL ?= | ||
|
|
||
| .PHONY: check-doc-accuracy | ||
| check-doc-accuracy: ## AI-review docs for accuracy/harm. Scope one file with DOC=public/path; base with DOC_ACCURACY_BASE |
There was a problem hiding this comment.
The default base is HEAD, so after a local commit this won't actually review anything (DOC_ACCURACY_BASE=origin/main is in the README but easy to miss). Defaulting to origin/main (with a fallback) would match how this will actually get run.
bbf5052 to
1ad23e7
Compare
58c0880 to
8b109db
Compare
| set -euo pipefail | ||
| MARKER='<!-- doc-accuracy-comment -->' | ||
| FINDINGS="_out/doc-accuracy-findings.json" | ||
| # If the review step never produced a file (e.g. it errored early), |
There was a problem hiding this comment.
If the review step errors (timeout, claude crash, no verdict), this manufactures a PASS. Combined with the "existing comment" branch below, a failed run will overwrite a previous FAIL with "Nothing flagged."
Gate this on steps.review.outcome. If the review step didn't succeed, post "reviewer didn't finish, see the log" and leave the last real comment alone. A missing findings file is not a clean review.
There was a problem hiding this comment.
Good catch, fixed. The tool now emits a tri-state verdict (PASS/FAIL/INCOMPLETE); a crash or no-verdict run is INCOMPLETE and posts a separate 'didn't finish' note instead of overwriting the findings comment
Signed-off-by: Amarachi Iheanacho <amarachi.iheanacho@siderolabs.com>
8b109db to
9ed27d3
Compare
What
Adds
make check-doc-accuracy, a reviewer that checks docs for changes that could harm a reader who follows them (commands that lose data, destroy things, or weaken security, not just typos). Also runs it in CI on every docs PR, forks included, as an advisory check.Why
The worst doc bugs are commands that run fine but still do damage, like a service started without its data mount or a dropped safeguard. They pass every syntax check, so a flag checker won't catch them. You need something that reads the snippet and reasons about what happens if you run it. Until now that only ran when someone remembered to run it locally.
Change
tools/doc-accuracy: a Go program that drives theclaudeCLI as a read-only reviewer (it reports, never edits). It reviews the.mdxfiles you changed and checks claims about Talos/Omni against the upstream source..github/workflows/doc-accuracy.yaml): usespull_request_targetso it works on fork PRs. Checks out our base branch only, never the fork's code, and reads the PR as a text diff. Nothing from the PR is run. It never blocks merge.Usage
Testing
go test,go vet, andgofmtall pass.ANTHROPIC_API_KEYsecret is set.