From db46f3f1b9243dd07befe4cc8ff6a4c4916777e5 Mon Sep 17 00:00:00 2001 From: jimcody1995 Date: Sun, 5 Jul 2026 07:50:00 +0200 Subject: [PATCH] fix(review): skip additional binary extensions in full-file grounding avif/bmp/heic images and .tgz archives were not filtered by SKIP_EXT, so full-file grounding wasted budget fetching unreadable blobs. Align with common binary extensions from review/rag.ts BINARY_EXT_RE. Co-authored-by: Cursor --- src/review/review-grounding.ts | 2 +- test/unit/review-grounding.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/review/review-grounding.ts b/src/review/review-grounding.ts index d5ce8e53dd..378efaafec 100644 --- a/src/review/review-grounding.ts +++ b/src/review/review-grounding.ts @@ -51,7 +51,7 @@ export interface ReviewGrounding { const FILE_CONTENT_BUDGET = 60_000; // total chars inlined across all changed files const MAX_SINGLE_FILE = 24_000; // a file larger than this is marked truncated (review it from the diff) // Binary / generated / lockfile paths carry no review signal as full text — skip inlining them. -const SKIP_EXT = /\.(png|jpe?g|gif|webp|svg|ico|pdf|lock|min\.js|min\.css|map|woff2?|ttf|eot|mp4|webm|zip|gz|wasm)$/i; +const SKIP_EXT = /\.(png|jpe?g|gif|webp|avif|bmp|heic|svg|ico|pdf|lock|min\.js|min\.css|map|woff2?|ttf|eot|mp4|webm|zip|gz|tgz|wasm)$/i; /** The grounding feature flags (subset of reviewbot's FeatureToggles). */ export interface GroundingFlags { diff --git a/test/unit/review-grounding.test.ts b/test/unit/review-grounding.test.ts index bbd6f31ec8..406b84edd7 100644 --- a/test/unit/review-grounding.test.ts +++ b/test/unit/review-grounding.test.ts @@ -156,11 +156,11 @@ describe("review-grounding: fetchFullFileContents (injected FileFetcher, fail-sa const out = await fetchFullFileContents( { ciGrounding: false, fullFileContext: true }, "sha", - files(["README.md"], ["src/a.ts"], ["logo.png"], ["old.ts", "removed"]), + files(["README.md"], ["src/a.ts"], ["logo.png"], ["assets/photo.avif"], ["assets/poster.bmp"], ["assets/icon.heic"], ["dist/pkg.tgz"], ["old.ts", "removed"]), fetcher, ); expect(out).toBeDefined(); - // source (priority 0) before docs (priority 2); png + removed excluded + // source (priority 0) before docs (priority 2); binary + removed excluded expect(out?.map((f) => f.path)).toEqual(["src/a.ts", "README.md"]); });