Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions review-enrichment/src/analyzers/asset-weight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 13 additions & 0 deletions review-enrichment/test/asset-weight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading