// What take-walk.spec.ts acts on (walk a take): its own project, written by // that spec alone. // // reports/take-walk-fixture/ // video.manifest.json ONE clip, w01 1.00-8.00 (confirmed) -- the master // out/clips-raw/ vid1 0.00-9.00, which holds every take clip below // takes/tight/take.json a DRAFT take (recorded, nothing rendered) whose // patch replaces the timeline with three // sub-windows of w01, as `umtool take … --draft` // writes one: // t01a 1.00-3.00 confirmed (carried from w01) // t01b 3.50-6.00 no verdict -- where the walk starts // t01c 6.20-8.50 no verdict // // take-walk-fixture also has a saved version v1 of the master (base.manifest.json) and the draft pointer // naming it (takes/draft.json). Synthetic, like every fixture. // // `name`/`title`: the same project under another name, for a spec that must // not share it -- play-take-edit-fixture (play-take-edit.spec.ts: Play on the // take, Edit, an edge saved into the take and never the manifest). import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { createHash } from "node:crypto"; import path from "node:path"; const write = (dir, name, text) => { mkdirSync(dir, { recursive: true }); writeFileSync(path.join(dir, name), text); }; const json = (doc) => JSON.stringify(doc, null, 2) + "\n"; /** * @param {{ reports: string, manifest: Function, cachedWindow: string, name?: string, title?: string }} o * `manifest` is make-fixture's manifest(slug, title, provenance, timeline); * `cachedWindow` the vid1 0-9 s window the build fixtures share. */ export function makeTakeWalkFixture({ reports, manifest, cachedWindow, name = "take-walk-fixture", title = "The Take Walk Fixture" }) { const dir = path.join(reports, name); const clip = (id, start, end, extra = {}) => ({ type: "clip", id, video: "vid1", start, end, cite: start, section: 0, lock: true, ...extra }); write( dir, "video.manifest.json", json(manifest(name, title, { siteOrigin: "https://archive.example" }, [ clip("w01", 1.0, 8.0, { verdict: "confirmed", quote: "the whole of it" }), ])), ); mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", path.basename(cachedWindow))); const baseHash = createHash("sha256").update(readFileSync(path.join(dir, "video.manifest.json"), "utf8")).digest("hex"); write( path.join(dir, "takes", "tight"), "take.json", json({ id: "tight", group: "takes", order: 1, label: "Tight — walk", kind: "different", summary: "", changes: ["timeline: 3 items"], preview: "preview.mp4", seconds: null, builtAt: null, style: null, patch: { timeline: [ clip("t01a", 1.0, 3.0, { verdict: "confirmed", quote: "the first of it" }), clip("t01b", 3.5, 6.0, { quote: "the middle of it" }), clip("t01c", 6.2, 8.5, { quote: "the end of it" }), ], }, window: null, draft: true, draftedAt: "2026-10-27T12:00:00.000Z", baseHash, }), ); // A SAVED VERSION of the master (lib/report/versions.mjs), take-walk-fixture's own: its frozen base, and the // draft's parent (takes/draft.json) -- so the draft starts "from v1, no edits". if (name === "take-walk-fixture") { const text = readFileSync(path.join(dir, "video.manifest.json"), "utf8"); write(path.join(dir, "takes", "v1"), "base.manifest.json", text); write( path.join(dir, "takes", "v1"), "take.json", json({ 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, }), ); write(path.join(dir, "takes"), "draft.json", json({ from: "v1", hash: baseHash, at: "2026-11-09T10:00:00.000Z" })); } return dir; }