Skip to content

team: deterministic prefilter for findings outside the diff#12

Merged
pierrick-fonquerne merged 2 commits into
mainfrom
feature/team-line-prefilter
Jun 4, 2026
Merged

team: deterministic prefilter for findings outside the diff#12
pierrick-fonquerne merged 2 commits into
mainfrom
feature/team-line-prefilter

Conversation

@pierrick-fonquerne

Copy link
Copy Markdown
Contributor

Scope

Synthesised findings sometimes point at a file line that belongs to no hunk of that file's patch. Such findings describe code this pull request does not touch, yet each one costs three lens calls before being contested.

This change adds a deterministic prefilter between synthesis and the lens vote:

  • github.rs: unified diff hunk range parsing (parse_hunks, parse_hunk_header) and DiffContext::line_in_patch, which reports whether a finding's line falls inside a hunk of its file patch
  • team.rs: prefilter_verdict contests a finding whose line is provably outside the diff, with a deterministic reason rendered in the contested section; verify_findings skips the lens calls for prefiltered findings

Findings with line 0, findings on files without a per-file patch, and findings anchored inside a hunk range keep the current behaviour.

Acceptance criteria

  • A finding whose line is outside all hunks of its file patch is contested without any lens call
  • Findings with line 0, without a per-file patch, or inside a hunk range keep the current behaviour
  • The deterministic reason is rendered in the contested section of the comment
  • Hunk parsing covered by unit tests (header with and without count, malformed headers, multi-hunk ranges)

26 tests pass, clippy clean (all + pedantic).

Closes #8

@pierrick-fonquerne pierrick-fonquerne merged commit 3abd183 into main Jun 4, 2026
3 checks passed
@pierrick-fonquerne pierrick-fonquerne deleted the feature/team-line-prefilter branch June 4, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

team: deterministic prefilter for findings outside the diff

1 participant