Skip to content

feat(review): ruff and mypy run as review evidence with the project's settings, advisory rules report only on changed lines, and changed functions show complexity before and after #873

Closed

Description

@dan-petty

Problem

Re-scoped on 2026-10-03 as phase P1a of the evidence-first review (#1137). The original scope, per-function complexity before and after for changed Python functions with ruff C901 (standard McCabe) as the definition, is kept as this item's C901 criterion and the complexity_delta record below.

  • Ruff and mypy are not review evidence today. Ruff runs only in CI [code: .github/workflows/ci.yml:45-66]. mypy runs only as a verifier probe, which ran once in 11 runs [measured: loop §5].
  • Ruff honours the target version: it accepts PEP 758 at py314 and rejects it at py313 [measured: u-tools].
  • BLE001 catches the three error-handling recall entries (pricing.py:55 and :67, and investigator.py:293) [measured: d-incremental], but it fires 513 times in 164 files at HEAD.
  • mypy has no environment in a fresh worktree. The worktree has no .venv, and HostSandbox looks only for <root>/.venv/bin [code: sandbox/host.py:453-468].

Acceptance criteria

  • Ruff with the project's config produces SARIF findings.
  • Advisory rules: an advisory set from .devops/review.toml (default BLE001) reports individual findings only inside diff hunks on branch and PR reviews, and one group per (rule, file) on path reviews.
  • C901 runs at max-complexity = 0 at base and head for changed functions. A finding is raised only when a function crosses the project's cap or a configured increase. review.md gets a before/after "Complexity" table.
  • The session JSON keeps the original complexity_delta record: {file, function, before, after, source} for each function whose value changed or that was added (before: null) or removed (after: null), with source "mccabe (ruff C901)". A unit test with hard-coded values covers a function going from 3 to 12 and an unchanged one.
  • mypy runs with the project config on changed modules.
    • Environment: the checkout's .venv, bound read-only, when the worktree's uv.lock hash equals the checkout's.
    • Otherwise it is a coverage gap with that reason. uv sync never runs on a reviewed tree.
    • Isolation: python -I and its own cache.
  • (person-run) A path review of 38517a8 matches 3/3 error-handling entries, and the loop input gives 0 PEP 758 findings.
  • 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

Strategic alignment

Activity

  1. added
    type/feature
    scope/review
    priority/p3-low
    on Oct 1, 2026
  2. changed the title [-]feat(review): per-function complexity before and after for changed python functions in reviews[/-] [+]feat(review): ruff and mypy run as review evidence with the project's settings, advisory rules report only on changed lines, and changed functions show complexity before and after[/+] on Oct 3, 2026
  3. added
    priority/p1-high
    and removed
    priority/p3-low
    on Oct 3, 2026
  4. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    Folded in from the #1138 re-scope (2026-10-09)

    The 16 BLE001 seed labels move here from #1138: no review session holds those rows, or their fingerprints, until this item admits ruff findings as review evidence. Label them once that is in.

  5. added this to the v0.2.33 milestone on Oct 9, 2026
  6. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1523, merged into release/v0.2.33 as eba4818.

    Closes #873

    10 file(s) changed.

    How it was verified

    Check runs at 9115ccd:

    • Prune PR DevContainer Images: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Analyze (actions): pass
    • Tests & Coverage: pending
    • Changed-Test Independence: pass
    • Analyze (python): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-873-review-ruff-mypy-evidence.md:

    • Ruff review evidence: Ruff runs with project settings, emitting SARIF findings into review evidence.
    • Advisory rules reporting: Advisory rules report on diff hunks on PR/branch reviews and grouped by rule/file on path reviews.
    • Mypy review evidence: Mypy runs with checkout environment validation (uv.lock SHA-256 match), isolating cache and ignoring note: continuation lines.
    • Complexity before/after: Functions modified in git diff report cyclomatic complexity before and after with delta calculations.
    • Markdown report & session JSON: review.md includes complexity delta table and session.json records complexity_delta.
    • Quality gates & tests: All unit tests pass cleanly with $M \le 10$ cyclomatic complexity and $\le 5$ nesting depth.
    • Pending a person: uv run devops ci on the delivering tree, which the orchestrating session runs.
  7. added a commit that references this issue on Oct 10, 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