Skip to content

Write HTML. Render video. Built for agents.

fix(plugin): avoid high compression silence fixture (#1717)

Miguel Ángel96ab4b18a4f2
diff --git a/package.json b/package.json
index a97fc789fe..bcb7a3af60 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"player:perf": "bun run --filter @hyperframes/player perf",
"format:check": "oxfmt --check .",
"knip": "knip",
- "test:scripts": "node --import tsx --test scripts/validate-release-channel.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts",
+ "test:scripts": "node --import tsx --test scripts/validate-release-channel.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts scripts/claude-plugin-compression.test.ts",
"generate:previews": "tsx scripts/generate-template-previews.ts",
"generate:catalog-previews": "tsx scripts/generate-catalog-previews.ts",
"upload:docs-images": "bash scripts/upload-docs-images.sh",
diff --git a/packages/producer/tests/missing-host-comp-id/src/silence.wav b/packages/producer/tests/missing-host-comp-id/src/silence.wav
index b9113c424a..98935e7b0f 100644
Binary files a/packages/producer/tests/missing-host-comp-id/src/silence.wav and b/packages/producer/tests/missing-host-comp-id/src/silence.wav differ
diff --git a/scripts/claude-plugin-compression.test.ts b/scripts/claude-plugin-compression.test.ts
new file mode 100644
index 0000000000..1300de05b4
--- /dev/null
+++ b/scripts/claude-plugin-compression.test.ts
@@ -0,0 +1,32 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { dirname, resolve } from "node:path";
+import { describe, it } from "node:test";
+import { fileURLToPath } from "node:url";
+import { deflateRawSync } from "node:zlib";
+
+const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
+const MAX_INSTALL_COMPRESSION_RATIO = 50;
+
+const CLAUDE_PLUGIN_PAYLOAD_FILES = [
+ "packages/producer/tests/missing-host-comp-id/src/silence.wav",
+] as const;
+
+function compressionRatio(bytes: Buffer): number {
+ const compressedBytes = deflateRawSync(bytes).byteLength;
+ return bytes.byteLength / compressedBytes;
+}
+
+describe("Claude plugin install payload", () => {
+ it("keeps bundled files below the suspicious compression-ratio guard", () => {
+ for (const relativePath of CLAUDE_PLUGIN_PAYLOAD_FILES) {
+ const bytes = readFileSync(resolve(REPO_ROOT, relativePath));
+ const ratio = compressionRatio(bytes);
+
+ assert.ok(
+ ratio <= MAX_INSTALL_COMPRESSION_RATIO,
+ `${relativePath} compresses at ${ratio.toFixed(1)}:1, above the ${MAX_INSTALL_COMPRESSION_RATIO}:1 install guard`,
+ );
+ }
+ });
+});