mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-08-31 02:41:44 +00:00
fix(plugin): avoid high compression silence fixture (#1717)
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
Binary file not shown.
@@ -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`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user