Skip to content

fix(review): location parsing keeps placeholder, prose-laden and truncated locations #788

Closed

Description

@dan-petty

Context & Rationale

Problems with how review finding locations are parsed on release/v0.2.24:

  • Placeholders survive parsing. 95ed4cc (fix(review): remediate response repair, review pipeline and verifier defects (#656, #657, #658, #659, #660, #664) #675) made _parse_location preserve case by default (ai/review_schema.py:784). The placeholder check at ai/review_schema.py:648 still compares case-sensitively, so "N/A" and "None" locations now survive parsing. At 1ad24ac they were dropped.
  • Location cleanup keeps prose or loses parts of the location (ai/review_schema.py:184, :405):
    • Extensionless root files keep their prose: Dockerfile:3 - unpinned base image, Makefile:12 in build target.
    • src/app.py line 42 in get_user becomes src/app.py and loses the line.
    • src/my app.py:42 is cut to src/my.
  • Corpus scoring misses mixed-case paths. It compares against injection.file.lower() (ai/review/defects.py:1415), so it never matches a path that keeps its case.

Found while checking the #659 fix.

Scope & Deliverables

Strategic Alignment

  • Milestone: Backlog (no release)
  • Design: none
  • Depends on: none

Generated by Claude Code

Scope added 2026-10-02: static scanner findings have their own location defects. The review passes absolute paths to the scanners (Semgrep at security/semgrep.py:96-101, Bandit at security/bandit.py:66), and each finding keeps the path the scanner prints in its location and description (semgrep.py:54-70, bandit.py:19-25). _match_static_findings_to_files (ai/review/pipeline.py:487-504) attaches a finding to the reviewed file by suffix but leaves its location absolute. In session 20261002-180320, 12 Semgrep candidates carried /workspaces/devops-cli/... paths, 9 were reportable, and 8 reached the report after a merge. Scanner findings then go through the construct check like model findings (ai/review/verification.py:1328). That check took the candidate devops_cli from the path in the Semgrep description. It moved the two logger findings at config/settings.py:645 and :648 (commit 8271385, which that session reviewed) to the import at :19, where they merged into one. This reproduces with validate_construct_location at 38517a8. A repository-relative path alone does not stop it: with src/devops_cli/config/settings.py:648 the finding still moves to :19. Bandit findings carry absolute paths too now that Bandit runs again: #1012 (merged at 79e1e93, after 38517a8) still passes str(p.resolve()). Land after #972 (v0.2.25), which changes how these scanners are run.

  • Scanner findings carry repository-relative paths, both in location and in the text they embed. A test passes fake Semgrep and Bandit results with absolute paths through the review's static-scan step and asserts src/app.py:12.
  • The construct check neither relocates nor invalidates a finding that a static scanner produced, because a parser gave its line. A golden test with the two Semgrep logger findings at config/settings.py:645 and :648 (session 20261002-180320) keeps them as two findings at their own lines.
  • The tests run offline and call no scanner binary.

Scope added 2026-10-02 from review session 20261002-214641 (.data/review-evaluation-20261002-s6.md, section 4.1):

  • All 4 Bandit and all 14 Semgrep candidates carried absolute /workspaces/devops-cli/... paths, and 5 of the 24 report rows print them.

  • _are_findings_duplicate (ai/review_schema.py:905) treats two findings with the same title in one file as duplicates however far apart they are, and across tools. It merged tests/test_devcontainer.py:897 and :1006, and put Bandit's title on Semgrep's description at test_review_prompt_consistency.py:439.

  • Scanner finding locations are repository-relative before consolidation. A test with a Semgrep result carrying an absolute path inside the repository gets a relative location.

  • Two scanner findings merge only when tool, rule, file and line all match. A test with two same-title findings 109 lines apart keeps both.

Scope under the review redesign (2026-10-03)

The evidence-first review (#1137) keeps tool-layer fixes and freezes model-generator patches. This item is split along that line:

Acceptance criteria (added).

Update 2026-10-08: refinement

Bandit and Semgrep findings still carry absolute paths (security/bandit.py:74; security/semgrep.py:202-209); #871 relativizes only findings.sarif. The construct check goes with #1150 and the merge rule with #1151 and #1141.

  • Fake results with absolute paths come out as src/app.py:12 in findings.json and review.md, with no absolute path in the description; offline.

Activity

  1. added
    type/bug
    scope/review
    priority/p2-medium
    on Oct 1, 2026
  2. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #1045 (v0.2.30). Both give scanner findings a repo-relative, per-file location (Bandit and Semgrep here, kube-linter there), which #1141's fingerprint needs. Found by the 2026-10-08 backlog review.

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

    @dan-petty
    OwnerAuthor

    Moved to v0.2.35: v0.2.35 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  5. added a commit that references this issue on Oct 13, 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/p2-mediumscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions