From 67b78a9bc7c7652085d8c0d56338dfa503db212a Mon Sep 17 00:00:00 2001 From: davion-knight <298846663+davion-knight@users.noreply.github.com> Date: Sat, 4 Jul 2026 09:45:32 -0500 Subject: [PATCH] feat(enrichment): treat Zstandard (.zst) archives 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 sizes are not in the textual diff, but its archive/compression extension set covered gz/tgz/bz2/xz/7z/rar and missed Zstandard (.zst) — now a common committed artifact (npm/cargo caches, compressed model shards). Add it so a PR that commits a large .zst blob is weighed like other binary archives. Only the final extension is matched, so a compound name like `.tar.zst` resolves to `zst`, and the lookup stays case-insensitive. src/review/rag.ts already classifies .zst as binary; this brings the size analyzer in line. --- review-enrichment/src/analyzers/asset-weight.ts | 1 + review-enrichment/test/asset-weight.test.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/review-enrichment/src/analyzers/asset-weight.ts b/review-enrichment/src/analyzers/asset-weight.ts index 4062489697..190a5fbe07 100644 --- a/review-enrichment/src/analyzers/asset-weight.ts +++ b/review-enrichment/src/analyzers/asset-weight.ts @@ -55,6 +55,7 @@ const BINARY_EXTS = new Set([ "7z", "rar", "xz", + "zst", "pdf", "psd", "ai", diff --git a/review-enrichment/test/asset-weight.test.ts b/review-enrichment/test/asset-weight.test.ts index 03192247c5..620d14d4e2 100644 --- a/review-enrichment/test/asset-weight.test.ts +++ b/review-enrichment/test/asset-weight.test.ts @@ -23,6 +23,11 @@ test("isBinaryAsset flags genuine binary extensions and ignores text/case", () = assert.equal(isBinaryAsset("photos/IMG_0001.heic"), true); assert.equal(isBinaryAsset("photos/scan.heif"), true); assert.equal(isBinaryAsset("photos/IMG_0001.HEIC"), true); + // Zstandard blobs are binary compressed assets (siblings of gz/bz2/xz) — only the last extension is matched, + // so a compound `.tar.zst` resolves to `zst`, and the match is case-insensitive. + assert.equal(isBinaryAsset("cache/model.zst"), true); + assert.equal(isBinaryAsset("dist/bundle.tar.zst"), true); + assert.equal(isBinaryAsset("cache/model.ZST"), true); // 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.