Skip to content

feat(review): mitigated findings re-verified when their perimeter changes (#587) - #639

Merged
dan-petty merged 3 commits into
release/v0.2.23from
feat/587-mitigated-findings-perimeter-re-verification
Sep 27, 2026
Merged

dan-petty merged 3 commits into
release/v0.2.23from
feat/587-mitigated-findings-perimeter-re-verification

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Context & Rationale

Resolves #587.

A MITIGATED finding is reportable=False and excluded from merge blockers. Previously, nothing recorded what mitigated it, nor were perimeter files tracked in cross-session storage. When future commits altered the perimeter code defending a mitigated vulnerability, no warning was emitted.

Summary of Changes

  • Mitigation Schema & Persistence:
    • Added mitigating_mechanism: str | None, perimeter_files: list[str], and optional regression_test: str | None to Finding and SavedFinding models in review_schema.py.
    • Added tracked ledger src/devops_cli/ai/review/mitigated_findings.json and helper module src/devops_cli/ai/review/mitigations.py (MitigatedFindingEntry, load_mitigated_findings, save_mitigated_findings, record_mitigated_finding, find_perimeter_changes, format_perimeter_warning).
    • Added test-isolation logic in resolve_ledger_path so pytest executions do not dirty repository ledger files.
  • Verifier System Prompt & Verdict Degradation:
    • Updated src/devops_cli/ai/tasks/verify_finding_system.md to instruct the verifier that mitigated: true requires naming mitigating_mechanism and non-empty perimeter_files, degrading to UNVERIFIED (reportable=False) if omitted.
    • Updated src/devops_cli/ai/review/verification.py to reconcile and preserve mitigation metadata, defaulting unprovided mechanism/perimeter to UNVERIFIED (reportable=False).
    • Invariant enforcement: prohibited mitigated=True on INVALIDATED findings across verdicts.py.
  • CLI Enhancements:
    • Enhanced devops review verify --status MITIGATED with repeatable --perimeter <path> and optional --regression-test <path> options.
    • Automatically records human-accepted mitigations to the tracked ledger.
  • Perimeter Change Warning:
    • devops review branch|pr (runner.py) and _evaluate_pr_blockers (commands/pr.py) intersect changed diffs against tracked perimeter files and warn N mitigated finding(s) whose perimeter changed, naming each finding, without altering exit codes.
  • Documentation & Invariants:
    • Corrected Executable Verification Criteria sandbox reference in docs/ROADMAP.md to HostSandbox / WorkloadSandboxRunner.
    • Updated task tracking file task-587-mitigated-findings-re-verified-when-their-perimeter-changes.md to Done.
    • Full test suite in tests/test_mitigated_perimeter.py with structural tuple equality assertions.

Verification

  • Pre-commit and pre-push gates (uv run devops ci) passing 100% across all 10 quality gates.
  • Strict mypy, ruff, bandit, and complexity invariants validated.

@dan-petty
dan-petty merged commit ca1c398 into release/v0.2.23 Sep 27, 2026
7 checks passed
@dan-petty
dan-petty deleted the feat/587-mitigated-findings-perimeter-re-verification branch September 27, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant