Skip to content

feat(review): deterministic positioning-validation pass — verify every finding's file/line before storing #721

Closed

Description

@ajianaz

What

Add a deterministic post-LLM positioning-validation pass to cora review (and cora scan): before a finding is persisted/emitted, verify that

  1. the file exists in the diff/repo,
  2. the reported line number is within the file (or the diff hunk range),
  3. any quoted snippet matches the actual content (fuzzy match allowed).

Findings that fail validation are dropped or line-snapped — never stored with a wrong location.

Why

Pattern adopted from Alibaba open-code-review (Apache-2.0): their dedicated "external positioning module" systematically corrects location drift before comments are published. Cora currently trusts LLM-reported locations; known failure modes in our own notes: GLM returning invalid fields silently skipping whole batches, and precise end_line (tree-sitter node ranges) still planned. Every downstream consumer — findings, fingerprint auto-resolve, SARIF/debt — depends on findings pointing at real, current code.

Testing

  • Unit tests: out-of-range line, non-existent file, snippet mismatch → dropped/snapped.
  • Live: run on a real PR diff before/after; assert 100% of stored findings point to existing lines.
  • Cross-check a repo with known location drift reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:highscope:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions