feat(code-review): review non-application files + three TestQuality shapes - #183
feat(code-review): review non-application files + three TestQuality shapes#183mikeangstadt wants to merge 1 commit into
Conversation
…hapes Extends the shared reviewer prompt to cover CI/pipeline definitions, guard and meta-test scripts, migrations, and docs/API specs, plus the wiring-unproven, assertion-of-existence, and input-invariant-fixture TestQuality shapes. Prompt-only: no dispatch, roster, or schema change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
wongk
left a comment
There was a problem hiding this comment.
this adds explicit things to review to the shared reviewer prompt, rather than assigning these things to specific reviewers. this means every review agent is going to duplicate these reviews, and it will dilute the agent-specific review areas.
|
Beginning a code-review. Please allow time for me to finish before merging the PR |
| </constraints> | ||
|
|
||
| <non_application_files> | ||
| Config, CI, infrastructure, migration, docs, and test files in <files_assigned> |
There was a problem hiding this comment.
This puts the full domain checklist in shared_prompt.txt, so every BHA partition, BHB, auditor, Design Critic, and Impact Analyzer pays the ~1.6k-token cost and is told to repeat work outside its assigned role. Deduplication can hide duplicate output, but it cannot recover the review attention already spent. Can we keep only the scope declaration shared and route each checklist by file class/owning reviewer instead?
| file's literal content — a workflow's pinned action version, a config | ||
| snapshot, a required-context manifest, an allowlist. When the diff edits such | ||
| a file, grep for a test referencing that path or a distinctive literal from | ||
| the changed lines; if that test exists and is NOT in the diff, the change |
There was a problem hiding this comment.
A path reference is not proof that a pinned assertion is stale. This PR itself is a counterexample: test_code_review_helpers.py:21401-21412 references the changed plugin.json path as fixture input but does not assert its version or content. Also, partitioned BHA workers only receive their own patch, so they cannot establish full-PR diff membership. Please require a cited assertion that actually contradicts the pinned-head file instead of inferring a CI failure from a reference plus absence from the worker patch.
| snapshot, a required-context manifest, an allowlist. When the diff edits such | ||
| a file, grep for a test referencing that path or a distinctive literal from | ||
| the changed lines; if that test exists and is NOT in the diff, the change | ||
| breaks it. This is a provable CI failure, so report it as "Correctness" with |
There was a problem hiding this comment.
Routing this as generic Correctness breaks the existing /fix contract. Diff-scope validation requires the finding anchor to be the changed file, while /fix auto-edits only that anchor; for a stale meta-test, --apply can therefore revert the intended config/workflow change instead of updating the unchanged assertion. Please give this case a dedicated subcategory routed to manual or multi-file handling, with structured metadata identifying the companion test.
| ### code-review v3.8.0 | ||
|
|
||
| #### Added | ||
| - **The shared reviewer prompt now covers non-application files (CI/pipeline definitions, guard and meta-test scripts, migrations, docs/API specs) and three high-frequency `TestQuality` shapes.** Measured against a five-day window of one consuming repo — 2,617 original review comments across 326 PRs, attributed per reviewer agent — the fleet's coverage was categorically absent outside application source: **0 of 101** findings on CI guard/deploy scripts, **0 of 69** on workflow definitions, **0 of 94** on docs/MDX, **0 of 28** on migrations, and **1 of 219** on test files, while producing 68% of all `.tsx` findings and 72% of all prototype findings in the same window. Those file classes were 22% of the corpus and were being carried almost entirely by other reviewer agents. Two additions to `tools/prompts/shared_prompt.txt`, which every reviewer role loads, so no dispatch, roster, or schema change is involved: a `<non_application_files>` block declaring those files in scope and enumerating the generic defect classes per class (privileged jobs running repository lifecycle scripts before minting a write token; workflow-scope write permissions and persisted checkout credentials; the implicit "all dependencies succeeded" condition that is false for a *skipped* dependency; missing job timeouts; cancel-on-new-run over irreversible side effects; trigger filters that do not match what they gate; a shell step whose unguarded command can pre-empt the branch owning its exit code; guards that assert a predicate *appears* rather than executing the decision; allowlist entries broad enough to suppress future real violations; destructive migrations selecting survivors by a proxy for canonicity; idempotency guards that no-op over an invalid object left by a failed run; an enum value added without updating every classifier; docs claims stronger than the code enforces; generated-client specs admitting combinations the runtime rejects), and a `<test_quality>` block naming the three shapes that stay green while proving nothing — wiring-unproven (helper tested, production caller never asserted), assertion-of-existence (source scanned for a predicate instead of executing it), and input-invariant fixture (a handler returning identical results regardless of the params the test claims to cover). |
There was a problem hiding this comment.
This release entry includes corpus counts, reviewer-attributed percentages, and a five-day measurement window that are not derivable from the allowed changelog sources. .claude/commands/update-documentation.md limits entries to the diff, plugin.json, and commit subjects so generated release notes stay reproducible. Please regenerate/rewrite this through /update-documentation and keep only claims supported by those sources.
Summary
Extends the shared reviewer prompt to cover the file classes the fleet currently does not review, plus three
TestQualityshapes that stay green while proving nothing.Prompt-only. All behavior lives in
tools/prompts/shared_prompt.txt, which every reviewer role loads. No dispatch, roster, category, or schema change; no new agent; no new stage.Why: the fleet's coverage is categorically absent outside application source
Measured against five days of one consuming repo — 2,617 original review comments (replies excluded) across 326 PRs, 2026-07-30 → 2026-08-04, attributed per reviewer agent:
.github/).tsx.tsThe fleet is strong where it is pointed and produces zero findings on four whole file classes. Those classes are 22% of the corpus and are carried almost entirely by other reviewer agents — so the capability gap is real, not a question of whether those files contain reviewable defects.
Note the limit of this measurement: it shows output, not cause. It does not by itself prove the reviewers would have found these defects if prompted — only that they are not reporting them today. If the zeros turn out to come from file-scope filtering in partitioning rather than from prompt silence, this PR is necessary but not sufficient, and the follow-up is in
derive-spawn-spec/partitioning rather than here.What changed
<non_application_files>— declares those files in scope and enumerates the generic defect classes per class, all repo-agnostic:Pinned-file pair detection — repos routinely hold meta-tests asserting another file's literal content (an action-version pin, a config snapshot, a required-context manifest, an allowlist). Reviewers now grep for a test referencing the changed path or a distinctive changed literal and report when that test exists but is not in the diff. Emitted as
Correctness, notCompanionChange, deliberately: it is a provable CI failure with a concrete assertion to cite, and it carries no rule-drivenreasoning_certificate— whichtemplates/companion_change.mdinterpolates and would render empty for an LLM-emitted finding.<test_quality>— three shapes, all generic:New
TestQualitysubcategories route to the existingtemplates/testquality_specialized.mdvia theTestQuality/*fallback row, so/code-review fixneeds no new template.Test plan
python3 -m pytest test_code_review_helpers.py test_code_review_schema.py— 1,286 passed, 0 failed.shared_prompt.txtcontent before editing it (the same rule this PR teaches): every test writes a synthetic prompt file totmp_path; the real file is only ever copied verbatim into the CR dir bycode_review_helpers.py:13719. No pinned-file pair broken..claude-plugin/plugin.jsonis bumped per release (.codex-plugin/plugin.jsontracks separately and was last touched by an unrelated commit), matching the v3.7.0 release commit's file set. Bumped 3.7.0 → 3.8.0 with a CHANGELOG entry.git diff --checkclean;plugin.jsonparses.Cost.
shared_prompt.txtgrows 317 → 409 lines (~17.5 KB → ~24 KB), about +1.6k input tokens per reviewer agent. It is identical across agents and stable across runs so it caches, but on a large fleet the uncached first-touch cost is real —/code-review costwill show the fleet-side delta.What could still break. Prompt additions can shift reviewer attention: a fleet told to review workflow YAML may spend budget there on PRs where the application diff mattered more, and the new heuristics could produce false positives on repos whose CI conventions differ (a deliberate
cancel-in-progress, an intentionally broad allowlist). The existing FLAG criteria and the verifier pass both still apply, and every new heuristic requires a concrete file:line, so these should surface as verifier-refuted rather than shipped — but the first few runs on a CI-heavy PR are worth watching.