perf(review): skip duplicate full-file grounding fetch for modified files#4046
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-07 13:52:19 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4046 +/- ##
=======================================
Coverage 93.56% 93.57%
=======================================
Files 378 378
Lines 35448 35466 +18
Branches 13000 13011 +11
=======================================
+ Hits 33167 33186 +19
Misses 1618 1618
+ Partials 663 662 -1
🚀 New features to boost your workflow:
|
…iles fetchFullFileContents unconditionally re-fetched the full post-change body of every changed file, even a MODIFIED file whose diff hunk already carries every line of the file (a small file rewritten in one hunk) -- a byte-for-byte duplicate of what the diff itself already sent to the review prompt. Adds diffFullyCoversFile: true only when a single hunk starts at line 1 on both sides AND its unchanged-line count is strictly below git's default 3-line context window -- fewer than that proves the file truly ends there, since git would show exactly 3 lines of context if more remained. Deliberately scoped to status: modified only, so an added file's fetch (restored by #3976) can never be re-skipped by this check.
…GroundingFiles Codecov flagged 5 uncovered branches on the prior commit: diffFullyCoversFile's multi-hunk guard, its bare single-line hunk-header shorthand (no comma count), and its leading-context guard, plus toGroundingFiles' now-optional status field.
bc99547 to
eb5e72f
Compare
Summary
Closes #4009.
fetchFullFileContentsunconditionally re-fetched the full post-change body of every changed file, even a MODIFIED file whose diff hunk already carries every line of the file (e.g. a small file rewritten in one hunk) — a byte-for-byte duplicate of what the diff itself already sent to the review prompt.diffFullyCoversFile: true only when a single hunk starts at line 1 on both sides AND its unchanged-line count is strictly below git's default 3-line context window. Fewer than 3 trailing unchanged lines proves the file truly ends there (git would show exactly 3 lines of context if more remained); exactly 3 is treated as ambiguous and falls back to fetching.status === "modified"only, so an added file's fetch (restored by fix(review): ground newly added files #3976, after perf(review): skip duplicate full-file grounding fetch for added files #3918's blanketstatus === "added"skip was found unsafe — GitHub can omit/truncate an added file's patch on large files) can never be re-skipped by this check.Test plan
npm run typecheck— cleannpx vitest run test/unit/review-grounding.test.ts test/unit/grounding-wiring.test.ts— 55/55 passed, including 3 new tests: a fully-covering single-hunk rewrite (skips the fetch), a partial hunk at the exact 3-line context boundary (still fetches — this is the case an earlier draft of this change got wrong, caught by this exact test), and an added file that would otherwise look fully-covering (status gate holds, still fetches)