Repository navigation
Description
Context & Rationale
Each known false positive is written in four or five places: an entry in ai/review/common_hallucinations.json, a branch in common_hallucinations.py that dispatches on substrings of the entry id (for example if "JAEGER" in entry_id at :611), a bullet in ai/tasks/review.md, a bullet in ai/tasks/verify_finding_system.md, and often a persona prompt. Since v0.2.23, 6 commits changed the catalog and 5 of them also changed both prompts; #683, #719 and #736 each touched all of them.
The copies have drifted. Two entries are general in the JSON but checked under SYNTAX_GRAMMAR, and 12 of the 14 general entries can never invalidate a finding deterministically. The rules for verification criteria are stated in three places (persona prompt, verifier prompt, ai/review/review_environment.py), 11 lines of the shared prompts are specific to devops-cli, and .devops/review.md, the documented home for a project's own rules, has had no edits.
Scope & Deliverables
- Deliverable: one rulebook of known false positives. Each rule is a single record: how to match a finding, its ground-truth check written as data (required content, path or cited-line pattern), its line for the reviewer prompt, its line for the verifier prompt, and its scope (tool-wide or project).
- The rulebook renders both prompt sections and runs the deterministic check. The
_check_*functions inai/review/verification.py:1173-1255that can be written as rules, andai/review/stages/adversarial_debate.py, fold in. - Project rules load from the reviewed repository, so devops-cli's own rules leave the shared prompts.
- One parametrised test loads every shipped rule and runs its own positive and negative example, replacing the synthetic-entry tests in
tests/test_common_hallucinations_hardening.py.
- The rulebook renders both prompt sections and runs the deterministic check. The
- Constraint: recording a new known false positive is one edit.
Strategic Alignment
- Milestone: Backlog (no release)
- Design: CONTEXT.md (Known false positive, Finding, Verdict)
- Depends on: none
Amendment (2026-10-01 assessment)
- Key questions:
- The challenger persona.
- Its prompt (
ai/personas/challenger/prompt.md:1-13) asks it to analyse candidate findings. - In practice it runs as an ordinary generator under
--all(ai/review/runner.py:123-126), is never shown findings, and produced no finding in 26 saved sessions. - It is also a
devops ai chatpersona (docs/commands/ai.md:118) and a stream persona (config/defaults.py:331). - Remove it with a CHANGELOG entry, or rewrite its prompt as a plain generator? (proposed) Remove it, together with
adversarial_debate.py.
- Its prompt (
- Rubric format.
docs/SDLC.md:135requires rubrics to be Markdown loaded byload_task_prompt. Do rulebook records that render Markdown need an SDLC.md amendment? (proposed) Yes, in the same PR.
- The challenger persona.
- Follow-up (not this PR): records that carry positive house rules with stable ids that findings cite. These would enable per-rule precision and the per-rule suppression feat(ai): ai review honours an inline intent marker with a quoted reason #602 needs.
- Note: The grep-criteria fix ships separately. This item moves the rules.
Scope added 2026-10-02: the praise check reads the title. It reads the description only for four "the documentation ..." openings, and it never reads fix (_check_benign_compliment, ai/review/verification.py:952-980; phrases at config/constants.py:1344-1352). Branch reviews raise a kind of finding it misses: narration of the diff, with a fix such as "No fix needed; this is an addition to ..." or "No fix required - this is an update to ...". Reported findings of this kind: 11 of 100 in session 20261002-163203, 3 of 126 in 20261002-180320 and 4 of 144 in 20261002-200610. The check at 38517a8 catches none of them. The path review 20261001-224227 had none. All 18 were on generated reference docs, which #948's routing would drop once it covers branch reviews. This rule covers the same pattern on hand-written docs and code.
- The praise rule (today
_check_benign_compliment) also readsfix. A finding whose fix only says no change is needed (it opens with "No fix needed", "No fix required" or "No change needed", or says the change "is already correct", and names no code) and whose title has no negation word is INVALIDATEDdeterministic:benign_compliment. - A parametrised test covers the session wordings ("No fix needed; this is an addition to the documentation.", "No fix required - this is an update to existing documentation.", "The change is already correct as written. No fix needed."). It also has a negative case: a real defect whose fix reads "No fix is needed in callers; guard the write in
save()" stays UNVERIFIED. It runs offline.
Scope added 2026-10-02 from review sessions 20261002-163203 to -214641 (.data/review-evaluation-20261002-s6.md, section 6): SYNTAX_CLAIM (ai/review/common_hallucinations.py:167) matches wording, so it invalidated a finding on commands/config.py:514 in every run because the finding quotes the log text "Failed to parse". That finding was the one arguably valid scanner candidate (filed as #1022). It also missed a syntax claim at security/checkov.py:281.
- A syntax claim is judged by parsing the cited code, not by matching the finding's words. A test with a finding that quotes "Failed to parse" from a log message and cites code that parses keeps no syntax verdict.
Proposed design
Problem statement
Known false positives in the review pipeline are duplicated across four or five locations (a JSON catalog, a Python dispatch function, two task-prompt Markdown files, and persona prompts), and the copies have drifted: some entries are mis-scoped, some can never fire deterministically, and project-specific rules are baked into shared prompts. The fix is a single rulebook where each rule is one record that renders both prompt sections and runs its own deterministic check, so recording a new known false positive is one edit and the copies can no longer diverge.
Acceptance criteria
- Criterion 1: A single rulebook (one record per rule) replaces the duplicated sources: the JSON catalog entries, the dispatch branches in common_hallucinations.py, the bullets in ai/tasks/review.md and ai/tasks/verify_finding_system.md, and the persona-prompt lines for known false positives.
Verification: grep -r 'common_hallucinations.json' src/ returns no hits; the dispatch branches (e.g. 'if "JAEGER" in entry_id') are gone from common_hallucinations.py; review.md and verify_finding_system.md contain no hand-written false-positive bullets; the rulebook file is the sole source. - Criterion 2: Each rulebook record carries: match criteria, ground-truth check as data (required content, path or cited-line pattern), a reviewer-prompt line, a verifier-prompt line, and a scope (tool-wide or project).
Verification: Inspect the rulebook schema or loader; every record has all five fields; a unit test asserts the schema. - Criterion 3: The rulebook renders both the reviewer prompt section and the verifier prompt section, and runs the deterministic check from the record's ground-truth data.
Verification: A test calls the renderer and asserts the output matches the expected prompt text for a sample rule; a test calls the check runner with a matching finding and asserts INVALIDATED. - Criterion 4: The check* functions in ai/review/verification.py:1173-1255 that can be expressed as rulebook records are removed; their logic lives in the rulebook.
Verification: grep -n 'check' ai/review/verification.py shows no remaining functions in that range; the rulebook records cover the same cases. - Criterion 5: ai/review/stages/adversarial_debate.py is removed.
Verification: test ! -f ai/review/stages/adversarial_debate.py - Criterion 6: The challenger persona is removed: its prompt file, its reference in config/defaults.py, its listing in docs/commands/ai.md, and its runner invocation in ai/review/runner.py are all deleted, with a CHANGELOG entry.
Verification: test ! -f ai/personas/challenger/prompt.md; grep -v challenger config/defaults.py | grep -c challenger equals 0; grep -v challenger docs/commands/ai.md | grep -c challenger equals 0; grep -i challenger changelog.d/770.md matches. - Criterion 7: Project-specific rules (devops-cli's own) load from the reviewed repository (.devops/review.md or .devops/review.toml) rather than from the shared prompts.
Verification: The shared prompts (ai/tasks/review.md, ai/tasks/verify_finding_system.md) contain no devops-cli-specific rules; .devops/review.md or .devops/review.toml holds them; a test reviews a fixture repo with a project rule and confirms it applies. - Criterion 8: One parametrised test loads every shipped rule and runs its own positive and negative example, replacing the synthetic-entry tests in tests/test_common_hallucinations_hardening.py.
Verification: pytest tests/test_common_hallucinations_hardening.py -v shows one parametrised test per rule with positive and negative cases; the old synthetic-entry tests are absent. - Criterion 9: Recording a new known false positive requires editing only the rulebook (one edit).
Verification: Add a new rule record to the rulebook; run the test suite; the new rule renders in both prompts and its check fires, with no other file changes. - Criterion 10: The praise rule (formerly _check_benign_compliment) also reads the fix field. A finding whose fix opens with 'No fix needed', 'No fix required', or 'No change needed', or says the change 'is already correct', and names no code, and whose title has no negation word, is INVALIDATED deterministic:benign_compliment.
Verification: A test with fix='No fix needed; this is an addition to the documentation.' and a non-negated title produces verdict INVALIDATED with reason deterministic:benign_compliment. - Criterion 11: A parametrised test covers the three session wordings and includes a negative case: a real defect whose fix reads 'No fix is needed in callers; guard the write in save()' stays UNVERIFIED. The test runs offline.
Verification: pytest -k 'praise' --no-network (or equivalent offline flag) passes; the negative-case assertion confirms UNVERIFIED. - Criterion 12: A syntax claim is judged by parsing the cited code, not by matching the finding's words. A finding that quotes 'Failed to parse' from a log message and cites code that parses keeps no syntax verdict.
Verification: A test constructs a finding with description containing 'Failed to parse' and a cited line of valid Python; the rulebook's syntax rule does not fire; the finding's verdict is not INVALIDATED by a syntax rule. - Criterion 13: docs/SDLC.md is amended to permit rulebook records that render Markdown, in the same PR.
Verification: git diff HEAD~1 -- docs/SDLC.md shows the amendment; the text at or near line 135 now references the rulebook exception.
Key questions
- The challenger persona: remove it with a CHANGELOG entry, or rewrite its prompt as a plain generator?: Remove it, together with adversarial_debate.py. It runs as an ordinary generator under --all, is never shown findings, produced no finding in 26 saved sessions, and is also a devops ai chat persona and a stream persona, so removing it requires cleaning up config/defaults.py, docs/commands/ai.md, and ai/review/runner.py. (proposed) [sources: docs/commands/ai.md:118]
- Do rulebook records that render Markdown need an SDLC.md amendment?: Yes, in the same PR. docs/SDLC.md:135 requires rubrics to be Markdown loaded by load_task_prompt; the rulebook records that render prompt sections are a new form that the SDLC must acknowledge. (proposed) [sources: docs/SDLC.md:135]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 2, 2026
Ordering note from the review-loop analysis (2026-10-02, session
20261001-224227). Do not enablegeneralground truth before #950 lands..data/common_hallucinations.jsonholds 35 auto-learnedgeneralentries whose signatures pair common words (exception+handling,insecure+configuration).dan-petty commentedon Oct 3, 2026
Frozen by the evidence-first review redesign (#1137, owner direction of 2026-10-03): patches to the model generator and verifier stop, and tool-layer fixes continue. This item patches code that #1150 deletes (the verifier path in
verification.py, the guards and verifier prompts,construct_validator.py,criteria_evidence.py, and the known-false-positive catalog). Its constraint, that recording a new known false positive is one edit, carries into #871's.devops/review.tomlsuppressions and #1145's rule pack. Its question about removing the challenger persona is decided in #1151 (the challenger stays as a chat and stream persona).It stays open, labelled
status/blocked, and closes as not planned with "Superseded by #1150" when that item lands. Until then, the interim is the tools-only review (--no-persona-review --no-verification). Do not start work on it.dan-petty-bot commentedon Oct 10, 2026
Status set to Ready at 69c99cf (see proposed design in issue body).
dan-petty commentedon Oct 17, 2026
Moved out of v0.2.36 to the backlog (owner decision, 2026-10-17): this item is frozen by the evidence-first review redesign (#1137), and the code it patches is what #1150 deletes, so it holds the release cut without being buildable. It stays open with
status/blockeduntil #1137 and #1150 settle whether it is still needed; its constraint, that recording a new known false positive is one edit, carries into #871.dan-petty commentedon Oct 17, 2026
Closed as not planned in the 2026-10-17 unblocking review: Superseded by #1150 and #871. The catalog, the verifier check* functions and adversarial_debate.py are deleted. A known false positive is now one [[suppressions]] block (review/suppression.py:72) or one rule in #1145's pack.