commit 0ea3697dbda8d4376da82be46fadf87e984744fe
parent ae5c325f3ce723a33e01c3036e158f43c24a028e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 16 Oct 2026 02:20:00 -0400
umtool: stats-overlay.spec.ts — the stats-build-fixture (the deck, render.chrome.stats, a frame scan's overlay points for both clips) built offline through the build route with the stub renderer: the region composed and rendered after the deck, the schedule's states held from the scan's points, the page's numbers, the stats-frames as long as the deck's (pruned and recorded), and the chain's verify-build passing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 126 insertions(+), 0 deletions(-)
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -1546,6 +1546,34 @@ const ONSCREEN_BUILD = writeProject(
]),
);
+// stats-build-fixture (release 31, lane P3): the deck with the STATS region
+// over both clips -- a frame scan's overlay points, synthetic numbers in the
+// clips' source seconds -- BUILT by stats-overlay.spec.ts offline: the stub
+// renderer writes the region's frames and verify-build holds them. Its own
+// project, as onscreen-build-fixture is: a build stamps out/.
+{
+ const m = deckManifest("stats-build-fixture", "The Stats Build Fixture", [
+ { type: "clip", id: "c01", video: "vid1", start: 3.0, end: 6.0, cite: 3, section: 0, lock: true, quote: "and because" },
+ { type: "clip", id: "c02", video: "vid1", start: 9.0, end: 12.0, cite: 9, section: 0, lock: true, quote: "another whole sentence" },
+ ]);
+ m.render.chrome = { ...m.render.chrome, stats: {} };
+ m.frameScan = {
+ profile: "poker",
+ file: "frame-scan.poker.json",
+ channel: "testchan",
+ video: "vid1",
+ tournaments: [{ key: "synth main", name: "SYNTH MAIN", from: 0, to: 20 }],
+ overlay: [
+ { clip: "c01", points: [
+ { at: 3, tournament: "synth main", name: "SYNTH MAIN", stack: 50000, stackBB: 50, playersLeft: 120, level: 1 },
+ { at: 4.5, tournament: "synth main", name: "SYNTH MAIN", stack: 80000, stackBB: 66.7, playersLeft: 120, level: 1 },
+ ] },
+ { clip: "c02", points: [{ at: 9, tournament: "synth main", name: "SYNTH MAIN", stack: 170000, stackBB: 106.3, playersLeft: 45, level: 4 }] },
+ ],
+ };
+ writeProject("stats-build-fixture", m);
+}
+
// onscreen-posts-fixture: the Posts table writes here (onscreen-posts.spec.ts).
// The clips carry their own `date`, so which clip a post rides on is the
// date rule's answer and not the cue file's one shared upload day:
@@ -1974,6 +2002,7 @@ console.log(` editor-fetch-{,many-,reuse-}fixture (nothing cached —
console.log(` longform-fixture (cue gap, legacy .bak, ffmeta), longform-edit-fixture, dash-fixture`);
console.log(` deliver-fixture (writable: a01/a02 to cut, a03 unfetched, b01 shared, b02 incorrect, b03 unjudged)`);
console.log(` onscreen-fixture (writable, deck on, unbuilt), onscreen-build-fixture (built with the deck)`);
+console.log(` stats-build-fixture (built with the deck and the stats region)`);
console.log(` onscreen-posts-fixture (writable, deck on, three posts, unbuilt)`);
console.log(` onscreen-feed-fixture (writable, posts feed, built by the spec)`);
console.log(` deliver-stop-fixture (writable: six confirmed clips to cut, for Stop and resume)`);
diff --git a/umtool/e2e/stats-overlay.spec.ts b/umtool/e2e/stats-overlay.spec.ts
@@ -0,0 +1,97 @@
+import { test, expect, type APIRequestContext } from "@playwright/test";
+import { existsSync, readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+// ---------------------------------------------------------------------------
+// THE STATS REGION (release 31, lane P3): a frame scan's running numbers drawn
+// over each clip, built and verified.
+//
+// stats-build-fixture made by make-fixture.mjs at 1920x1080 with the deck
+// on, `render.chrome.stats`, and a frame scan's
+// `frameScan.overlay` points for both clips (synthetic)
+//
+// The build runs offline, as the on-screen build's does: the renderer is the
+// fixture's stub (HYPERFRAMES_BIN), which writes the frame sequence each
+// region declares. The chain ends in verify-build, which holds the stats
+// region's frames to the cut and fails the job when one is missing -- so a
+// job that is `done` is a verified cut with the overlay laid over it.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const PROJECT = "reports/stats-build-fixture";
+const DIR = path.join(FIXTURE, "reports", "stats-build-fixture");
+const VARIANT_OUT = path.join(DIR, "out", "sourced");
+const FINAL = path.join(DIR, "out", "stats-build-fixture.mp4");
+const INVOCATIONS = path.join(FIXTURE, "bin", "hyperframes.invocations");
+
+type Job = {
+ id: string;
+ state: string;
+ error: string | null;
+ steps: { label: string; argv: string[] }[];
+ events: { ev: string; phase?: string; region?: string }[];
+ log?: string[];
+};
+
+async function waitForJob(request: APIRequestContext, id: string, ms = 240_000): Promise<Job> {
+ const until = Date.now() + ms;
+ while (Date.now() < until) {
+ const j = (await (await request.get(`/api/report/build?job=${id}`)).json()) as Job;
+ if (j.state !== "running") return j;
+ await new Promise((r) => setTimeout(r, 400));
+ }
+ throw new Error("the job never finished");
+}
+
+const manifest = () => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8"));
+
+test("a deck build lays the stats region over each clip, and verify-build holds it", async ({ request }) => {
+ test.setTimeout(300_000);
+ test.skip(
+ !manifest().render.fontRegular,
+ "the deck refuses to draw without render.fontRegular/fontBold, and make-fixture.mjs found no font on this machine",
+ );
+
+ // The chain: the build, then verify-build.
+ const dry = (await (await request.post("/api/report/build?dry=1", { data: { project: PROJECT, preset: "fast" } })).json()) as {
+ steps: { argv: string[] }[];
+ };
+ expect(dry.steps.at(-1)!.argv.join(" ")).toContain("verify-build.mjs");
+
+ const start = await request.post("/api/report/build?replace=1", { data: { project: PROJECT, preset: "fast" } });
+ expect(start.ok(), await start.text()).toBeTruthy();
+ const job = await waitForJob(request, ((await start.json()) as { job: Job }).job.id);
+ expect(job.state, `${job.error ?? ""}\n${job.log?.slice(-30).join("\n") ?? ""}`).toBe("done");
+
+ // The region was composed and rendered (by the stub), after the deck.
+ const chrome = job.events.filter((e) => e.ev === "chrome");
+ expect(chrome.some((e) => e.phase === "compose" && e.region === "stats")).toBe(true);
+ expect(chrome.some((e) => e.phase === "render" && e.region === "stats")).toBe(true);
+ const renders = readFileSync(INVOCATIONS, "utf8").split("\n").filter((l) => l.includes("stats-build-fixture"));
+ expect(renders.some((l) => l.includes(path.join(VARIANT_OUT, "chrome", "stats-frames")))).toBe(true);
+
+ // The schedule draws both clips, each number held from the scan's point.
+ const schedule = JSON.parse(readFileSync(path.join(VARIANT_OUT, "schedule.json"), "utf8")) as {
+ fps: number;
+ total: number;
+ stats: { position: string; clips: { segment: string; in: number; out: number; states: { at: number; values: Record<string, number | null> }[] }[] };
+ };
+ expect(schedule.stats.position).toBe("bottom-left");
+ expect(schedule.stats.clips.map((c) => c.segment)).toEqual(["c01", "c02"]);
+ expect(schedule.stats.clips[0].states.map((s) => s.values.stack)).toEqual([50000, 80000]);
+ expect(schedule.stats.clips[1].states[0].values).toEqual({ stack: 170000, stackBB: 106.3, playersLeft: 45, level: 4 });
+
+ // The page the frames were rendered from shows the numbers.
+ const page = readFileSync(path.join(VARIANT_OUT, "chrome", "stats", "index.html"), "utf8");
+ expect(page).toContain('<div class="name">SYNTH MAIN</div>');
+ expect(page).toContain('<div class="val">80,000</div>');
+ expect(page).toContain('<div class="lab">Left</div><div class="val">45</div>');
+
+ // As long as the cut, pruned after the mux and recorded.
+ const pruned = JSON.parse(readFileSync(path.join(VARIANT_OUT, "chrome", "pruned.json"), "utf8")) as { dirs: Record<string, { frames: number }> };
+ expect(pruned.dirs["stats-frames"].frames).toBe(Math.round(schedule.total * schedule.fps));
+ expect(pruned.dirs["stats-frames"].frames).toBe(pruned.dirs["deck-frames"].frames);
+ expect(existsSync(FINAL)).toBe(true);
+});