From be28a604488a2157b14b481ca28002972a95ec62 Mon Sep 17 00:00:00 2001 From: davion-knight <298846663+davion-knight@users.noreply.github.com> Date: Sat, 4 Jul 2026 14:14:14 -0500 Subject: [PATCH] feat(enrichment): treat ML model/checkpoint weights as binary assets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The asset-weight analyzer flags heavy binary blobs whose byte sizes never appear in the textual diff, but its extension set covered images/fonts/media/ archives and missed serialized ML model and checkpoint weights — safetensors, gguf, onnx, pt, pth, ckpt. These are among the heaviest artifacts a PR can commit (routinely hundreds of MB to multi-GB), so a PR that adds or grows one slipped past the size-bloat signal. Add them as one centralized group. The lookup already lowercases and matches only the final extension, so casing and compound names are handled by the existing path. src/review/rag.ts already classifies these six as binary; this brings the size analyzer in line. The 100 KB flag threshold means a small text `.pth` path-config file is never weighed, so including `.pth` cannot produce a false finding. --- review-enrichment/src/analyzers/asset-weight.ts | 8 ++++++++ review-enrichment/test/asset-weight.test.ts | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/review-enrichment/src/analyzers/asset-weight.ts b/review-enrichment/src/analyzers/asset-weight.ts index 190a5fbe07..f142a3ebea 100644 --- a/review-enrichment/src/analyzers/asset-weight.ts +++ b/review-enrichment/src/analyzers/asset-weight.ts @@ -72,6 +72,14 @@ const BINARY_EXTS = new Set([ "node", "jar", "class", + // Serialized ML model / checkpoint weight formats — routinely hundreds of MB to multi-GB, the heaviest + // binary blobs a PR can commit, and their bytes never appear in the textual diff. + "safetensors", + "gguf", + "onnx", + "pt", + "pth", + "ckpt", ]); interface ScanOptions { diff --git a/review-enrichment/test/asset-weight.test.ts b/review-enrichment/test/asset-weight.test.ts index 620d14d4e2..01f9b6a069 100644 --- a/review-enrichment/test/asset-weight.test.ts +++ b/review-enrichment/test/asset-weight.test.ts @@ -28,6 +28,19 @@ test("isBinaryAsset flags genuine binary extensions and ignores text/case", () = assert.equal(isBinaryAsset("cache/model.zst"), true); assert.equal(isBinaryAsset("dist/bundle.tar.zst"), true); assert.equal(isBinaryAsset("cache/model.ZST"), true); + // Serialized ML model / checkpoint weight formats are heavy binary blobs (siblings of the other binaries), + // and the match stays case-insensitive. + for (const p of [ + "models/llama.safetensors", + "models/llama.gguf", + "models/resnet.onnx", + "models/model.pt", + "checkpoints/epoch10.pth", + "checkpoints/state.ckpt", + "models/LLAMA.SAFETENSORS", + ]) { + assert.equal(isBinaryAsset(p), true, p); + } // Extension match is case-insensitive. assert.equal(isBinaryAsset("assets/HERO.PNG"), true); // Text formats whose bytes are already in the diff are NOT binary assets.