Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f8153d3f33282ccf43aa700b7d3378de90731747
parent 99fda5ed1a5920e19219a93c3e84667e2982f4d1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 16:01:09 -0500

umtool e2e: beat reels -- reel-fixture (a take with a synthesized rendered master and its build records, two reels) and reel-play.spec.ts: the reel played from the master beat after beat against the limit, a note on a beat, the walk's nudges/drag saved in source seconds with undo and Confirm, Back to the reel, Cut the trailer as a job with its local path, a new reel, and no master said

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/e2e/fixtures/make-fixture.mjs | 4++++
Aumtool/e2e/fixtures/reel-fixture.mjs | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/e2e/reel-play.spec.ts | 195+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 295 insertions(+), 0 deletions(-)

diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -51,6 +51,7 @@ import { makeMarksFixture } from "./marks-fixture.mjs"; import { makeLivePreviewFixture } from "./live-preview-fixture.mjs"; import { makePlayCutFixture } from "./play-cut-fixture.mjs"; import { makeCutEditingFixture } from "./cut-editing-fixture.mjs"; +import { makeReelFixture } from "./reel-fixture.mjs"; import { makeIntakeFixture } from "./intake-fixture.mjs"; const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song"); @@ -1901,6 +1902,9 @@ makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out // Editing the cut (UI notes 2026-10-30): sections, flash-forward, the trailer's beats, take housekeeping // (cut-sections, cut-flash, trailer-beats and take-housekeeping specs). makeCutEditingFixture({ reports, manifest, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1 }); +// Beat reels (lane/beat-reels): a take with a synthesized rendered master and its build records, +// two reels; and a project whose only take has no master (reel-play.spec.ts). +makeReelFixture({ reports, deckManifest }); // The intake (UI notes 2026-10-30, items 13, 14, 16): the candidates inbox, the source backlog, Add post (intake specs). makeIntakeFixture({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Gaps inside a clip and the bench waveform's zoom (gaps-zoom.spec.ts), which WRITES (gaps cut, diff --git a/umtool/e2e/fixtures/reel-fixture.mjs b/umtool/e2e/fixtures/reel-fixture.mjs @@ -0,0 +1,96 @@ +// BEAT REELS (lane/beat-reels): a project with a take that HAS a rendered +// master, so a reel plays, walks and cuts from it (reel-play.spec.ts). +// +// reel-fixture six clips c01–c06 on vid1 (1.5 s each, 1+2i – 2.5+2i) +// and takes/draft-1, built: its master +// out/reel-fixture.mp4 is SYNTHESIZED (testsrc 320×180, +// 30 fps, a 440 Hz tone, 10.5 s = 315 frames), with the +// build records `umtool trailer` maps through -- +// out/sourced/schedule.json (each clip a 2.0 s segment, +// 0.3 s dissolves: c0k starts at 1.7·(k−1)) and +// segments/<id>.cut.json (each cut from 0.25 s before its +// clip). Two reels: promo/trailer-beats.json (c01 1–2.5, +// c03 5–6.5, c05 9–10.4: 3.8 s with the 0.3 s crossfades, +// every edge clear of the master's own dissolves) +// and promo/teaser-beats.json (c02 alone, titled). +// WRITES promo/ and takes/draft-1/out/ (a cut): the spec +// puts both back before each test. +// reel-none-fixture the same cut, its one take a DRAFT with no master: a +// reel says so and offers the render. +// +// Synthetic, like every fixture. +import { spawnSync } from "node:child_process"; +import { mkdirSync, writeFileSync } from "node:fs"; +import path from "node:path"; + +const json = (doc, indent = 2) => JSON.stringify(doc, null, indent) + "\n"; +const write = (dir, name, text) => { + mkdirSync(path.dirname(path.join(dir, name)), { recursive: true }); + writeFileSync(path.join(dir, name), text); +}; + +export const REEL_SEG = 2.0; +export const REEL_XFADE = 0.3; +export const REEL_TOTAL = 5 * (REEL_SEG - REEL_XFADE) + REEL_SEG; // 10.5 + +const clips = () => + ["c01", "c02", "c03", "c04", "c05", "c06"].map((id, i) => ({ + type: "clip", + id, + video: "vid1", + start: 1 + i * 2, + end: 2.5 + i * 2, + cite: 1 + i * 2, + citeUrl: `https://archive.example/?v=testchan%2Fvid1&t=${1 + i * 2}`, + lock: true, + title: "The Fixture Stream", + date: "2026-10-27", + quote: `the words of ${id}`, + })); + +const take = (id, { draft = false } = {}) => ({ + id, group: "takes", order: 1, label: `${id}: the reel fixture's take`, kind: "reference", summary: "", changes: [], + preview: "preview.mp4", seconds: draft ? null : REEL_TOTAL, builtAt: draft ? null : "2026-11-02T12:00:00.000Z", + style: null, patch: null, window: "full", ...(draft ? { draft: true } : {}), +}); + +/** + * @param {{ reports: string, deckManifest: Function }} o + */ +export function makeReelFixture({ reports, deckManifest }) { + const dir = path.join(reports, "reel-fixture"); + const m = deckManifest("reel-fixture", "The Reel Fixture", clips()); + write(dir, "video.manifest.json", json(m)); + const takeDir = path.join(dir, "takes", "draft-1"); + // The take's own manifest: a small, fast encode for the trailer's one pass. + const tm = { ...m, render: { ...m.render, width: 320, height: 180, fps: 30, crf: 32, preset: "ultrafast", audioBitrate: "64k" } }; + write(takeDir, "video.manifest.json", json(tm)); + write(takeDir, "take.json", json(take("draft-1"))); + const out = path.join(takeDir, "out"); + mkdirSync(path.join(out, "sourced", "segments"), { recursive: true }); + const r = spawnSync("ffmpeg", [ + "-nostdin", "-v", "error", "-y", + "-f", "lavfi", "-i", `testsrc=size=320x180:rate=30:duration=${REEL_TOTAL}`, + "-f", "lavfi", "-i", `sine=frequency=440:duration=${REEL_TOTAL}`, + "-map", "0:v", "-map", "1:a", "-t", String(REEL_TOTAL), + "-c:v", "libx264", "-preset", "ultrafast", "-g", "15", "-pix_fmt", "yuv420p", + "-c:a", "aac", "-ar", "48000", "-ac", "2", "-movflags", "+faststart", + path.join(out, "reel-fixture.mp4"), + ], { encoding: "utf8" }); + if (r.status !== 0) throw new Error(`ffmpeg failed: ${r.stderr || r.status}`); + const segments = clips().map((c, i) => ({ id: c.id, type: "clip", start: Number((i * (REEL_SEG - REEL_XFADE)).toFixed(3)), duration: REEL_SEG })); + write(out, path.join("sourced", "schedule.json"), json({ version: 1, kind: "deck", fps: 30, transition: REEL_XFADE, total: REEL_TOTAL, segments })); + for (const c of clips()) write(out, path.join("sourced", "segments", `${c.id}.cut.json`), json({ version: 1, id: c.id, start: c.start - 0.25, end: c.start - 0.25 + REEL_SEG })); + write(dir, path.join("promo", "trailer-beats.json"), json([ + { id: "c01", start: 1, end: 2.5 }, + { id: "c03", start: 5, end: 6.5 }, + { id: "c05", start: 9, end: 10.4 }, + ], 1)); + write(dir, path.join("promo", "teaser-beats.json"), json({ title: "The teaser", beats: [{ id: "c02", start: 3, end: 4.5 }] })); + + const none = path.join(reports, "reel-none-fixture"); + write(none, "video.manifest.json", json(deckManifest("reel-none-fixture", "The Reel None Fixture", clips()))); + write(path.join(none, "takes", "draft-1"), "take.json", json(take("draft-1", { draft: true }))); + write(none, path.join("promo", "trailer-beats.json"), json([{ id: "c01", start: 1, end: 2.5 }])); + return { dir, none }; +} diff --git a/umtool/e2e/reel-play.spec.ts b/umtool/e2e/reel-play.spec.ts @@ -0,0 +1,195 @@ +import { test, expect, type Page } from "@playwright/test"; +import { copyFileSync, existsSync, readFileSync, readdirSync, rmSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// BEAT REELS (lane/beat-reels): "I want to be able to play and walk the +// trailer the same as main, even if I need to have a rendered main first." +// +// reel-fixture takes/draft-1 with a synthesized rendered master (10.5 s, +// six 2.0 s segments, 0.3 s dissolves) and its build +// records; promo/trailer-beats.json c01 1–2.5, c03 5–6.5, +// c05 9–10.4 (3.8 s); promo/teaser-beats.json c02 alone. +// WRITES promo/, notes.json and a cut in draft-1/out: +// each test starts from the fixture's. +// reel-none-fixture its one take a draft with no master. +// +// The reel's Play (from the master, the crossfade, the clock against the +// limit, a note on a beat), its walk (handles and nudges on the master's +// frames, written in source seconds through the one writer, an undo point per +// write, Confirm walks on, Back to the reel), Cut the trailer as a job with +// the result's local path, and the no-master state. Fixture: +// e2e/fixtures/reel-fixture.mjs. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const DIR = path.join(HERE, "..", ".e2e-song", "reports", "reel-fixture"); +const PROJECT = "reports/reel-fixture"; +const PROMO = path.join(DIR, "promo"); +const OUT = path.join(DIR, "takes", "draft-1", "out"); +const NOTES = path.join(DIR, "notes.json"); + +const beatsOf = (reel = "trailer") => { + const d = JSON.parse(readFileSync(path.join(PROMO, `${reel}-beats.json`), "utf8")); + return (Array.isArray(d) ? d : d.beats) as { id?: string; start?: number; end?: number; verdict?: string }[]; +}; +const root = (page: Page) => page.locator("[data-reel-play]"); + +test.beforeAll(() => { + for (const f of ["trailer-beats.json", "teaser-beats.json"]) { + const p = path.join(PROMO, f); + if (!existsSync(`${p}.pristine`)) copyFileSync(p, `${p}.pristine`); + } +}); +test.beforeEach(() => { + test.setTimeout(120_000); + for (const f of readdirSync(PROMO)) { + if (f.endsWith(".pristine")) copyFileSync(path.join(PROMO, f), path.join(PROMO, f.replace(/\.pristine$/, ""))); + else if (!/^(trailer|teaser)-beats\.json$/.test(f)) rmSync(path.join(PROMO, f), { force: true }); + } + for (const f of readdirSync(OUT)) if (/\.(trailer|teaser)\.(mp4|json)$/.test(f) || f.endsWith(".trailer.json")) rmSync(path.join(OUT, f), { force: true }); + rmSync(NOTES, { force: true }); +}); + +test("the Trailer page lists the reels; a reel plays from the take's rendered master, beat after beat, against the limit; a note lands on its beat", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.trailerHref(PROJECT)); + await expect(page.locator("[data-reel-tab='trailer']")).toContainText("trailer (3)"); + await expect(page.locator("[data-reel-tab='teaser']")).toContainText("teaser — The teaser (1)"); + const panel = page.locator("[data-reel-cut-panel='trailer']"); + await expect(panel).toContainText("(latest master)"); + await expect(panel).toContainText("3 of 3 beats play from it · 0:03.8"); + await panel.locator("[data-reel-play-link]").click(); + + await expect(root(page)).toHaveAttribute("data-reel-take", "draft-1"); + await expect(root(page)).toHaveAttribute("data-reel-state", "paused"); + await expect(page.locator("[data-reel-cell]")).toHaveCount(3); + await expect(page.locator("[data-reel-clock]")).toHaveText("0:00.0 / 0:03.8"); + await expect(page.locator("[data-reel-limit]")).toContainText("limit 2:20.0 · 136.2 s to spare · crossfade 0.3 s"); + await expect(page.locator("[data-reel-master-path]")).toHaveText(path.join(OUT, "reel-fixture.mp4")); + await expect(page.locator("[data-reel-now='1']")).toContainText("beat 1 · c01"); + await expect(page.locator("[data-reel-now='1']")).toContainText("the words of c01"); + + // Plays through: beat 2 (into the crossfade), then 3, and stops at the reel's end. + await page.locator("[data-reel-toggle]").click(); + await expect(root(page)).toHaveAttribute("data-reel-state", "playing"); + await expect(root(page)).toHaveAttribute("data-reel-beat", "2", { timeout: 15_000 }); + await expect(root(page)).toHaveAttribute("data-reel-beat", "3", { timeout: 15_000 }); + await expect(root(page)).toHaveAttribute("data-reel-state", "paused", { timeout: 15_000 }); + expect(Number(await root(page).getAttribute("data-reel-t"))).toBeGreaterThan(3.6); + + // The keys: P back a beat, N on; M a note on the beat on screen. + await page.keyboard.press("p"); + await expect(root(page)).toHaveAttribute("data-reel-beat", "3"); + await page.keyboard.press("p"); + await expect(root(page)).toHaveAttribute("data-reel-beat", "2"); + await page.keyboard.press("m"); + await expect(page.locator("[data-reel-composer]")).toContainText("beat 2 · c03"); + await page.getByTestId("reel-note-input").fill("end it on the word"); + await page.locator("[data-reel-ask='trim']").click(); + await page.getByTestId("reel-note-input").press("Enter"); + await expect(page.locator("[data-reel-note-row]")).toHaveCount(1); + await expect(page.locator("[data-reel-pin]")).toHaveCount(1); + const notes = JSON.parse(readFileSync(NOTES, "utf8")).notes; + expect(notes[0].anchor).toMatchObject({ kind: "reel", reel: "trailer", beat: 2, entry: "c03", take: "draft-1", ask: "trim" }); + expect(notes[0].anchor.sourceT).toBeGreaterThanOrEqual(5); + await page.screenshot({ path: test.info().outputPath("reel-play.png") }); + + // E: the walk on the beat on screen. + await page.keyboard.press("e"); + await expect(page).toHaveURL(/\/trailer\/walk\?take=draft-1&beat=2/); + await expect(page.locator("[data-reel-walk]")).toHaveAttribute("data-reel-beat", "2"); +}); + +test("the walk: in/out on the master's frames, written in source seconds through the one writer; each write an undo point; Confirm walks on; Back to the reel", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.reelWalkHref(PROJECT, { beat: 2 })); + const walk = page.locator("[data-reel-walk]"); + await expect(walk).toHaveAttribute("data-reel-beat", "2"); + await expect(walk).toHaveAttribute("data-reel-dirty", "0"); + await expect(page.locator("[data-reel-source-edges]")).toHaveText("source 0:05.00 – 0:06.50"); + await expect(page.locator("[data-reel-beat-quote]")).toContainText("the words of c03"); + await expect(page.locator("[data-reel-handle]")).toHaveCount(2); + + // ] twice: the in edge 0.1 s later; . with Shift: the out edge 0.5 s later -- held to the clip's cut (6.75). + await page.keyboard.press("]"); + await page.keyboard.press("]"); + await page.keyboard.press("Shift+."); + await expect(walk).toHaveAttribute("data-reel-dirty", "1"); + await expect(page.locator("[data-reel-source-edges]")).toHaveText("source 0:05.10 – 0:06.75"); + await page.keyboard.press("Enter"); + await expect.poll(() => beatsOf()[1]).toEqual({ id: "c03", start: 5.1, end: 6.75 }); + await expect(walk).toHaveAttribute("data-reel-dirty", "0"); + await expect(page.locator("[data-reel-msg]")).toContainText("saved — beat 2 5.1–6.75"); + + // A handle dragged: the in edge back to the segment's start (the clip's cut, 4.75). + const track = await page.locator("[data-reel-track]").boundingBox(); + const h = await page.locator("[data-reel-handle='from']").boundingBox(); + await page.mouse.move(h!.x + h!.width / 2, h!.y + h!.height / 2); + await page.mouse.down(); + await page.mouse.move(track!.x + 2, h!.y + h!.height / 2, { steps: 5 }); + await page.mouse.up(); + await expect(page.locator("[data-reel-source-edges]")).toHaveText("source 0:04.75 – 0:06.75"); + await page.locator("[data-reel-save]").click(); + await expect.poll(() => beatsOf()[1]).toEqual({ id: "c03", start: 4.75, end: 6.75 }); + await page.screenshot({ path: test.info().outputPath("reel-walk.png") }); + + // U: the last write undone, then the one before. + await page.keyboard.press("u"); + await expect.poll(() => beatsOf()[1]).toEqual({ id: "c03", start: 5.1, end: 6.75 }); + await page.locator("[data-reel-undo]").click(); + await expect.poll(() => beatsOf()[1]).toEqual({ id: "c03", start: 5, end: 6.5 }); + await expect(page.locator("[data-reel-source-edges]")).toHaveText("source 0:05.00 – 0:06.50"); + + // Y: confirmed, and on to beat 3; B back to the reel's Play at that beat. + await page.keyboard.press("y"); + await expect(page).toHaveURL(/beat=3/); + await expect.poll(() => beatsOf()[1]).toEqual({ id: "c03", start: 5, end: 6.5, verdict: "confirmed" }); + await expect(page.locator("[data-reel-walk]")).toHaveAttribute("data-reel-beat", "3"); + await page.keyboard.press("b"); + await expect(page).toHaveURL(/\/trailer\/play\?.*beat=3/); + await expect(root(page)).toHaveAttribute("data-reel-beat", "3"); + await expect(page.locator("[data-reel-cell='2']")).toHaveClass(/border-b-2/); + // The beats page says it too. + await page.goto(urls.trailerHref(PROJECT)); + await expect(page.getByTestId("trailer-confirmed")).toHaveText("1 confirmed on the walk"); + await expect(page.locator("[data-beat='2'] [data-beat-verdict='confirmed']")).toHaveCount(1); +}); + +test("Cut the trailer: a job on the runner, its log, the result playing on the page with its local path; a new reel", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + await page.goto(urls.trailerHref(PROJECT, { reel: "teaser" })); + const panel = page.locator("[data-reel-cut-panel='teaser']"); + await expect(panel.locator("[data-reel-cut]")).toBeEnabled(); + await panel.locator("[data-reel-cut]").click(); + await expect(panel.locator("[data-reel-job]")).toBeVisible(); + await expect(panel.locator("[data-reel-job]")).toHaveAttribute("data-reel-job", "done", { timeout: 90_000 }); + await expect(panel.locator("[data-reel-job-log]")).toContainText("trailer reports/reel-fixture --reel teaser --take draft-1"); + const out = path.join(OUT, "reel-fixture.teaser.mp4"); + await expect(panel.locator("[data-reel-result-path]")).toHaveText(out); + expect(existsSync(out)).toBe(true); + expect(existsSync(path.join(OUT, "reel-fixture.teaser.trailer.json"))).toBe(true); + await expect(panel.locator("[data-reel-result-video]")).toHaveAttribute("src", /what=cut&reel=teaser/); + // The trailer reel's file is untouched by the teaser's cut. + expect(existsSync(path.join(OUT, "reel-fixture.trailer.mp4"))).toBe(false); + + // + New reel: a copy of the trailer, its own file, listed. + await page.locator("[data-reel-new-open]").click(); + await page.locator("[data-reel-new-name]").fill("x-first"); + await page.locator("[data-reel-new-from]").selectOption("trailer"); + await page.locator("[data-reel-new-make]").click(); + await expect(page).toHaveURL(/reel=x-first/); + await expect(page.locator("[data-reel-tab='x-first']")).toContainText("x-first (3)"); + expect(beatsOf("x-first").map((b) => b.id)).toEqual(["c01", "c03", "c05"]); +}); + +test("no rendered master: the reel says so and offers the render -- nothing renders from here", async ({ page }) => { + await page.goto(urls.reelPlayHref("reports/reel-none-fixture")); + await expect(page.locator("[data-reel-no-master-why]")).toContainText("no take has a finished master yet"); + await expect(page.locator("[data-reel-render-link]")).toHaveAttribute("href", urls.takesHref("reports/reel-none-fixture")); + await page.goto(urls.trailerHref("reports/reel-none-fixture")); + await expect(page.locator("[data-reel-cut-panel] [data-reel-no-master]")).toContainText("render a take first"); + await expect(page.locator("[data-reel-cut]")).toHaveCount(0); +});