Skip to content

Commit 4fc5f87

Browse files
committed
fix(cli): the check cache ignores the video copies the check itself touches
1 parent 43d185f commit 4fc5f87

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎packages/cli/src/commands/check.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,20 @@ describe("check cache", () => {
41654165
expect(runPipeline).toHaveBeenCalledTimes(2);
41664166
});
41674167

4168+
it("still hits when the check touches its video copies under .transcode-cache", async () => {
4169+
const { dir, runPipeline, run } = setup(reportWithFindings());
4170+
const copy = join(dir, ".transcode-cache", "clip.mp4");
4171+
mkdirSync(join(dir, ".transcode-cache"));
4172+
writeFileSync(copy, Buffer.alloc(3 * 1024 * 1024, 1));
4173+
runPipeline.mockImplementationOnce(async () => {
4174+
utimesSync(copy, new Date(), new Date());
4175+
return reportWithFindings();
4176+
});
4177+
await run();
4178+
await run();
4179+
expect(runPipeline).toHaveBeenCalledTimes(1);
4180+
});
4181+
41684182
it("never caches a project whose .hyperframes links to another directory", async () => {
41694183
const { dir, runPipeline, run } = setup(reportWithFindings());
41704184
mkdirSync(join(dir, "real"));

‎packages/cli/src/utils/checkCache.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
writeFileSync,
1010
} from "node:fs";
1111
import { join } from "node:path";
12+
import { CACHE_DIR_NAME as PROXY_CACHE_DIR_NAME } from "@hyperframes/studio-server/proxy-transcoder";
1213
import type { CheckOptions, CheckReport } from "./checkTypes.js";
1314

1415
const PROJECT_STATE_DIR = ".hyperframes";
@@ -68,7 +69,7 @@ function hashTree(dir: string, prefix: string, hash: ReturnType<typeof createHas
6869
a.name < b.name ? -1 : 1,
6970
);
7071
for (const entry of entries) {
71-
if (entry.name === ".git") continue;
72+
if (entry.name === ".git" || entry.name === PROXY_CACHE_DIR_NAME) continue;
7273
if (prefix === `${PROJECT_STATE_DIR}/` && TOOL_OWNED.has(entry.name)) continue;
7374
if (entry.name === "node_modules")
7475
throw new Uncacheable("node_modules can hold code the page runs");

0 commit comments

Comments
 (0)