commit 044f20f5ce04ef46abd930762e1029a2ee0bff3f
parent 9b423d22626afb6ad090d6d4e6e9b640572698fe
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 10 Oct 2026 00:22:30 -0400
umtool e2e: the on-screen build specs read the deck's and the feed's frame counts from chrome/pruned.json, and require the sequences gone
A build now prunes the chrome's frames after the final mux (report-to-video
prune-frames.mjs), so the counts come from its record, which also proves the
prune.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/umtool/e2e/onscreen-posts.spec.ts b/umtool/e2e/onscreen-posts.spec.ts
@@ -1,6 +1,6 @@
import { test, expect, type APIRequestContext, type Locator, type Page } from "@playwright/test";
import { execFileSync } from "node:child_process";
-import { existsSync, readFileSync, readdirSync } from "node:fs";
+import { existsSync, readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { deckGeometry, feedGeometry, postWindows, postsGeometry, shiftedFootage } from "umtool-report-to-video/deck";
@@ -598,12 +598,20 @@ test("a feed cut builds: every clip framed into the feed's box, one feed sequenc
const seg = schedule.segments.find((s) => s.id === p.segment)!;
expect(p.in).toBeCloseTo(seg.start + schedule.transition, 3);
}
- // One sequence for the whole cut, as long as the deck's.
- const count = (dir: string) => readdirSync(dir).filter((f) => /^frame_\d{6}\.png$/.test(f)).length;
+ // One sequence for the whole cut, as long as the deck's. The build prunes
+ // the frames after the final mux and records each sequence's count
+ // (report-to-video/prune-frames.mjs): the sequences are gone, and the counts
+ // are read from the record.
+ const pruned = JSON.parse(readFileSync(path.join(FEED_OUT, "chrome", "pruned.json"), "utf8")) as {
+ dirs: Record<string, { frames: number }>;
+ };
const frames = Math.round(schedule.total * schedule.fps);
- expect(count(path.join(FEED_OUT, "chrome", "feed-frames"))).toBe(frames);
- expect(count(path.join(FEED_OUT, "chrome", "deck-frames"))).toBe(frames);
+ for (const name of ["feed-frames", "deck-frames"]) {
+ expect(existsSync(path.join(FEED_OUT, "chrome", name)), `${name} pruned after the mux`).toBe(false);
+ expect(pruned.dirs[name]?.frames).toBe(frames);
+ }
expect(existsSync(path.join(FEED_OUT, "chrome", "posts-c01-frames"))).toBe(false);
+ expect(pruned.dirs["posts-c01-frames"]).toBeUndefined();
// Every clip framed into the feed's box, and its record says so.
for (const id of ["c01", "c02"]) {
const rec = JSON.parse(readFileSync(path.join(FEED_OUT, "segments", `${id}.cut.json`), "utf8"));
diff --git a/umtool/e2e/onscreen.spec.ts b/umtool/e2e/onscreen.spec.ts
@@ -1,6 +1,6 @@
import { test, expect, type APIRequestContext, type Locator, type Page } from "@playwright/test";
import { execFileSync } from "node:child_process";
-import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
+import { existsSync, readFileSync, statSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
@@ -391,7 +391,16 @@ const readSchedule = () =>
total: number;
segments: { id: string; title: string }[];
};
-const frameFiles = () => readdirSync(FRAMES).filter((f) => /^frame_\d{6}\.png$/.test(f));
+// A build prunes the deck's frames after the final mux and records how many
+// there were (report-to-video/prune-frames.mjs): the sequence must be gone,
+// and its count is read from the record.
+const prunedFrames = (name = "deck-frames") => {
+ expect(existsSync(path.join(VARIANT_OUT, "chrome", name)), `${name} pruned after the mux`).toBe(false);
+ const rec = JSON.parse(readFileSync(path.join(VARIANT_OUT, "chrome", "pruned.json"), "utf8")) as {
+ dirs: Record<string, { frames: number }>;
+ };
+ return rec.dirs[name]?.frames ?? 0;
+};
const probeSeconds = (file: string) =>
Number(
execFileSync("ffprobe", ["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", file])
@@ -442,7 +451,7 @@ test("re-render on-screen runs --chrome-only over a built cut, to done, rebuildi
expect(first.kind).toBe("deck");
expect(first.estimated).toBe(false);
expect(first.transition).toBe(0);
- expect(frameFiles().length).toBe(Math.round(first.total * first.fps));
+ expect(prunedFrames()).toBe(Math.round(first.total * first.fps));
// The stub's frames alternate RGB and RGBA. Without `-reinit_filter 0` the
// overlay drops frames at every format change and the cut comes out short;
// the build asserts the length, and so does this.
@@ -488,7 +497,7 @@ test("re-render on-screen runs --chrome-only over a built cut, to done, rebuildi
expect(second.transition).toBeGreaterThan(0);
expect(second.total).toBeLessThan(first.total);
expect(second.segments.find((s) => s.id === "c02")!.title).toBe("Re-rendered title");
- expect(frameFiles().length).toBe(Math.round(second.total * second.fps));
+ expect(prunedFrames()).toBe(Math.round(second.total * second.fps));
expect(Math.abs(probeSeconds(FINAL) - second.total)).toBeLessThan(2 / second.fps);
await expect(page.getByTestId("onscreen-final-video")).toBeVisible();
});