Skip to content

Match triage verdicts to findings by index, not by title#119

Open
thejesh23 wants to merge 1 commit into
vercel-labs:mainfrom
thejesh23:fix/deepsec-002
Open

Match triage verdicts to findings by index, not by title#119
thejesh23 wants to merge 1 commit into
vercel-labs:mainfrom
thejesh23:fix/deepsec-002

Conversation

@thejesh23

Copy link
Copy Markdown

What changed

triageBatch now correlates each model verdict to the finding it judged by the 1-based ID already shown in the prompt, instead of by finding.title. The prompt emits an - **ID:** line and asks the model to echo it in each verdict; the parse loop matches on that id, falling back to title only when the id is missing, with an applied-set guard so a duplicate id/title in the reply can't assign one finding twice.

Why

Finding titles are free-text and not unique — generic ones ("Missing authorization check", "SQL injection") recur across the up-to-30 findings in a batch. The old batch.find((b) => b.finding.title === verdict.title) returned the first title match, so same-titled findings collapsed onto one: earlier verdicts were overwritten, later findings were never triaged, and the P0/P1/P2/skip counts were mis-attributed.

The applied-set guard is used instead of a finding.triage-presence check on purpose: with --force, findings retain a prior run's triage, so a presence check would skip re-triage entirely.

Fixes #118

Verification

  • pnpm test passes (added a regression test: two same-titled findings receive two distinct verdicts and both are triaged; it fails on main and passes with this change)
  • pnpm lint passes
  • pnpm knip passes
  • If this adds a matcher: n/a

Also ran pnpm -r build (typecheck) and pnpm test:bundle — both green.

Notes for reviewer

Behavioral change is limited to packages/processor/src/triage.ts. The id field is additive and optional on TriageVerdict; if a model omits it the code falls back to the previous title-matching, so this degrades gracefully rather than hard-failing.

triageBatch mapped each model verdict back to a finding with
`batch.find((b) => b.finding.title === verdict.title)`. Finding titles
are free-text and not unique — generic titles ("Missing authorization
check", "SQL injection") recur across the up-to-30 findings in a batch.
`find` returns the first title match, so same-titled findings are all
assigned the first one's verdict: earlier ones get overwritten, later
ones are never triaged, and the P0/skip counts are mis-attributed.

Emit the 1-based index already shown in the prompt as an `id` field and
correlate on it, falling back to title only when the model omits the id.
An applied-set guard prevents a duplicate id/title in the reply from
assigning one finding twice (and, unlike a `finding.triage`-presence
guard, it doesn't break `--force` re-triage).

Adds a regression test: two same-titled findings receive two distinct
verdicts, and both are triaged.
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@thejesh23 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

triage: verdicts correlated to findings by non-unique title, mis-attributing and dropping triage

1 participant