fix(review): ground newly added files#3976
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-07 10:00:31 UTC
🛑 Suggested Action - Manual Review
Why this is blocked
CI checks failing
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.
|
❌ 57 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
dacc1e9 to
8599def
Compare
Restoring added-file fetching means added files now share the same FILE_CONTENT_BUDGET pool as every other status. Add a regression test that several large added files still degrade to a truncated marker once the budget is exhausted, instead of over-fetching.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | bbb0195 | Commit Preview URL Branch Preview URL |
Jul 07 2026, 09:54 AM |
bbb0195 to
6f8339f
Compare
…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.
…iles (#4046) * perf(review): skip duplicate full-file grounding fetch for modified files 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. * test(review): close patch-coverage gaps in diffFullyCoversFile and toGroundingFiles 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.
Motivation
addedfiles from full-file grounding, relying on the incorrect assumption that the bounded diff always contains every added line which can let newly added code be omitted from both the diff and grounding fallback. This weakens gate-relevant AI reviews and allows contributor-controlled added files to hide content from reviewers.Description
addedfiles infetchFullFileContentsby removing thestatus !== "added"exclusion and update the inline comment to explain why added files still require the full-file fallback; removed/binary files remain excluded viaremovedandSKIP_EXTchecks. (changedsrc/review/review-grounding.ts).addedfile is fetched and inlined so the fallback covers patch-less or truncated diffs (updatedtest/unit/review-grounding.test.ts).Testing
npx vitest run test/unit/review-grounding.test.tsandnpx vitest run test/unit/review-grounding.test.ts test/unit/review-diff.test.ts— both passed locally (unit suites green).npm run typechecksucceeded with no type errors.npm run test:coverageexecuted the tests but the coverage remapping step failed in this environment withTypeError: jsTokens is not a function(coverage run did not fully complete here).npm run test:ciwas started but the full unsharded CI/coverage run did not complete in this container;npm audit --audit-level=moderatecould not complete due to the environment's npm audit endpoint returning403 Forbidden.Codex Task