Skip to content

fix(review): ruff's findings reach the review report, their file:// SARIF locations read as paths in the reviewed tree #1550

Closed as duplicate

Description

@dan-petty

Requested by the owner, 2026-10-10 ("file the issues"). The defect turned up while the v0.2.33 changelog was consolidated (#1547). The v0.2.33 entry for #873 says that no Ruff finding reaches review.md or findings.json yet.

Problem

Checked at main (69c99cf, v0.2.33).

  • devops review path, branch and pr run Ruff as review evidence (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, feat(review): ruff and mypy review evidence with project settings #1523). Ruff runs on the reviewed files' resolved absolute paths (RuffScanner.build_command, src/devops_cli/security/ruff.py:241-244), so its SARIF names each file by a file:///… URI.
  • _parse_sarif_result_to_finding (ruff.py:40-80) keeps that URI as the finding's location. normalize_finding_path (src/devops_cli/review/location.py:28) treats file:///… as a relative path, and validate_location rejects it as path-not-in-commit (location.py:77-82).
  • So admission drops every Ruff finding, including those of the [advisory] rules (BLE001 by default). The mypy and complexity findings name relative paths and are admitted.
  • Reproduced at 69c99cf on a scratch repository holding one try/except Exception: pass:
    • run_ruff_scan returns S110 and BLE001 at file:///…/pkg/a.py.
    • validate_location rejects both as path-not-in-commit.
    • A path review's grouped advisory title carries the URI too: [BLE001] 1 advisory finding(s) in file:///….
  • tests/test_review_ruff_mypy_evidence.py feeds the parser SARIF with a relative "uri": "src/pricing.py" (line 223), so no test sees Ruff's real output.

Proposed remedy

  • Ruff's file:// locations become paths relative to the reviewed tree before admission, for example with Path.from_uri and then made relative to the worktree. Admission, the diff-hunk filter and the advisory grouping then all see pkg/a.py.

Acceptance criteria

  • A review of a file with a Ruff finding, run on Ruff's real SARIF output, admits the finding at the file's path in the reviewed tree. It is reported in review.md and findings.json.
  • A branch or pull request review reports an [advisory] rules finding inside the diff's hunks and drops one outside them.
  • A path review's grouped advisory names the file by its path in the tree.
  • The evidence tests read Ruff's own SARIF, with its absolute file:// URIs, rather than a hand-written relative one.
  • changelog.d/<issue>.md under ### Fixed says that Ruff's findings, the advisory rules' included, now reach review.md and findings.json.

Feasibility

Reproduced at 69c99cf by running the real run_ruff_scan and validate_location on a scratch git repository. The fix fits one pull request: Ruff's location parsing in src/devops_cli/security/ruff.py, or normalize_finding_path, and its tests.

Activity

  1. added
    type/bug
    on Oct 10, 2026
  2. dan-petty-bot commented on Oct 10, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/bug. Ruff's file:// SARIF locations are mis-normalized as relative paths, causing validate_location to reject every Ruff finding, so the shipped feature silently drops all its output.
    • Priority: P2-Medium. An entire evidence channel (Ruff findings including advisory rules like BLE001) is non-functional in shipped v0.2.33, but it is a missing signal rather than a data-loss or outage.
    • Value: High. Users relying on Ruff advisory rules for security signals in reviews receive no findings at all, defeating the purpose of the evidence-first review.
    • Effort: Low. The fix is confined to Ruff's location parsing in ruff.py or normalize_finding_path plus updating the evidence tests to use real SARIF output, fitting one pull request.
  3. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Closed as a duplicate of #873: This candidate fixes a problem introduced by item 873, making it a defect found in work delivered by that item rather than a duplicate.

    If it is not a duplicate, reopen it: intake then places it without the duplicate check.

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

    type/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions