Skip to content

Commit 612afcf

Browse files
committed
test(engine): pin no hashing with the cache off and the producer's remote-media dir
1 parent 02cecc1 commit 612afcf

3 files changed

Lines changed: 43 additions & 1 deletion

File tree

‎.fallowrc.jsonc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@
466466
// require intrusive middleware changes beyond this PR's scope.
467467
"minLines": 6,
468468
"ignore": [
469+
// Pre-existing clone with extractVideosStage.ffmpegTimeout.test.ts: both mock the engine's whole
470+
// ExtractionResult. Touching the mock to record another option re-flags it.
471+
"packages/producer/src/services/render/stages/extractVideosStage.timelineBound.test.ts",
469472
// AWS Lambda and GCP Cloud Run deliberately mirror the same distributed
470473
// rendering lifecycle while retaining provider-specific SDK, storage, and
471474
// retry semantics. The Plan v2 AWS adapter extends that existing symmetry;

‎packages/engine/src/services/videoFrameExtractor.downloadCache.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,25 @@ describe.skipIf(process.platform === "win32")("extractAllVideoFrames downloaded
166166
expect(first.phaseBreakdown.cacheHits + second.phaseBreakdown.cacheHits).toBe(0);
167167
expect(hashing.paths).toEqual([]);
168168
});
169+
170+
it("does not hash when the cache is off", async () => {
171+
source.clip = red;
172+
hashing.paths = [];
173+
const compiledDir = join(dir, "cache-off", "compiled");
174+
mkdirSync(join(compiledDir, "_remote_media"), { recursive: true });
175+
copyFileSync(source.clip, join(compiledDir, "_remote_media", "clip.mp4"));
176+
const result = await extractAllVideoFrames(
177+
[clipElement("_remote_media/clip.mp4")],
178+
join(dir, "project"),
179+
{
180+
...{ fps: 30, outputDir: join(compiledDir, "frames") },
181+
contentKeyedDirs: [join(compiledDir, "_remote_media")],
182+
},
183+
undefined,
184+
{},
185+
compiledDir,
186+
);
187+
expect(result.errors).toEqual([]);
188+
expect(hashing.paths).toEqual([]);
189+
});
169190
});

‎packages/producer/src/services/render/stages/extractVideosStage.timelineBound.test.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const extractionCalls = vi.hoisted(
1111
() => new Array<{ timelineEnd: number | undefined; durationSeconds: number }>(),
1212
);
1313
const toneMapHdrToSdrCalls = vi.hoisted(() => new Array<boolean | undefined>());
14+
const contentKeyedDirsCalls = vi.hoisted(() => new Array<readonly string[] | undefined>());
1415
const fixtureState = vi.hoisted(() => ({ sourceDurationSeconds: 60 }));
1516

1617
vi.mock("@hyperframes/engine", async (importOriginal) => {
@@ -20,7 +21,11 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
2021
extractAllVideoFrames: async (
2122
videos: VideoElement[],
2223
_baseDir: string,
23-
options: { timelineEnd?: number; toneMapHdrToSdr?: boolean },
24+
options: {
25+
timelineEnd?: number;
26+
toneMapHdrToSdr?: boolean;
27+
contentKeyedDirs?: readonly string[];
28+
},
2429
): Promise<ExtractionResult> => {
2530
const sourceDurationSeconds = fixtureState.sourceDurationSeconds;
2631
const video = videos[0];
@@ -38,6 +43,7 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
3843
video.end = video.start + durationSeconds;
3944
extractionCalls.push({ timelineEnd: options.timelineEnd, durationSeconds });
4045
toneMapHdrToSdrCalls.push(options.toneMapHdrToSdr);
46+
contentKeyedDirsCalls.push(options.contentKeyedDirs);
4147
return {
4248
success: true,
4349
extracted: [],
@@ -66,6 +72,8 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
6672
};
6773
});
6874

75+
import { join } from "node:path";
76+
import { REMOTE_MEDIA_SUBDIR } from "../../htmlCompiler.js";
6977
import { createRenderJob } from "../../renderOrchestrator.js";
7078
import { runExtractVideosStage } from "./extractVideosStage.js";
7179

@@ -141,6 +149,16 @@ describe.each([
141149

142150
expect(toneMapHdrToSdrCalls).toEqual([true]);
143151
});
152+
153+
it("caches the compiled remote-media copies by content", async () => {
154+
contentKeyedDirsCalls.splice(0);
155+
156+
await runStage(2, materializeSymlinks);
157+
158+
expect(contentKeyedDirsCalls).toEqual([
159+
[join("/tmp/hf-timeline-bound-compiled", REMOTE_MEDIA_SUBDIR)],
160+
]);
161+
});
144162
});
145163

146164
describe("video extraction source logging", () => {

0 commit comments

Comments
 (0)