// What play-cut.spec.ts plays (umtool/docs/knobs.md, "Play the cut"): a short deck cut on // playvid (the fixture's synthetic vid1 window -- tone, and silences at 2.9-3.1 // and 5.9-6.1 -- cached in out/clips-raw under a recording id of its own: the // corpus's vid1 gains wider windows as other specs fetch, and the render's // edges, and so Play's clock, must not depend on which spec ran first), never built -- the Play view plays it from the cached // window on the estimate's clock -- with a card between clips, a clip whose // source was never fetched (a placeholder, not a stall), and two takes: one // made (takes/short/take.json, its own timeline: c04 then c01) and one only // a recipe names (quick-joins, a hard-cut look), and a saved version, v1 (its // frozen base: c01 c02 c04). And play-engine-fixture, the // same cut for play-engine.spec.ts, which writes. // // c01 playvid 1.0-3.0 c02 playvid 3.5-5.5 (k1 at 4.5) k01 card 1.5 s // c03 nofetch 2-4 (no window on disk) c04 playvid 6.0-8.0 (k2, counts 2) // sections 0 (c01, c02) and 1 (c03, c04); one counter, "Seizures" // // Synthetic, like every fixture. import { createHash } from "node:crypto"; import { copyFileSync, mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; /** * @param {{ reports: string, deckManifest: Function, cachedWindow: string, name?: string, title?: string, video?: string }} o * `name`: a second copy under another name (play-edit-fixture, which a spec writes to). * `video`: the recording id its clips cut (playvid; play-edit-fixture's walk needs vid1's cues). * `chrome`: more render.chrome keys (play-modules-fixture: a chapter, a pair and a status ledger). */ export function makePlayCutFixture({ reports, deckManifest, cachedWindow, name = "play-cut-fixture", title = "The Play Cut Fixture", video = "playvid", chrome = null }) { const dir = path.join(reports, name); mkdirSync(dir, { recursive: true }); const timeline = [ { type: "clip", id: "c01", video, start: 1.0, end: 3.0, cite: 1, section: 0, lock: true, quote: "This is a complete sentence.", onscreen: { title: "24 Oct 2020" } }, { type: "clip", id: "c02", video, start: 3.5, end: 5.5, cite: 4, section: 0, lock: true, quote: "And this one runs on", onscreen: { title: "2 Dec 2024" }, claim: { id: "k1", verdict: "CORROBORATED", at: 4.5 }, }, { type: "card", id: "k01", style: "chapter", seconds: 1.5, heading: "Between the clips" }, { type: "clip", id: "c03", video: "nofetch", start: 2.0, end: 4.0, cite: 2, section: 1, lock: true, quote: "never fetched" }, { type: "clip", id: "c04", video, start: 6.0, end: 8.0, cite: 6, section: 1, lock: true, quote: "of that it finishes here.", onscreen: { title: "27 Feb 2025" }, claim: { id: "k2", verdict: "CORROBORATED", count: 2 }, }, ]; const m = deckManifest(name, title, timeline); m.render.fetchPad = 0; // One counter, as the Huck cut has: the reel strip's staircase steps 1 at c02, 2 more at c04. m.render.chrome = { ...m.render.chrome, factcheck: { verdicts: { CORROBORATED: { label: "Seizures", color: "#6fa8dc" } }, stamp: { seconds: 1 } }, ...(chrome ?? {}) }; // Every clip is locked, and c02's and c04's locked edges sit in the tone: a // locked edge never snaps across a sound (mute.mjs lockedEdges), which would // move every number play-cut.spec.ts reads off this clock. Its cut keeps the // plain snap (`render.lockedEdges: false`); play-engine-fixture below keeps // the rule, and play-engine.spec.ts checks c02 stays at its locked edges. writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify({ ...m, render: { ...m.render, lockedEdges: false } }, null, 2) + "\n"); mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", `${video}_0.00-9.00.mp4`)); // A made take with its own timeline (a JSON merge patch replaces the list). mkdirSync(path.join(dir, "takes", "short"), { recursive: true }); writeFileSync( path.join(dir, "takes", "short", "take.json"), JSON.stringify( { id: "short", group: "takes", order: 1, label: "Short", kind: "different", summary: "c04 first, then c01", preview: "preview.mp4", window: "full", style: null, patch: { timeline: [timeline[4], timeline[0]] }, }, null, 2, ) + "\n", ); copyFileSync(cachedWindow, path.join(dir, "takes", "short", "preview.mp4")); // play-engine.spec.ts's own copy of the cut (no takes): it WRITES (a bench // edge edit), so play-cut.spec.ts's numbers never depend on which ran first. if (name === "play-cut-fixture") { const eng = path.join(reports, "play-engine-fixture"); mkdirSync(path.join(eng, "out", "clips-raw"), { recursive: true }); writeFileSync(path.join(eng, "video.manifest.json"), JSON.stringify({ ...m, slug: "play-engine-fixture", title: "The Play Engine Fixture" }, null, 2) + "\n"); copyFileSync(cachedWindow, path.join(eng, "out", "clips-raw", `${video}_0.00-9.00.mp4`)); } // A SAVED VERSION (lib/report/versions.mjs), play-cut-fixture's own: the cut frozen without c03 and the card, // as `umtool takes save` writes one -- Play ?take=v1 plays its base, never the manifest as it is now. if (name === "play-cut-fixture") { const vdir = path.join(dir, "takes", "v1"); mkdirSync(vdir, { recursive: true }); const baseText = JSON.stringify({ ...m, render: { ...m.render, lockedEdges: false }, timeline: [timeline[0], timeline[1], timeline[4]] }, null, 2) + "\n"; writeFileSync(path.join(vdir, "base.manifest.json"), baseText); writeFileSync( path.join(vdir, "take.json"), JSON.stringify( { id: "v1", group: "takes", order: 2, label: "Saved draft", kind: "reference", summary: "", changes: [], preview: "preview.mp4", seconds: null, builtAt: null, style: null, patch: null, window: "full", version: true, draft: true, draftedAt: "2026-11-09T10:00:00.000Z", savedAt: "2026-11-09T10:00:00.000Z", baseHash: createHash("sha256").update(baseText).digest("hex"), }, null, 2, ) + "\n", ); } // A take only a recipe names: never rendered, still playable. writeFileSync( path.join(dir, "takes", "recipe.json"), JSON.stringify({ takes: [{ id: "quick-joins", label: "Quick joins", patch: { render: { transition: 0 } } }] }, null, 2) + "\n", ); return { dir }; }