fix(review): kill diff-only false-positives (source-first diff + brace-aware parse) - #1110
Merged
Merged
Conversation
…er + brace-aware JSON parse (#accuracy-gap-1, #accuracy-gap-3) Two reviewbot-parity fixes from the accuracy-gap audit, targeting the metagraphed #1528 class (model hallucinates 'missing import / undefined symbol' on code it cannot see). GAP-1 (the #1528 root): buildAiReviewDiff was a blind 60k head-slice that break-DROPPED whole files in stored order — no source-first ordering, no hunk-aware reduction. On a multi-file PR the file that DEFINES a symbol could be dropped while another referenced it, so the reviewer 'saw' an undefined symbol (survived even with full-file grounding on). Port reviewbot src/core/diff.ts into a new guarded src/review/review-diff.ts: order SOURCE first (lockfiles/generated/docs/tests drop first), reduce oversized patches hunk-aware (keep highest-signal hunks) instead of dropping, always list patch-less/ over-budget files with counts, and raise the budget 60k->80k (the 120B models are 128k-context). GAP-3: parseModelReview used a greedy /{[\s\S]*\}/ that spanned first-{ to last-} and swallowed the gpt-oss/nemotron <think> scratchpad object together with the verdict, silently corrupting/dropping reviews. Port reviewbot's brace-depth-aware, string-safe extractLastJsonObject (returns the LAST complete top-level object). Full suite green (3499). New: review-diff.test.ts (source survives over lockfiles under tight budget; patch-less file listed; hunk-aware reduction) + ai-review.test.ts scratchpad+fenced regression tests.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1110 +/- ##
==========================================
- Coverage 94.92% 94.90% -0.03%
==========================================
Files 153 154 +1
Lines 18559 18623 +64
Branches 6711 6737 +26
==========================================
+ Hits 17618 17674 +56
Misses 390 390
- Partials 551 559 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the reviewbot→gittensory accuracy-gap audit. Targets the #1528 class (model hallucinates 'missing import/undefined symbol' on code it can't see).
GAP-1 (the #1528 root):
buildAiReviewDiffwas a blind 60k head-slice thatbreak-dropped whole files — so the file defining a symbol could vanish while another referenced it (survived even with grounding on). Ported reviewbot'sdiff.ts→ new guardedsrc/review/review-diff.ts: source-first ordering, hunk-aware reduction, always-list dropped files, 60k→80k budget.GAP-3:
parseModelReview's greedy regex swallowed the model's<think>scratchpad with the verdict → corrupted reviews. Ported reviewbot's brace-depth-awareextractLastJsonObject.Full suite green (3499). New tests cover both.