Skip to content

fix(review): construct and location checks drop absence findings and rewrite finding paths #659

Closed

Description

@dan-petty

Summary

Found in the release/v0.2.23 review (line numbers at 7fdaa9d).

  1. Findings about something missing are invalidated as hallucinations.
    • Examples: "Missing timeout on outbound HTTP request" at a requests.get(url) line, or "Missing @login_required". Both are INVALIDATED (deterministic:construct_location, reportable=False) and dropped from findings.json.
    • Each drop also writes an auto_learned catalog entry, such as (?=.*\btimeout\b)(?=.*\boutbound\b) for *.py. That entry then suppresses the same true positive in later reviews.
  2. Relocated findings get lowercased paths. Pkg/Handler.py:4 becomes pkg/handler.py:11. That path does not exist on case-sensitive filesystems, and the excerpt lookup misses it.
  3. Location canonicalization keeps surrounding prose.
    • src/app.py:42 in get_user and src/app.py:42 - missing check are kept verbatim; main reduced them to src/app.py:42.
    • See src/app.py:42 parses as the file see src/app.py.
    • As a result, line checks, excerpts, anchoring, deduplication and corpus scoring all miss these findings.
  4. The symbol delta compares against the base branch tip, not the merge-base, and its cache ignores the base. When main adds foo to a file the branch also edits, the analysis records symbols_removed: ["foo"]. A hallucinated finding that cites foo is then kept. Re-running with another --base reuses the stale comparison.
  5. The synthetic pipe-to-shell defect eats the URL. curl -fsSL -O https://example.com/install.sh becomes curl -fsSL | sh.

Root Cause

  1. src/devops_cli/ai/review/construct_validator.py:461-463 invalidates any finding whose cited construct is absent from the file. The catalog write is at :327-344.
  2. construct_validator.py:316, :318 and :403 rebuild the location from _parse_location, which lowercases the path (src/devops_cli/ai/review_schema.py:793).
  3. _PATH_CHARS now includes a space (review_schema.py:184), and canonicalize_finding_location (:197-207, :412-418) no longer isolates the path:line token.
  4. src/devops_cli/commands/analyze.py:167 reads the old file with git show <base>:path, while the changed-file list at :454 comes from git diff base...target. The cache at :196-217 is keyed only by target branch and file modification time.
  5. _SCRIPT_DOWNLOAD (src/devops_cli/ai/review/defects.py:786-789) treats curl's -O as taking a filename argument, but -O takes none.

Remediation Plan

  1. Exempt absence-type findings ("missing", "lacks", "without", "no ...") from construct-location invalidation. Never auto-learn catalog entries from deterministic invalidations.
  2. Preserve the original case of the path when relocating.
  3. Canonicalize to the path:line[-line] token only, and drop surrounding prose.
  4. Compare symbols against the merge-base, and key the cached comparison by base.
  5. Treat -O as a flag in _SCRIPT_DOWNLOAD.
  6. Add a test for each case above.

Activity

  1. added this to the v0.2.23 milestone on Sep 28, 2026
  2. added
    type/bug
    scope/review
    priority/p1-high
    on Sep 28, 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/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions