commit 9c21b371c1c7e4a4255c021db3ba378202d06b52
parent b8a42f1391bfd59f34644291e819b62fe86d13c3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 00:13:09 -0400
umtool e2e: cut-editing fixture and specs (sections, flash-forward, trailer beats, take housekeeping)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
9 files changed, 580 insertions(+), 4 deletions(-)
diff --git a/umtool/e2e/cut-flash.spec.ts b/umtool/e2e/cut-flash.spec.ts
@@ -0,0 +1,132 @@
+import { test, expect, type Page } from "@playwright/test";
+import { copyFileSync, existsSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// The clip editor's edits on the cut (UI notes 2026-10-30, items 2 and 11):
+//
+// cut-flash-fixture the clip editor's three clips r001 r002 r003 on vid1
+// (their words, their windows cached), the deck on with
+// a marker after r001 ("Two"), citeUrls, speakers, r002
+// end-locked; draft-1.patch.json carries the marker.
+// WRITES its manifest, the patch, promo/ and revisions/.
+//
+// Flash-forward selection… copies a span of r002 to the start of the cut with
+// its attribution and locks, as a repeat of r002; "move" takes it out of the
+// clip; Add to trailer writes a beat; a split keeps r001's section boundary.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "cut-flash-fixture");
+const MANIFEST = path.join(DIR, "video.manifest.json");
+const PATCH = path.join(DIR, "draft-1.patch.json");
+const BEATS = path.join(DIR, "promo", "trailer-beats.json");
+const PROJECT = "reports/cut-flash-fixture";
+
+type Clip = Record<string, unknown> & { id: string };
+const read = (file: string) => JSON.parse(readFileSync(file, "utf8"));
+const clips = () => read(MANIFEST).timeline as Clip[];
+const clip = (id: string) => clips().find((c) => c.id === id) ?? null;
+
+test.beforeAll(() => {
+ for (const f of [MANIFEST, PATCH]) if (!existsSync(`${f}.pristine`)) copyFileSync(f, `${f}.pristine`);
+});
+test.beforeEach(() => {
+ for (const f of [MANIFEST, PATCH]) copyFileSync(`${f}.pristine`, f);
+ rmSync(path.join(DIR, "revisions"), { recursive: true, force: true });
+ rmSync(path.join(DIR, "promo"), { recursive: true, force: true });
+ rmSync(path.join(DIR, "montage-rulings.json"), { force: true });
+});
+
+async function openOn(page: Page, id: string) {
+ await page.setViewportSize({ width: 1366, height: 900 });
+ await page.goto(urls.clipEditorHref(PROJECT, { clip: id }));
+ await expect(page.locator("[data-clip-editor]")).toHaveAttribute("data-clip-editor", id);
+ await expect(page.locator("[data-editor-words]")).toHaveAttribute("data-editor-words", "words", { timeout: 15_000 });
+}
+
+/** Drag a selection on the strip from source second `a` to `b`. */
+async function select(page: Page, a: number, b: number) {
+ const strip = page.locator("[data-strip]").first();
+ const [from, to] = String(await strip.getAttribute("data-strip")).split("-").map(Number);
+ const box = (await strip.boundingBox())!;
+ const x = (t: number) => box.x + ((t - from) / (to - from)) * box.width;
+ const y = box.y + box.height * 0.8;
+ await page.mouse.move(x(a), y);
+ await page.mouse.down();
+ await page.mouse.move((x(a) + x(b)) / 2, y, { steps: 4 });
+ await page.mouse.move(x(b), y, { steps: 4 });
+ await page.mouse.up();
+}
+
+test("Flash-forward selection… copies the span earlier with its attribution and locks, as a repeat", async ({ page }) => {
+ test.setTimeout(90_000);
+ await openOn(page, "r002");
+ await expect(page.locator('[data-action="flash-forward"]')).toBeDisabled();
+ await select(page, 4.5, 5.8);
+ await expect(page.locator('[data-action="flash-forward"]')).toBeEnabled();
+ await page.locator('[data-action="flash-forward"]').click();
+ const form = page.getByTestId("flash-forward-form");
+ await expect(form).toBeVisible();
+ // Its default: the start of the section before r002's (§0, the opening).
+ await expect(page.getByTestId("ff-where-section")).toBeChecked();
+ await page.getByTestId("ff-go").click();
+ await expect.poll(() => clips().map((c) => c.id)).toEqual(["r002t", "r001", "r002", "r003"]);
+ const t = clip("r002t")!;
+ expect(t.repeatOf).toBe("r002");
+ expect(t.start).toBeGreaterThanOrEqual(4.4);
+ expect(t.end).toBeLessThanOrEqual(5.9);
+ expect(t.cutStart).toBe(t.start);
+ expect(t.title).toBe("The Fixture Stream");
+ expect(t.date).toBe("2026-10-27");
+ expect(t.speakers).toEqual(["Subject"]);
+ expect(t.lockEnd).toBe(true);
+ expect(String(t.citeUrl)).toMatch(new RegExp(`t=${Math.floor(Number(t.start))}$`));
+ expect(String(t.quote).length).toBeGreaterThan(0);
+ expect(t.quote).not.toBe(clip("r002")!.quote);
+ // The marker stays after r001 (the copy went before it, into §0).
+ expect(read(MANIFEST).render.chrome.deck.markers[0].after).toBe("r001");
+ expect(clip("r002")!.cutStart).toBe(4);
+});
+
+test("move it out: the span leaves the clip, which keeps the rest", async ({ page }) => {
+ test.setTimeout(90_000);
+ await openOn(page, "r003");
+ await select(page, 7.4, 8.5);
+ await page.locator('[data-action="flash-forward"]').click();
+ await page.getByTestId("ff-where-after").check();
+ await page.getByTestId("ff-after").selectOption("");
+ await page.getByTestId("ff-move").check();
+ await page.getByTestId("ff-go").click();
+ await expect.poll(() => clips()[0]?.id).toBe("r003t");
+ expect(clip("r003t")!.repeatOf).toBeUndefined();
+ expect(Number(clip("r003")!.cutEnd)).toBeLessThanOrEqual(7.5);
+ expect(Number(clip("r003")!.cutStart)).toBe(6.5);
+});
+
+test("Add to trailer writes the selection (else the cut) as a beat", async ({ page }) => {
+ test.setTimeout(90_000);
+ await openOn(page, "r002");
+ await page.locator('[data-action="add-to-trailer"]').click();
+ await expect(page.locator("[data-editor-status]")).toContainText("Added to the trailer as beat 1");
+ expect(read(BEATS)).toEqual([{ id: "r002", start: 4, end: 6 }]);
+ await page.keyboard.press("ArrowLeft");
+ await expect(page.locator("[data-clip-editor]")).toHaveAttribute("data-clip-editor", "r001");
+ await select(page, 1.2, 2.6);
+ await page.locator('[data-action="add-to-trailer"]').click();
+ await expect.poll(() => read(BEATS).length).toBe(2);
+ expect(read(BEATS)[0].id).toBe("r001");
+});
+
+test("a split keeps its section: the marker after r001 follows its second half, in the patch too", async ({ page }) => {
+ test.setTimeout(90_000);
+ await openOn(page, "r001");
+ await page.locator('[data-word-t="2.4"]').click();
+ await page.locator('[data-action="split"]').click();
+ await expect.poll(() => clip("r001-2")?.cutStart).toBe(2.4);
+ expect(read(MANIFEST).render.chrome.deck.markers[0].after).toBe("r001-2");
+ expect(read(PATCH).render.chrome.deck.markers[0].after).toBe("r001-2");
+ expect(String(clip("r001-2")!.citeUrl)).toMatch(/t=2$/);
+});
diff --git a/umtool/e2e/cut-sections.spec.ts b/umtool/e2e/cut-sections.spec.ts
@@ -0,0 +1,132 @@
+import { test, expect, type Page } from "@playwright/test";
+import { copyFileSync, existsSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// Sections edited as sections on the Cut tab (UI notes 2026-10-30, item 1):
+//
+// cut-sections-fixture the deck on; §0 c01 c02 | §1 "Two" c03 c04 |
+// §2 "Three" c05 c06; draft-1.patch.json carries the
+// same markers. WRITES its manifest, the patch and
+// revisions/; every test starts from the fixture's.
+//
+// The section bars, "move to section…", "new section here" with a colour, a
+// boundary dragged onto a clip, ticked clips moved together, a boundary
+// removed -- each keeping the take patch's markers in step -- and Undo.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "cut-sections-fixture");
+const MANIFEST = path.join(DIR, "video.manifest.json");
+const PATCH = path.join(DIR, "draft-1.patch.json");
+const PROJECT = "reports/cut-sections-fixture";
+
+type Marker = { after: string; label?: string; color?: string };
+const read = (file: string) => JSON.parse(readFileSync(file, "utf8"));
+const order = () => (read(MANIFEST).timeline as { id: string }[]).map((e) => e.id);
+const afters = () => ((read(MANIFEST).render.chrome.deck.markers ?? []) as Marker[]).map((m) => m.after);
+const patchAfters = () => ((read(PATCH).render.chrome.deck.markers ?? []) as Marker[]).map((m) => m.after);
+
+test.beforeAll(() => {
+ for (const f of [MANIFEST, PATCH]) if (!existsSync(`${f}.pristine`)) copyFileSync(f, `${f}.pristine`);
+});
+test.beforeEach(() => {
+ for (const f of [MANIFEST, PATCH]) copyFileSync(`${f}.pristine`, f);
+ rmSync(path.join(DIR, "revisions"), { recursive: true, force: true });
+});
+
+async function open(page: Page) {
+ await page.goto(urls.section(PROJECT, "timeline"));
+ await expect(page.getByTestId("timeline-undo")).toBeEnabled();
+ await page.waitForLoadState("networkidle");
+}
+
+test("the Cut tab draws a bar where each section opens", async ({ page }) => {
+ await open(page);
+ const bars = page.locator("li[data-section-bar]");
+ await expect(bars).toHaveCount(3);
+ await expect(bars.nth(1)).toContainText("§1");
+ await expect(bars.nth(1)).toContainText("Two");
+ await expect(bars.nth(1)).toContainText("2 clips");
+ // In the list order: the bar for §1 right after c02's row.
+ const seq = await page.locator("[data-testid=timeline-list] > li").evaluateAll((els) => els.map((e) => e.getAttribute("data-entry") ?? `§${e.getAttribute("data-section-bar")}`));
+ expect(seq).toEqual(["§0", "c01", "c02", "§1", "c03", "c04", "§2", "c05", "c06"]);
+});
+
+test("move to section…: the clip lands at the section's end, the markers and the patch follow", async ({ page }) => {
+ await open(page);
+ await page.locator("[data-row-menu='c01']").click();
+ await page.locator("[data-row-action='to-section']").click();
+ await page.getByTestId("to-section-select-c01").selectOption("2");
+ await expect.poll(order).toEqual(["c02", "c03", "c04", "c05", "c06", "c01"]);
+ expect(afters()).toEqual(["c02", "c04"]);
+ expect(patchAfters()).toEqual(["c02", "c04"]);
+ // c04 to §0: the "Three" boundary moves to c03, in the manifest and the patch.
+ await page.locator("[data-row-menu='c04']").click();
+ await page.locator("[data-row-action='to-section']").click();
+ await page.getByTestId("to-section-select-c04").selectOption("0");
+ await expect.poll(order).toEqual(["c02", "c04", "c03", "c05", "c06", "c01"]);
+ expect(afters()).toEqual(["c04", "c03"]);
+ await expect.poll(patchAfters).toEqual(["c04", "c03"]);
+ // Undo puts the last one back.
+ await page.getByTestId("timeline-undo").click();
+ await expect.poll(order).toEqual(["c02", "c03", "c04", "c05", "c06", "c01"]);
+});
+
+test("a section left with no clip is refused in words, nothing written", async ({ page }) => {
+ await open(page);
+ const before = readFileSync(MANIFEST, "utf8");
+ await page.locator("[data-select-clip='c03']").check();
+ await page.locator("[data-select-clip='c04']").check();
+ await expect(page.getByTestId("timeline-bulk")).toContainText("2 selected");
+ await page.getByTestId("timeline-bulk-section").selectOption("0");
+ await page.getByTestId("timeline-bulk-move").click();
+ await expect(page.getByTestId("timeline-error")).toContainText("§1 (Two) would have no clip left");
+ expect(readFileSync(MANIFEST, "utf8")).toBe(before);
+ // Two ticked clips that leave one behind move together.
+ await page.locator("[data-select-clip='c04']").uncheck();
+ await page.locator("[data-select-clip='c06']").check();
+ await page.getByTestId("timeline-bulk-section").selectOption("0");
+ await page.getByTestId("timeline-bulk-move").click();
+ await expect.poll(order).toEqual(["c01", "c02", "c03", "c06", "c04", "c05"]);
+ expect(afters()).toEqual(["c06", "c04"]);
+});
+
+test("new section here, with a label and a colour; edit and remove a boundary", async ({ page }) => {
+ await open(page);
+ await page.locator("[data-row-menu='c05']").click();
+ await page.locator("[data-row-action='new-section']").click();
+ await page.getByTestId("new-section-label-c05").fill("Four");
+ await page.getByTestId("new-section-color-c05").fill("#3366ff");
+ await page.getByTestId("new-section-add-c05").click();
+ await expect.poll(() => read(MANIFEST).render.chrome.deck.markers.length).toBe(3);
+ expect(read(MANIFEST).render.chrome.deck.markers[2]).toEqual({ after: "c05", label: "Four", color: "#3366ff" });
+ expect(read(PATCH).render.chrome.deck.markers[2]).toEqual({ after: "c05", label: "Four", color: "#3366ff" });
+ await expect(page.locator("li[data-section-bar]")).toHaveCount(4);
+ // Edit relabels it.
+ await page.locator("[data-section-edit='2']").click();
+ await page.getByTestId("new-section-label-m2").fill("Four, again");
+ await page.getByTestId("new-section-add-m2").click();
+ await expect.poll(() => read(MANIFEST).render.chrome.deck.markers[2].label).toBe("Four, again");
+ // Remove boundary: §1 joins §0.
+ await page.locator("[data-section-remove='0']").click();
+ await expect.poll(afters).toEqual(["c04", "c05"]);
+ expect(patchAfters()).toEqual(["c04", "c05"]);
+});
+
+test("a section bar dragged onto a clip moves the boundary; a clip dropped on a bar opens that section", async ({ page }) => {
+ await open(page);
+ // The "Three" boundary (marker 1, after c04) dragged onto c03.
+ await page.locator("[data-bar-handle='1']").dragTo(page.locator("li[data-entry='c03'][data-kind]"));
+ await expect.poll(afters).toEqual(["c02", "c03"]);
+ expect(patchAfters()).toEqual(["c02", "c03"]);
+ // Not past its neighbour: onto c01 is refused in words.
+ await page.locator("[data-bar-handle='1']").dragTo(page.locator("li[data-entry='c01'][data-kind]"));
+ await expect(page.getByTestId("timeline-error")).toContainText("would cross or touch");
+ // c06 dropped on §1's bar: the start of §1.
+ await page.locator("[data-drag-handle='c06']").dragTo(page.locator("li[data-section-bar='1']"));
+ await expect.poll(order).toEqual(["c01", "c02", "c06", "c03", "c04", "c05"]);
+ expect(afters()).toEqual(["c02", "c03"]);
+});
diff --git a/umtool/e2e/fixtures/cut-editing-fixture.mjs b/umtool/e2e/fixtures/cut-editing-fixture.mjs
@@ -0,0 +1,113 @@
+// What the cut-editing specs act on (UI notes 2026-10-30, items 1, 2, 11, 19),
+// each its own project, written by its spec alone:
+//
+// cut-sections-fixture the deck on, six clips c01–c06 on vid1 in three
+// sections -- §0 c01 c02 | §1 "Two" c03 c04 | §2
+// "Three" c05 c06 -- and draft-1.patch.json carrying
+// the same markers (in step), so a section edit syncs
+// it (cut-sections.spec.ts)
+// cut-flash-fixture the clip editor's three clips (clip-editor-fixture.mjs,
+// its own copy) with the deck on, a marker after r001
+// and citeUrls -- Flash-forward selection…, Add to
+// trailer, a split that keeps its section (cut-flash.spec.ts)
+// trailer-fixture the deck's six clips with promo/trailer-beats.json:
+// c01 inside its clip, c03 starting 0.5 s before its
+// window, c02 after it (out of the cut's order); c04
+// and c06 starred on the walk (trailer-beats.spec.ts)
+// take-housekeeping-fixture four takes: draft-9, draft-10 (labelled "draft 9:
+// …", the Ember mistake), draft-11, and draft-12 whose
+// build lock names a live pid -- RENDERING
+// (take-housekeeping.spec.ts)
+//
+// Synthetic, like every fixture.
+import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { makeClipEditorFixture } from "./clip-editor-fixture.mjs";
+
+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);
+};
+
+const MARKERS = [
+ { after: "c02", label: "Two", color: "#ff5a5a" },
+ { after: "c04", label: "Three", color: "#4fbf6a" },
+];
+
+const sixClips = () =>
+ ["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}`,
+ }));
+
+/**
+ * @param {{ reports: string, manifest: Function, deckManifest: Function, cachedWindow: string, cues: Array<[number, number, string]> }} o
+ */
+export function makeCutEditingFixture({ reports, manifest, deckManifest, cachedWindow, cues }) {
+ // ---- sections --------------------------------------------------------------
+ const sections = path.join(reports, "cut-sections-fixture");
+ const sm = deckManifest("cut-sections-fixture", "The Cut Sections Fixture", sixClips());
+ sm.render.chrome.deck.markers = MARKERS.map((m) => ({ ...m }));
+ write(sections, "video.manifest.json", json(sm));
+ write(sections, "draft-1.patch.json", json({ render: { chrome: { deck: { markers: MARKERS } } }, title: "The Cut Sections Fixture (draft)" }));
+ mkdirSync(path.join(sections, "out", "clips-raw"), { recursive: true });
+ copyFileSync(cachedWindow, path.join(sections, "out", "clips-raw", "vid1_0.00-9.00.mp4"));
+
+ // ---- flash-forward, Add to trailer, split ----------------------------------
+ const { dir: flash } = makeClipEditorFixture({ reports, manifest, cachedWindow, cues, name: "cut-flash-fixture", title: "The Cut Flash Fixture" });
+ const ff = path.join(flash, "video.manifest.json");
+ const fm = JSON.parse(readFileSync(ff, "utf8"));
+ fm.render = { ...fm.render, width: 1920, height: 1080, chrome: { engine: "hyperframes", layout: "deck", deck: { markers: [{ after: "r001", label: "Two", color: "#ff5a5a" }] } } };
+ delete fm.render.headerHeight;
+ for (const e of fm.timeline) {
+ e.cite = e.cutStart;
+ e.citeUrl = `https://archive.example/?v=testchan%2Fvid1&t=${Math.floor(e.cutStart)}`;
+ e.title = "The Fixture Stream";
+ e.date = "2026-10-27";
+ e.speakers = ["Subject"];
+ }
+ fm.timeline[1].lockEnd = true;
+ writeFileSync(ff, json(fm));
+ write(flash, "draft-1.patch.json", json({ render: { chrome: { deck: { markers: [{ after: "r001", label: "Two", color: "#ff5a5a" }] } } } }));
+
+ // ---- trailer beats -----------------------------------------------------------
+ const trailer = path.join(reports, "trailer-fixture");
+ const tm = deckManifest("trailer-fixture", "The Trailer Fixture", sixClips());
+ tm.render.chrome.deck.markers = MARKERS.map((m) => ({ ...m }));
+ for (const e of tm.timeline) if (e.id === "c04" || e.id === "c06") Object.assign(e, { star: true, walkNote: e.id === "c04" ? "this is gold" : "the ending" });
+ write(trailer, "video.manifest.json", json(tm));
+ // 1-space, as the Ember file was written by hand: a write keeps it.
+ write(trailer, path.join("promo", "trailer-beats.json"), json([
+ { id: "c01", start: 1, end: 2.5 },
+ { id: "c03", start: 4.5, end: 6.5 },
+ { id: "c02", start: 3, end: 4.5 },
+ ], 1));
+
+ // ---- take housekeeping -------------------------------------------------------
+ const takes = path.join(reports, "take-housekeeping-fixture");
+ write(takes, "video.manifest.json", json(deckManifest("take-housekeeping-fixture", "The Take Housekeeping Fixture", sixClips().slice(0, 2))));
+ const take = (id, order, label) => ({
+ id, group: "takes", order, label, kind: "different", summary: "", changes: ["timeline: 2 items"],
+ preview: "preview.mp4", seconds: 4.5, builtAt: `2026-10-${20 + order}T12:00:00.000Z`, style: null, patch: null, window: "full",
+ });
+ for (const [id, order, label] of [
+ ["draft-9", 1, "draft 9: the first walk"],
+ ["draft-10", 2, "draft 9: re-walked (wrong label)"],
+ ["draft-11", 3, "draft 11: tightened"],
+ ["draft-12", 4, "draft 12: rendering"],
+ ]) write(path.join(takes, "takes", id), "take.json", json(take(id, order, label)));
+ // pid 1 is always alive; this host, so the lock reads as a render running now.
+ write(path.join(takes, "takes", "draft-12"), ".building.json", JSON.stringify({ pid: 1, host: os.hostname(), startedAt: "2026-10-31T23:00:00.000Z", take: "draft-12", from: "draft-11" }) + "\n");
+ return { sections, flash, trailer, takes };
+}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -45,6 +45,7 @@ import { makeModulesFixture } from "./modules-fixture.mjs";
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";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -1868,6 +1869,9 @@ makeMarksFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "cl
makeLivePreviewFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
// The Play view: the whole cut (and a take) played with no render, notes at the playhead (play-cut.spec.ts).
makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+// 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 });
// Gaps inside a clip and the bench waveform's zoom (gaps-zoom.spec.ts), which WRITES (gaps cut,
// undone, put back): its own project on gapvid, a recording id of its own (the fixture's vid1
// window -- tone, silences at 2.9-3.1 and 5.9-6.1 -- so nothing another spec fetches moves it).
diff --git a/umtool/e2e/take-housekeeping.spec.ts b/umtool/e2e/take-housekeeping.spec.ts
@@ -0,0 +1,84 @@
+import { test, expect } from "@playwright/test";
+import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// Take housekeeping in the takes list (UI notes 2026-10-30, item 19):
+//
+// take-housekeeping-fixture draft-9, draft-10 (labelled "draft 9: …", the
+// Ember mistake), draft-11, draft-12 RENDERING (its
+// build lock names a live pid, built from draft-11).
+// WRITES take.json labels, verdicts.json, revisions/.
+//
+// Relabel, Mark superseded (folded away, shown dimmed on request), Not
+// superseded -- and a running render respected: draft-12 is not relabelled,
+// neither it nor its base is deleted.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "take-housekeeping-fixture");
+const PROJECT = "reports/take-housekeeping-fixture";
+const takeFile = (id: string) => path.join(DIR, "takes", id, "take.json");
+const label = (id: string) => JSON.parse(readFileSync(takeFile(id), "utf8")).label as string;
+const verdicts = () => (existsSync(path.join(DIR, "takes", "verdicts.json")) ? JSON.parse(readFileSync(path.join(DIR, "takes", "verdicts.json"), "utf8")) : {});
+
+const PRISTINE = new Map<string, string>();
+test.beforeAll(() => {
+ for (const id of ["draft-9", "draft-10", "draft-11", "draft-12"]) PRISTINE.set(id, readFileSync(takeFile(id), "utf8"));
+});
+test.beforeEach(() => {
+ for (const [id, text] of PRISTINE) {
+ writeFileSync(takeFile(id), text);
+ rmSync(path.join(DIR, "takes", id, "revisions"), { recursive: true, force: true });
+ }
+ rmSync(path.join(DIR, "takes", "verdicts.json"), { force: true });
+});
+
+test("relabel a take; a take that is rendering is not relabelled", async ({ page }) => {
+ await page.goto(urls.takesHref(PROJECT));
+ const card = page.locator("[data-take='draft-10']");
+ await expect(card.locator("[data-take-label]")).toContainText("draft 9: re-walked (wrong label)");
+ await card.locator('[data-action="relabel"]').click();
+ await card.locator("[data-take-relabel]").fill("draft 10: re-walked");
+ await card.locator("[data-take-relabel]").press("Enter");
+ await expect.poll(() => label("draft-10")).toBe("draft 10: re-walked");
+ await expect(card.locator("[data-take-label]")).toContainText("draft 10: re-walked");
+ expect(existsSync(path.join(DIR, "takes", "draft-10", "revisions"))).toBe(true);
+
+ const busy = page.locator("[data-take='draft-12']");
+ await busy.locator('[data-action="relabel"]').click();
+ await busy.locator("[data-take-relabel]").fill("draft 12: renamed");
+ await busy.locator('[data-action="relabel-save"]').click();
+ await expect(busy).toContainText("is not relabelled: it is rendering now (pid 1");
+ expect(label("draft-12")).toBe("draft 12: rendering");
+});
+
+test("mark a take superseded: folded away, shown dimmed on request, and back", async ({ page }) => {
+ await page.goto(urls.takesHref(PROJECT));
+ const card = page.locator("[data-take='draft-9']");
+ await card.locator("[data-take-superseded-by='draft-9']").selectOption("draft-11");
+ await card.locator('[data-action="supersede"]').click();
+ await expect.poll(() => verdicts()["draft-9"]?.superseded?.by).toBe("draft-11");
+ await expect(page.locator("[data-take='draft-9']")).toHaveCount(0);
+ await expect(page.locator("[data-superseded-count]")).toContainText("1 superseded take folded away");
+ await page.locator('[data-action="show-superseded"]').click();
+ const shown = page.locator("[data-take='draft-9']");
+ await expect(shown).toHaveAttribute("data-superseded", "draft-11");
+ await expect(shown.locator("[data-take-superseded]")).toHaveText("superseded by draft-11");
+ await shown.locator('[data-action="unsupersede"]').click();
+ await expect.poll(() => verdicts()["draft-9"]).toBeUndefined();
+ await expect(page.locator("[data-take='draft-9']")).not.toHaveAttribute("data-superseded", /.*/);
+});
+
+test("delete refuses a take that is rendering, and the take it is rendered from", async ({ page }) => {
+ await page.goto(urls.takesHref(PROJECT));
+ await page.locator("[data-take='draft-12']").getByRole("button", { name: "Delete take draft-12" }).click();
+ const plan = page.getByRole("region", { name: "delete take draft-12" });
+ await expect(plan).toHaveAttribute("data-delete-blocked", "yes");
+ await expect(plan.getByRole("list", { name: "refused" })).toContainText("take draft-12: it is rendering now");
+ await page.locator("[data-take='draft-11']").getByRole("button", { name: "Delete take draft-11" }).click();
+ await expect(page.getByRole("region", { name: "delete take draft-11" }).getByRole("list", { name: "refused" })).toContainText("take draft-12 is being rendered from it");
+ expect(existsSync(takeFile("draft-12"))).toBe(true);
+});
diff --git a/umtool/e2e/trailer-beats.spec.ts b/umtool/e2e/trailer-beats.spec.ts
@@ -0,0 +1,104 @@
+import { test, expect, type Page } from "@playwright/test";
+import { copyFileSync, existsSync, readFileSync, rmSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// The Trailer page (UI notes 2026-10-30, item 11):
+//
+// trailer-fixture six clips c01–c06 (1.5 s each), c04 and c06 starred on
+// the walk; promo/trailer-beats.json (1-space, an array):
+// c01 inside its clip, c03 starting 0.5 s before its
+// window, c02 after it -- out of the cut's order.
+// WRITES promo/; every test starts from the fixture's.
+//
+// The running length against the limit, the beat outside its clip and "fit
+// to clip", Order by the cut, the platform limit, the ★ candidates, add,
+// move, remove -- each through POST /api/report/trailer-beats.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "trailer-fixture");
+const BEATS = path.join(DIR, "promo", "trailer-beats.json");
+const PROJECT = "reports/trailer-fixture";
+
+const doc = () => JSON.parse(readFileSync(BEATS, "utf8"));
+const beats = () => {
+ const d = doc();
+ return (Array.isArray(d) ? d : d.beats) as { id?: string; start?: number; end?: number }[];
+};
+
+test.beforeAll(() => {
+ if (!existsSync(`${BEATS}.pristine`)) copyFileSync(BEATS, `${BEATS}.pristine`);
+});
+test.beforeEach(() => {
+ copyFileSync(`${BEATS}.pristine`, BEATS);
+ rmSync(`${BEATS}.bak`, { force: true });
+});
+
+async function open(page: Page) {
+ await page.goto(urls.trailerHref(PROJECT));
+ await expect(page.getByTestId("trailer-editor")).toBeVisible();
+}
+
+test("the Cut tab links the Trailer page; it says the running length, the limit and the beat to fix", async ({ page }) => {
+ await page.goto(urls.section(PROJECT, "timeline"));
+ await expect(page.locator("[data-trailer-link]")).toHaveText("Trailer — 3 beats");
+ await page.locator("[data-trailer-link]").click();
+ await expect(page.getByTestId("trailer-editor")).toBeVisible();
+ // 3 × 1.5 s, two 0.3 s crossfades.
+ await expect(page.getByTestId("trailer-total")).toHaveText("0:03.9");
+ await expect(page.getByTestId("trailer-editor")).toContainText("of 2:20.0");
+ await expect(page.getByTestId("trailer-outside")).toHaveText("1 beat to fix");
+ await expect(page.locator("[data-beat-problems='2']")).toHaveText("starts 0.50 s before c03's window (5–6.5)");
+ await expect(page.getByTestId("trailer-order")).toHaveText("Order by the cut");
+});
+
+test("fit to clip pulls the beat inside; Order by the cut; the file keeps its shape", async ({ page }) => {
+ await open(page);
+ await page.locator("[data-beat-fit='2']").click();
+ await expect.poll(() => beats()[1]).toEqual({ id: "c03", start: 5, end: 6.5 });
+ await expect(page.getByTestId("trailer-outside")).toHaveCount(0);
+ await page.getByTestId("trailer-order").click();
+ await expect.poll(() => beats().map((b) => b.id)).toEqual(["c01", "c02", "c03"]);
+ await expect(page.getByTestId("trailer-order")).toHaveText("in the cut's order");
+ expect(readFileSync(BEATS, "utf8")).toMatch(/^\[\n \{/);
+});
+
+test("the platform's limit, and the ★ clips added in the cut's order until it is over", async ({ page }) => {
+ await open(page);
+ await expect(page.getByTestId("trailer-candidates")).toContainText("2 not yet beats");
+ await expect(page.locator("[data-candidate='c04']")).toContainText("this is gold");
+ await page.getByTestId("trailer-limit").selectOption("instagram");
+ await expect.poll(() => doc().limit).toBe(90);
+ await expect(page.getByTestId("trailer-editor")).toContainText("of 1:30.0");
+ await page.getByTestId("trailer-limit-seconds").fill("6");
+ await page.getByTestId("trailer-limit-seconds").press("Enter");
+ await expect.poll(() => doc().limit).toBe(6);
+ // c04 plays after every clip beat so far: it goes last (the cut's order).
+ await page.locator("[data-candidate='c04'] button").click();
+ await expect.poll(() => beats().map((b) => b.id)).toEqual(["c01", "c03", "c02", "c04"]);
+ await expect(page.getByTestId("trailer-total")).toHaveAttribute("data-over", "0");
+ await page.locator("[data-candidate='c06'] button").click();
+ await expect.poll(() => beats().length).toBe(5);
+ await expect(page.getByTestId("trailer-total")).toHaveAttribute("data-over", "1");
+ await expect(page.locator("[data-beat='5']")).toHaveAttribute("data-beat-over", "1");
+ await expect(page.getByTestId("trailer-candidates")).toContainText("0 not yet beats");
+});
+
+test("add a beat from a clip, edit its seconds, move it and remove it", async ({ page }) => {
+ await open(page);
+ await page.getByTestId("trailer-add-clip").selectOption("c05");
+ await expect(page.getByTestId("trailer-add-from")).toHaveValue("9");
+ await page.getByTestId("trailer-add-to").fill("10.25");
+ await page.getByTestId("trailer-add").click();
+ await expect.poll(() => beats().map((b) => b.id)).toEqual(["c01", "c03", "c02", "c05"]);
+ await page.locator("[data-beat-to='4']").fill("10.5");
+ await page.locator("[data-beat-to='4']").press("Enter");
+ await expect.poll(() => beats()[3].end).toBe(10.5);
+ await page.locator("[data-beat-up='4']").click();
+ await expect.poll(() => beats().map((b) => b.id)).toEqual(["c01", "c03", "c05", "c02"]);
+ await page.locator("[data-beat-remove='1']").click();
+ await expect.poll(() => beats().map((b) => b.id)).toEqual(["c03", "c05", "c02"]);
+});
diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs
@@ -2369,7 +2369,7 @@ export function flashForwardIn(m, clipId, spec) {
m.timeline.splice(at, 0, copy);
let section = null;
if (spec.section !== undefined && spec.section !== null && spec.section !== "") {
- const r = moveToSectionIn(m, [copy.id], Number(spec.section), { position: spec.position === "start" ? "start" : "end" });
+ const r = moveToSectionIn(m, [copy.id], Number(spec.section), { position: spec.position === "start" ? "start" : "end", allowNoop: true });
section = { index: r.section, label: r.label, reanchored: r.reanchored };
at = m.timeline.findIndex((x) => x === copy);
}
diff --git a/umtool/lib/report/sectionEdit.mjs b/umtool/lib/report/sectionEdit.mjs
@@ -147,9 +147,9 @@ function reanchorMarkers(m, model, membership) {
* @param {Record<string, any>} m
* @param {string[]} ids
* @param {number} target
- * @param {{ position?: "start" | "end" }} [opts]
+ * @param {{ position?: "start" | "end", allowNoop?: boolean }} [opts] `allowNoop`: a clip already there is no refusal
*/
-export function moveToSectionIn(m, ids, target, { position = "end" } = {}) {
+export function moveToSectionIn(m, ids, target, { position = "end", allowNoop = false } = {}) {
const model = sectionModel(m);
if (deckMarkers(m) === null) needDeck(m);
const t = Number(target);
@@ -186,7 +186,7 @@ export function moveToSectionIn(m, ids, target, { position = "end" } = {}) {
m.timeline.splice(0, m.timeline.length, ...rest);
const reanchored = reanchorMarkers(m, model, membership);
const changed = before !== m.timeline.map((e) => e?.id).join("\n");
- if (!changed && !reanchored.length) throw new Error(`${want.join(", ")} already ${want.length === 1 ? "stands" : "stand"} at the ${position} of ${sectionWords(model.sections[t])}`);
+ if (!changed && !reanchored.length && !allowNoop) throw new Error(`${want.join(", ")} already ${want.length === 1 ? "stands" : "stand"} at the ${position} of ${sectionWords(model.sections[t])}`);
return {
ids: moved.map((e) => e.id),
section: t,
diff --git a/umtool/lib/report/sectionEdit.test.mjs b/umtool/lib/report/sectionEdit.test.mjs
@@ -264,3 +264,10 @@ test("flashForward writes once, with an undo point", async () => {
await rm(dir, { recursive: true, force: true });
}
});
+
+test("flash-forward to the start of §0 when the copy already lands there", () => {
+ const m = deckCut();
+ const r = flashForwardIn(m, "c", { from: 51, to: 55, section: 0, position: "start" });
+ assert.deepEqual(ids(m).slice(0, 2), ["ct", "a"]);
+ assert.equal(r.section.index, 0);
+});