Skip to content

feat(review): review tools run at the project's declared language and platform versions, and count only after their output on a canary matches the recorded expected output #1143

Closed

Description

@dan-petty

Problem

  • Tools run at their own defaults, not at the project's declared versions.
  • Semgrep 1.178.0 misparses PEP 758 without any sign.
    • It reads except ValueError, TypeError: as except ValueError as TypeError: it exits 0 with errors: [] and lists the file as scanned.
    • A probe rule except $X as $Y matches the line, and except ($X, $Y) does not [measured: c-feasibility].
    • A "does it parse" canary therefore passes the very version it should catch.

Acceptance criteria

  • Version flags come from the project:
    • ruff's target version from requires-python;
    • mypy's python_version;
    • Pluto's --target-versions k8s=<review.kubernetes_version>.
    • A missing value is a coverage gap.
  • The canary is an expected-output test per tool.
    • Fixture files: PEP 758, 695 and 649 constructs, a manifest and a Dockerfile.
    • Semgrep probes: the tuple form must match the PEP 758 line, and the as binding must not.
    • ruff, Bandit, mypy, kube-linter and Pluto: a known result at a known line each.
    • The gate is an exact match on the expected (rule, line) set.
  • Recorded outputs as fixtures: Semgrep 1.178.0's output fails the gate and 1.179.0's passes, as an offline CI test.
  • When it runs: automatically at review start, once per (tool, version, binary sha, language version, ruleset digest), with the result cached.
    • A failing tool's findings are withheld, and the tool shows canary-failed.
  • (person-run) The canary passes for every pinned tool on the real binaries, and the expected outputs are recorded from those runs.
  • Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s.
  • changelog.d/<n>.md records the change; CHANGELOG.md and docs/ROADMAP.md are not edited.
  • uv run devops ci passes.

Key questions

  • Who updates expected outputs? (proposed) A tool bump PR (P2-9) re-records them, and a person reviews the diff.

Strategic alignment

Update 2026-10-08: refinement

admit(canary_passed=...) and the coverage matrix's canary failed reason exist (review/admission.py:99-122, ai/review/pipeline.py:1366-1367), but nothing passes them (:636-656). The cached canary result feeds both; no second path.

  • A test admits a finding from a failed-canary tool and asserts the rejection count and coverage state.

Proposed design

Problem statement

Tools run at their own defaults instead of the project's declared language and platform versions, causing misinterpretations like Semgrep 1.178.0 misparsing PEP 758 without signaling errors. A canary test is needed to verify tool outputs match expected results before findings are counted.

Acceptance criteria

  • Criterion 1: Version flags come from the project for tools like ruff, mypy, and Pluto
    Verification: Check that ruff's target version comes from requires-python, mypy's python_version, and Pluto's --target-versions k8s=
  • Criterion 2: The canary is an expected-output test per tool with fixture files
    Verification: Verify that fixture files include PEP 758, 695, and 649 constructs, manifest, and Dockerfile; and that Semgrep probes match tuple form for PEP 758 line
  • Criterion 3: Tool findings are withheld when canary fails
    Verification: Confirm that a failing tool's findings are withheld and the tool shows canary-failed in the output
  • Criterion 4: Recorded outputs as fixtures pass offline CI test
    Verification: Run offline tests where Semgrep 1.178.0's output fails the gate and 1.179.0's passes
  • Criterion 5: Canary runs automatically at review start with caching
    Verification: Ensure canary runs once per (tool, version, binary sha, language version, ruleset digest) with cached results

Key questions

  • Who updates expected outputs?: A tool bump PR re-records them, and a person reviews the diff. (proposed)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#772, #1144, #873, #1146

Activity

  1. added
    type/feature
    scope/review
    priority/p1-high
    on Oct 3, 2026
  2. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #1301 and #1352. _admit_single_candidate (ai/review/pipeline.py:636-656) passes none of severity_caps, manifest_objects or this item's canary_passed; whichever lands second rebases. Found by the 2026-10-08 backlog review.

  3. added this to the v0.2.36 milestone on Oct 11, 2026
  4. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 6e862cd (see proposed design in issue body).

  5. added
    status/in-progress
    on Oct 16, 2026
  6. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1603, merged into release/v0.2.36 as 31a500e.

    Closes #1143

    16 file(s) changed.

    How it was verified

    Check runs at 16090a4:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Changed-Test Independence: pass
    • Fail-to-Pass Check: pass
    • Static Analysis: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Self-Check: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1143-review-tool-versions-and-canaries.md:

    No Acceptance Criteria section.

  7. added a commit that references this issue on Oct 17, 2026
  8. removed
    status/in-progress
    on Oct 30, 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/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions