Skip to content

fix(review): verifier verdicts bind to the wrong finding and drop confirmed findings #660

Closed

Description

@dan-petty

Summary

Found in the release/v0.2.23 review (line numbers at 7fdaa9d). Each item below was confirmed by reading or running the code.

  1. Unsupported mitigation claims remove confirmed findings.
    • A MITIGATED verdict with no mechanism or perimeter is "degraded to UNVERIFIED" but also made reportable=False (src/devops_cli/ai/review/verification.py:1278-1293, :1524-1526). A finding the verifier confirmed then disappears. This contradicts the rule "Only clear evidence removes a finding".
    • Placeholder values such as "mitigating_mechanism": "none" or "perimeter_files": ["n/a"] pass the gate.
    • tests/test_verdict_writers.py:267-277 asserts the wrong result.
  2. Verdicts attach to the wrong finding.
    • Persona output can set finding_id through the id and index aliases (src/devops_cli/ai/review_schema.py:545-548), and reset_verification_state (:1244-1264) does not clear it. Those ids collide with the verifier's positional ids (verification.py:1652-1660, :1869-1878).
    • In the reproduction, the INVALIDATED verdict for "Unused import os" bound to a real SQL injection. The injection's own VERIFIED verdict was then dropped as a duplicate.
  3. Conflicting criteria invalidate without a check. When both a verification criterion and an invalidation criterion pass, _reconcile_finding_from_criteria (src/devops_cli/ai/review/review_environment.py:302-310) returns INVALIDATED and skips the LLM. The LLM path treats the same "refuted and confirmed" case as UNVERIFIED and keeps it.
  4. A null location drops the finding. A verifier reply with "location": null becomes the string "None" (verification.py:1551-1552), and the report filter then drops the finding.
  5. Verification copy-back loses fields. It drops perimeter_files and regression_test (src/devops_cli/ai/review/pipeline.py:2402-2423), so later perimeter checks fall back to the finding's own file.
  6. The category false-positive baseline always reads 0%. It is computed from findings with INVALIDATED ones already removed (pipeline.py:2825-2835, :2919; src/devops_cli/ai/review/category_metrics.py:85-119).
  7. The mitigation ledger lives inside the installed package. It defaults to mitigated_findings.json in the package directory (src/devops_cli/ai/review/mitigations.py:24-39; writer at src/devops_cli/commands/review.py:1001-1009). It is shared across repositories, reset by upgrades, and silently unwritable on read-only installs.
  8. devops review verify can crash on older sessions. It checks verdict invariants across every finding in the session (commands/review.py:1084) and raises an uncaught AssertionError before writing. The requested status change is lost.

Remediation Plan

  1. Keep degraded mitigations reportable as UNVERIFIED, and treat placeholder mechanisms and perimeters as missing.
  2. Clear persona-supplied ids, or namespace them, before the verifier assigns positional ids. Bind verdicts by id and title together.
  3. When both criteria pass, leave the finding UNVERIFIED and send it to LLM verification.
  4. Treat a null location as "unchanged".
  5. Copy perimeter_files and regression_test back after verification.
  6. Compute the false-positive baseline from the candidates, including invalidated findings.
  7. Resolve the ledger under the data directory, through resolve_data_path, for the reviewed repository.
  8. Validate invariants only for the finding being updated, and report violations as domain errors.
  9. Add a test for each item, and fix tests/test_verdict_writers.py:267-277.

Activity

  1. added this to the v0.2.23 milestone on Sep 28, 2026
  2. added
    type/bug
    scope/review
    priority/p1-high
    on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions