commit 5944146d996028b5c3ee62f593cdf07eab59917a
parent 03b34e2724e0a5a2d7f54f58713c7b46c37ca75a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 19:41:14 -0500
umtool: inspector-*.spec.ts and their fixtures -- one spec per panel, the UI path with no agent (redesign L6)
inspector-provenance, -title, -teaser-insert, -ledger, -post-item, -rumble-cite, -still: each drives its
panel from the Cut tab (Play for the still), asserts the draft manifest (or shots/) changed as said and
that the project's take.json did not, and that a write is one undo step. inspector-fixture.mjs: one
writable project per panel. The ledger panel recomputes a row's display when its value changes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
10 files changed, 668 insertions(+), 0 deletions(-)
diff --git a/umtool/components/projects/inspector/LedgerInspector.tsx b/umtool/components/projects/inspector/LedgerInspector.tsx
@@ -104,6 +104,8 @@ export default function LedgerInspector({ project, block = null }: InspectorProp
if (now === "" && !REQUIRED.has(k)) unset.push(k);
else patch[k] = now;
}
+ // A new value (or form, or event) is drawn by its own words again: the display is recomputed from it.
+ if (["value", "population", "event", "scope"].some((k) => k in patch || unset.includes(k))) unset.push("display");
if (!Object.keys(patch).length && !unset.length) {
setSaid({ ok: true, text: "Nothing changed." });
return;
diff --git a/umtool/e2e/fixtures/inspector-fixture.mjs b/umtool/e2e/fixtures/inspector-fixture.mjs
@@ -0,0 +1,129 @@
+// THE INSPECTOR PANELS (umtool redesign L6; e2e/inspector-*.spec.ts): one WRITABLE project per panel, each
+// play-cut-fixture's cut (c01 c02 k01 c03 c04 on playvid, its window cached in out/clips-raw) unless said, each
+// with a made take (takes/short/take.json) the specs check is never written -- every UI edit lands in the draft.
+//
+// inspector-provenance-fixture provenance with no channelSlug (the gap `umtool new` leaves) and an old origin
+// inspector-title-fixture the title, a subtitle
+// inspector-teaser-fixture no teaser yet
+// inspector-ledger-fixture a MEASURE ledger (one value track, one regime track) with two rows, w01 pinned to c01
+// inspector-post-fixture two post items -- p-long (a long text post, an excerpt picked by selection) and
+// p-vid (a video with sound, and a picture of the post it does not carry) -- from
+// post-items-fixture's archive files
+// inspector-rumble-fixture three Rumble clips on inspectrumble, two naming a URL-slug FOLDER the archive does not
+// serve (v7slug1 -> v7emb01, v7slug2 -> v7emb02, in the project's .shadow-channels),
+// one its own; out/links.json records both folder links dead
+// inspector-still-fixture the cut alone (Play's Still button)
+//
+// Synthetic, like every fixture.
+import { spawnSync } from "node:child_process";
+import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+const TAKE = (dir) => JSON.parse(readFileSync(path.join(dir, "takes", "short", "take.json"), "utf8"));
+
+/**
+ * @param {{ reports: string, channels: string, deckManifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o
+ */
+export async function makeInspectorFixtures({ reports, channels, deckManifest, cachedWindow, makePlayCutFixture }) {
+ const cut = (name, title, edit = (m) => m) => {
+ const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name, title });
+ const file = path.join(dir, "video.manifest.json");
+ const m = edit(JSON.parse(readFileSync(file, "utf8")));
+ writeFileSync(file, JSON.stringify(m, null, 2) + "\n");
+ TAKE(dir); // the take is there to be left alone
+ return dir;
+ };
+
+ cut("inspector-provenance-fixture", "The Inspector Provenance Fixture", (m) => ({ ...m, provenance: { siteOrigin: "https://old.example" } }));
+ cut("inspector-title-fixture", "The Inspector Title Fixture", (m) => ({ ...m, subtitle: "an old subtitle" }));
+ cut("inspector-teaser-fixture", "The Inspector Teaser Fixture");
+ cut("inspector-still-fixture", "The Inspector Still Fixture");
+ cut("inspector-ledger-fixture", "The Inspector Ledger Fixture", (m) => ({
+ ...m,
+ ledgerSchema: {
+ kind: "measure", unit: "lb", yLabel: "POUNDS", yMin: 200, yMax: 400,
+ tracks: [
+ { key: "weight", role: "value", label: "What he says he weighs" },
+ { key: "regime", role: "regime", label: "The diet he names", regimes: ["keto", "off"] },
+ ],
+ forms: ["current", "past", "delta", "status"],
+ regimes: [{ key: "keto", label: "Keto" }, { key: "off", label: "No diet" }],
+ fields: [],
+ },
+ ledger: [
+ { id: "w01", date: "2026-10-01", asOf: null, scope: "weight", population: "current", value: 291, display: "291 lb", label: "on the scale", scopeBasis: "his words: I weigh 291", scopeConfidence: "read", valueKind: "uttered", flags: [], entryId: "c01", channel: "inspchan", video: "playvid", cite: 1 },
+ { id: "d01", date: "2026-09-01", asOf: null, scope: "regime", population: "status", value: "keto", event: "start", display: "keto", label: "starts keto", scopeBasis: "I'm doing keto", scopeConfidence: "read", valueKind: "uttered", flags: [] },
+ ],
+ }));
+
+ // ---- post items --------------------------------------------------------------------------------------------
+ {
+ const name = "inspector-post-fixture";
+ const dir = path.join(reports, name);
+ const media = path.join(dir, "posts-media", "postchan-x", "3");
+ mkdirSync(media, { recursive: true });
+ mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true });
+ copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", "playvid_0.00-9.00.mp4"));
+ const cap = path.join(channels, "postchan-x", "posts-media");
+ copyFileSync(path.join(cap, "3", "3_1.mp4"), path.join(media, "3_1.mp4"));
+ copyFileSync(path.join(cap, "2", "2_1.png"), path.join(media, "3_2.png"));
+ const base = (id, text, o = {}) => ({
+ type: "post", id, post: `postchan-x/${id.slice(2)}`, platform: "x", author: "Post Subject", handle: "postsubject",
+ date: "2026-10-30T12:00:00.000Z", text, url: `https://x.com/postsubject/status/${id.slice(2)}`, subjects: ["postsubject"], ...o,
+ });
+ const timeline = [
+ { type: "clip", id: "c01", video: "playvid", start: 1.0, end: 3.0, cite: 1, section: 0, lock: true, quote: "This is a complete sentence." },
+ base("p-5", "The scale said 291 this morning. I said the scale was broken, and then the scale said 290 by the evening. Nobody believes the scale anyway."),
+ base("p-3", "@someone_private Yes, and here is the video.", { media: [{ src: "posts-media/postchan-x/3/3_1.mp4", kind: "video", seconds: 4, width: 320, height: 180, audio: true }] }),
+ ];
+ const m = deckManifest(name, "The Inspector Post Fixture", timeline);
+ m.provenance = { ...m.provenance, channelSlug: "postchan-x" };
+ m.render.fetchPad = 0;
+ m.render.lockedEdges = false;
+ writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify(m, null, 2) + "\n");
+ // "Use my recording"'s file: a second and a half of a tone with silence either side (the trim keeps the tone).
+ const wav = path.join(path.dirname(reports), "inspector-recording.wav");
+ const ff = spawnSync("ffmpeg", ["-nostdin", "-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=330:duration=1.5", "-af", "adelay=400|400,apad=pad_dur=0.4", "-ar", "48000", "-ac", "1", wav], { encoding: "utf8" });
+ if (ff.status !== 0) throw new Error(`ffmpeg failed: ${ff.stderr}`);
+ 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", preview: "preview.mp4", window: "full", style: null, patch: { timeline: [timeline[1]] } }, null, 2) + "\n");
+ }
+
+ // ---- Rumble clips naming the URL-slug folder ---------------------------------------------------------------
+ {
+ const dir = cut("inspector-rumble-fixture", "The Inspector Rumble Fixture", (m) => ({
+ ...m,
+ provenance: { siteOrigin: "https://archive.example", channelSlug: "inspectrumble", channelsFallback: false },
+ timeline: [
+ { type: "clip", id: "r01", video: "v7slug1", start: 1.0, end: 3.0, cite: 1, section: 0, lock: true, quote: "the first" },
+ { type: "clip", id: "r02", video: "v7slug2", start: 3.5, end: 5.5, cite: 4, section: 0, lock: true, quote: "the second" },
+ { type: "clip", id: "r03", video: "v7own03", start: 6.0, end: 8.0, cite: 6, section: 0, lock: true, quote: "its own id" },
+ ],
+ }));
+ const ch = path.join(dir, ".shadow-channels", "inspectrumble");
+ writeFileSync(path.join(mkdirP(ch), "config.json"), JSON.stringify({ platform: "rumble", handling: "transcribe", url: "https://rumble.com/c/inspectrumble", name: "Inspect Rumble" }, null, 2));
+ for (const [folder, id] of [["v7slug1", "v7emb01"], ["v7slug2", "v7emb02"], ["v7own03", "v7own03"]]) {
+ writeFileSync(path.join(mkdirP(path.join(ch, "data", folder)), "metadata.info.json"), JSON.stringify({ id, extractor: "Rumble", webpage_url: `https://rumble.com/${folder}-a-title.html`, title: `Recording ${folder}` }));
+ }
+ // The last link check: both folder links dead (the archive serves the embed ids), the own id open -- each
+ // QR's link as the build draws it (linkCheck.mjs linksOf), so the panel reads them against the cut as it is.
+ const { linksOf, withArchiveId } = await import("../../lib/report/linkCheck.mjs");
+ const m = JSON.parse(readFileSync(path.join(dir, "video.manifest.json"), "utf8"));
+ const embed = { r01: ["v7slug1", "v7emb01"], r02: ["v7slug2", "v7emb02"] };
+ writeFileSync(path.join(mkdirP(path.join(dir, "out")), "links.json"), JSON.stringify({
+ version: 1, checkedAt: "2026-11-08T10:00:00.000Z", fetched: 3,
+ origins: { "https://archive.example": { state: "ok", generatedAt: "2026-11-07T10:00:00.000Z", title: "Archive" } },
+ links: linksOf(m).map((l) => {
+ const e = embed[l.clip];
+ return e
+ ? { clip: l.clip, url: l.url, state: "dead", origin: "https://archive.example", why: `no record ${e[0]}`, fix: withArchiveId(l.url, e[0], e[1]), fixSiteVideo: e[1] }
+ : { clip: l.clip, url: l.url, state: "ok", origin: "https://archive.example" };
+ }),
+ }, null, 2) + "\n");
+ }
+}
+
+function mkdirP(d) {
+ mkdirSync(d, { recursive: true });
+ return d;
+}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -67,6 +67,7 @@ import { makePostComboFixture } from "./post-combo-fixture.mjs";
import { makeMediaScenesFixture } from "./media-scenes-fixture.mjs";
import { makeInstrumentsFixture } from "./instruments-fixture.mjs";
import { makeIntroPlayFixture } from "./intro-play-fixture.mjs";
+import { makeInspectorFixtures } from "./inspector-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"));
@@ -2144,6 +2145,10 @@ makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out
rmSync(path.join(dvDir, "takes"), { recursive: true, force: true });
}
+// The inspector panels (inspector-*.spec.ts, umtool redesign L6, WRITE): one project per panel
+// (inspector-fixture.mjs), each with a take the specs check is never written.
+await makeInspectorFixtures({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
+
// One undo stack (undo.spec.ts, WRITES): two trims a moment apart, then two undos -- its own copy.
{
const { dir: unDir } = makePlayCutFixture({
diff --git a/umtool/e2e/inspector-ledger.spec.ts b/umtool/e2e/inspector-ledger.spec.ts
@@ -0,0 +1,91 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { openPanel } from "./panels";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE LEDGER PANEL (umtool redesign L6, item 3; components/projects/inspector/LedgerInspector.tsx and the new
+// /api/report/ledger): a measure ledger's rows -- date, scope, value, basis, source -- added, changed and removed
+// from the Cut tab's Project panel through the ledger CLI's own checks (`umtool ledger <p> add|set|rm`), each in
+// the draft with its undo point, no take touched. inspector-ledger-fixture (WRITES): w01 (weight, pinned to c01),
+// d01 (keto, a regime row).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/inspector-ledger-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-ledger-fixture");
+type Row = Record<string, unknown> & { id: string };
+const manifestText = () => readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+const ledger = () => (JSON.parse(manifestText()) as { ledger: Row[] }).ledger;
+const row = (id: string) => ledger().find((r) => r.id === id);
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+test("add a row (date, scope, value, basis, source), refused without its basis; change one; remove one", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="ledger"]');
+ await expect(panel.locator("[data-ledger-row]")).toHaveCount(2);
+ await expect(panel.locator('[data-ledger-row="w01"]')).toContainText("291 lb");
+
+ // A new row with no basis: the writer's sentence, nothing written.
+ await panel.locator("[data-ledger-add]").click();
+ const ed = panel.locator('[data-ledger-editor="new"]');
+ await ed.locator('[data-ledger-field="id"]').fill("w02");
+ await ed.locator('[data-ledger-field="date"]').fill("2026-11-01");
+ await ed.locator('[data-ledger-field="scope"]').selectOption("weight");
+ await ed.locator('[data-ledger-field="population"]').selectOption("current");
+ await ed.locator('[data-ledger-field="value"]').fill("288");
+ const before = manifestText();
+ await ed.locator('[data-ledger-save="new"]').click();
+ await expect(panel.locator('[data-ledger-said="refused"]')).toContainText("scopeBasis");
+ expect(manifestText()).toBe(before);
+
+ await ed.locator('[data-ledger-field="scopeBasis"]').fill("his words: down to 288");
+ await ed.locator('[data-ledger-field="channel"]').fill("inspchan");
+ await ed.locator('[data-ledger-field="video"]').fill("playvid");
+ await ed.locator('[data-ledger-field="cite"]').fill("2");
+ await ed.locator('[data-ledger-field="src"]').fill("A weigh-in @ 0:02");
+ await page.screenshot({ path: test.info().outputPath("ledger-add.png") });
+ await ed.locator('[data-ledger-save="new"]').click();
+ await expect(panel.locator('[data-ledger-said="ok"]')).toContainText("Added w02: 288 lb");
+ expect(row("w02")).toMatchObject({ id: "w02", date: "2026-11-01", scope: "weight", population: "current", value: 288, display: "288 lb", scopeBasis: "his words: down to 288", channel: "inspchan", video: "playvid", cite: 2, src: "A weigh-in @ 0:02", scopeConfidence: "read", valueKind: "uttered" });
+
+ // Change w01's value: its display is drawn from the new value; a cleared label is removed.
+ await panel.locator('[data-ledger-edit="w01"]').click();
+ const e1 = panel.locator('[data-ledger-editor="w01"]');
+ await expect(e1.locator('[data-ledger-field="value"]')).toHaveValue("291");
+ await e1.locator('[data-ledger-field="value"]').fill("290");
+ await e1.locator('[data-ledger-field="label"]').fill("");
+ await e1.locator('[data-ledger-save="w01"]').click();
+ await expect(panel.locator('[data-ledger-said="ok"]')).toContainText("Saved w01");
+ expect(row("w01")).toMatchObject({ value: 290, display: "290 lb", entryId: "c01" });
+ expect(row("w01")?.label).toBeUndefined();
+
+ // A regime row: its value a regime, its event.
+ await panel.locator('[data-ledger-edit="d01"]').click();
+ const e2 = panel.locator('[data-ledger-editor="d01"]');
+ await expect(e2.locator('[data-ledger-field="value"]')).toHaveValue("keto");
+ await e2.locator('[data-ledger-field="event"]').selectOption("stop");
+ await e2.locator('[data-ledger-save="d01"]').click();
+ await expect(panel.locator('[data-ledger-said="ok"]')).toContainText("Saved d01");
+ expect(row("d01")?.event).toBe("stop");
+
+ await panel.locator('[data-ledger-edit="d01"]').click();
+ await panel.locator('[data-ledger-remove="d01"]').click();
+ await expect(panel.locator('[data-ledger-said="ok"]')).toContainText("Removed d01");
+ expect(row("d01")).toBeUndefined();
+ await expect(panel.locator("[data-ledger-row]")).toHaveCount(2);
+ expect(takeText()).toBe(take);
+});
+
+test("each ledger write is one undo step", async ({ request }) => {
+ const r = await request.post("/api/report/timeline", { data: { project: P, op: "undo" } });
+ expect(r.ok(), await r.text()).toBe(true);
+ expect((await r.json()).op).toBe("ledger");
+ expect(row("d01")).toMatchObject({ event: "stop" });
+});
diff --git a/umtool/e2e/inspector-post-item.spec.ts b/umtool/e2e/inspector-post-item.spec.ts
@@ -0,0 +1,139 @@
+import { test, expect, type Page } from "@playwright/test";
+import { existsSync, readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE POST ITEM PANEL (umtool redesign L6, item 4; components/projects/inspector/PostItemInspector.tsx): a post
+// row's Edit on the Cut tab -- the EXCERPT picked by selecting the post's words (snapped to words, settled where
+// the build finds each span; was `posts set-item excerpt=…`), its MEDIA on/off and a video's sound, and "Use my
+// recording" (a sound file kept as a recorded take and picked; was `posts narrate --recording`). Every write
+// lands in the draft; no take touched. inspector-post-fixture (WRITES): p-5 (a long text post), p-3 (a video with
+// sound, and a picture of the post it does not carry).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/inspector-post-fixture";
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const DIR = path.join(HERE, ".e2e-song", "reports", "inspector-post-fixture");
+type Post = Record<string, unknown> & { id: string; excerpt?: string[]; media?: Record<string, unknown>[]; narration?: { takes?: { file: string; engine?: string }[]; pick?: number } };
+const item = (id: string) => (JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")) as { timeline: Post[] }).timeline.find((e) => e.id === id) as Post;
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+/** Select the `nth` occurrence of `needle` in the element's text, as a person dragging over it would. */
+async function selectText(page: Page, selector: string, needle: string, nth = 0) {
+ await page.evaluate(
+ ({ selector, needle, nth }) => {
+ const root = document.querySelector(selector) as HTMLElement;
+ const full = root.textContent ?? "";
+ let at = -1;
+ for (let i = 0; i <= nth; i++) at = full.indexOf(needle, at + 1);
+ if (at < 0) throw new Error(`no "${needle}" in the post's text`);
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
+ let pos = 0;
+ let sN: Node | null = null;
+ let sO = 0;
+ let eN: Node | null = null;
+ let eO = 0;
+ for (let n = walker.nextNode(); n; n = walker.nextNode()) {
+ const len = (n.textContent ?? "").length;
+ if (!sN && at < pos + len) {
+ sN = n;
+ sO = at - pos;
+ }
+ if (sN && at + needle.length <= pos + len) {
+ eN = n;
+ eO = at + needle.length - pos;
+ break;
+ }
+ pos += len;
+ }
+ const r = document.createRange();
+ r.setStart(sN as Node, sO);
+ r.setEnd(eN as Node, eO);
+ const sel = window.getSelection() as Selection;
+ sel.removeAllRanges();
+ sel.addRange(r);
+ },
+ { selector, needle, nth },
+ );
+}
+
+test("the excerpt, picked by selecting the post's words: a span whose words come earlier too is widened to where it was picked", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ const row = page.locator('[data-entry="p-5"]');
+ await row.locator("[data-post-edit]").click();
+ const panel = row.locator('[data-inspector="post-item"]');
+ await expect(panel.locator("[data-post-text]")).toContainText("The scale said 291 this morning.");
+ // "scale said" is said twice: the second one, picked, is read as "the scale said" so the build finds it there.
+ await selectText(page, '[data-entry="p-5"] [data-post-text]', "scale said", 1);
+ await panel.locator("[data-excerpt-add]").click();
+ await selectText(page, '[data-entry="p-5"] [data-post-text]', "obody believ");
+ await panel.locator("[data-excerpt-add]").click();
+ await expect(panel.locator("[data-excerpt-span]")).toHaveCount(2);
+ await expect(panel.locator('[data-excerpt-span="0"]')).toContainText("“the scale said”");
+ await expect(panel.locator('[data-excerpt-span="1"]')).toContainText("“Nobody believes”");
+ await page.screenshot({ path: test.info().outputPath("post-excerpt.png") });
+ await panel.locator("[data-excerpt-save]").click();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("Excerpt saved to the draft: 2 spans");
+ expect(item("p-5").excerpt).toEqual(["the scale said", "Nobody believes"]);
+ await expect(panel.locator("[data-excerpt-piece]")).toHaveCount(2);
+
+ // Removing a span and saving keeps the other; Clear and save reads it whole.
+ await panel.locator('[data-excerpt-span-remove="1"]').click();
+ await panel.locator("[data-excerpt-save]").click();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("1 span");
+ expect(item("p-5").excerpt).toEqual(["the scale said"]);
+ expect(takeText()).toBe(take);
+});
+
+test("media on/off and a video's sound", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ const row = page.locator('[data-entry="p-3"]');
+ await row.locator("[data-post-edit]").click();
+ const panel = row.locator('[data-inspector="post-item"]');
+ await expect(panel.locator('[data-post-media="0"]')).toContainText("3_1.mp4");
+ await expect(panel.locator('[data-post-file="posts-media/postchan-x/3/3_2.png"]')).toBeVisible();
+
+ await panel.locator('[data-post-media="0"] [data-post-media-sound]').uncheck();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("Sound off.");
+ expect(item("p-3").media?.[0]).toMatchObject({ src: "posts-media/postchan-x/3/3_1.mp4", mute: true });
+
+ // The picture of the post it did not carry, put on; then the video taken off (its file kept, offered again).
+ await panel.locator('[data-post-file="posts-media/postchan-x/3/3_2.png"] [data-post-file-shown]').check();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("3_2.png: on the item.");
+ expect(item("p-3").media?.map((m) => [m.src, m.kind])).toEqual([["posts-media/postchan-x/3/3_1.mp4", "video"], ["posts-media/postchan-x/3/3_2.png", "image"]]);
+ await panel.locator('[data-post-media="0"] [data-post-media-shown]').uncheck();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("off the item");
+ expect(item("p-3").media?.map((m) => m.src)).toEqual(["posts-media/postchan-x/3/3_2.png"]);
+ await expect(panel.locator('[data-post-file="posts-media/postchan-x/3/3_1.mp4"]')).toBeVisible();
+ expect(existsSync(path.join(DIR, "posts-media", "postchan-x", "3", "3_1.mp4"))).toBe(true);
+ expect(takeText()).toBe(take);
+});
+
+test("Use my recording: a sound file kept as a recorded take of the item and picked", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ expect(item("p-5").narration).toBeUndefined();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ const row = page.locator('[data-entry="p-5"]');
+ await row.locator("[data-post-edit]").click();
+ const panel = row.locator('[data-inspector="post-item"]');
+ await expect(panel.locator("[data-post-takes]")).toContainText("not narrated yet");
+ await panel.locator("[data-post-recording-file]").setInputFiles(path.join(HERE, ".e2e-song", "inspector-recording.wav"));
+ await panel.locator("[data-post-recording-use]").click();
+ await expect(panel.locator('[data-post-said="ok"]')).toContainText("Kept as", { timeout: 30_000 });
+ const n = item("p-5").narration;
+ expect(n?.takes).toHaveLength(1);
+ expect(n?.takes?.[0].file).toMatch(/take-1\.recorded-operator\.wav$/);
+ expect(existsSync(path.join(DIR, ...String(n?.takes?.[0].file).split("/")))).toBe(true);
+ await expect(panel.locator("[data-post-takes]")).toContainText("1 take; plays take-1.recorded-operator.wav");
+ await page.screenshot({ path: test.info().outputPath("post-recording.png") });
+ expect(takeText()).toBe(take);
+});
diff --git a/umtool/e2e/inspector-provenance.spec.ts b/umtool/e2e/inspector-provenance.spec.ts
@@ -0,0 +1,67 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync, readdirSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { openPanel } from "./panels";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE PROVENANCE PANEL (umtool redesign L6, item 1; components/projects/inspector/ProvenanceInspector.tsx): the
+// Cut tab's Project panel sets provenance.siteOrigin, channelSlug and channel in the DRAFT -- the owed provenance
+// writer (`umtool provenance <p> set` is its twin) -- one undo point, no take touched; a bad origin is refused in
+// the writer's words. inspector-provenance-fixture (WRITES): no channelSlug, an old origin.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/inspector-provenance-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-provenance-fixture");
+const manifestText = () => readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+const manifest = () => JSON.parse(manifestText()) as { provenance: Record<string, unknown> };
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+const undoPoints = (op: string) => readdirSync(path.join(DIR, "revisions")).filter((f) => f.endsWith(`auto-before-${op}.manifest.json`)).length;
+
+test("set the site origin, channel slug and name from the Cut tab: the draft written, no take", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ expect(manifest().provenance.channelSlug).toBeUndefined();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="provenance"]');
+ await expect(panel.locator('[data-provenance-field="siteOrigin"]')).toHaveValue("https://old.example");
+ await expect(panel).toContainText("empty: check blocks until it is set");
+ await page.screenshot({ path: test.info().outputPath("provenance-panel.png") });
+
+ // A bad origin: refused, the draft untouched.
+ const before = manifestText();
+ await panel.locator('[data-provenance-field="siteOrigin"]').fill("https://jeralyzer.pages.dev/some/path");
+ await panel.locator("[data-provenance-save]").click();
+ await expect(panel.locator('[data-provenance-said="refused"]')).toContainText("siteOrigin is the archive's origin, with no path");
+ expect(manifestText()).toBe(before);
+
+ await panel.locator('[data-provenance-field="siteOrigin"]').fill("https://jeralyzer.pages.dev/");
+ await panel.locator('[data-provenance-field="channelSlug"]').fill("inspchan");
+ await panel.locator('[data-provenance-field="channel"]').fill("Inspector Channel");
+ await panel.locator("[data-provenance-save]").click();
+ await expect(panel.locator('[data-provenance-said="ok"]')).toContainText("Saved to the draft: siteOrigin, channelSlug, channel");
+ expect(manifest().provenance).toMatchObject({ siteOrigin: "https://jeralyzer.pages.dev", channelSlug: "inspchan", channel: "Inspector Channel" });
+ expect(undoPoints("provenance")).toBe(1);
+ expect(takeText()).toBe(take);
+ // The link policy per channel, under it: the cut's clips are now inspchan's.
+ await expect(panel.locator('[data-provenance-link-policy] [data-link-policy-direct="inspchan"]')).toBeVisible();
+ await page.screenshot({ path: test.info().outputPath("provenance-saved.png") });
+
+ // Clearing a key removes it.
+ await panel.locator('[data-provenance-field="channel"]').fill("");
+ await panel.locator("[data-provenance-save]").click();
+ await expect(panel.locator('[data-provenance-said="ok"]')).toContainText("channel");
+ expect(manifest().provenance.channel).toBeUndefined();
+ expect(takeText()).toBe(take);
+});
+
+test("one Undo takes the last provenance write back", async ({ request }) => {
+ const r = await request.post("/api/report/timeline", { data: { project: P, op: "undo" } });
+ expect(r.ok(), await r.text()).toBe(true);
+ expect((await r.json()).op).toBe("provenance");
+ expect(manifest().provenance.channel).toBe("Inspector Channel");
+});
diff --git a/umtool/e2e/inspector-rumble-cite.spec.ts b/umtool/e2e/inspector-rumble-cite.spec.ts
@@ -0,0 +1,65 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { openPanel } from "./panels";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE RUMBLE CITE FIX (umtool redesign L6, item 5; components/projects/inspector/LinksInspector.tsx): the Cut
+// tab's Project panel lists each clip citing a Rumble URL-slug FOLDER the archive does not serve, with the embed
+// id it does (L1's siteVideoFor, from the folder's metadata), and "Use the published embed id" writes `siteVideo`
+// into the draft -- per row, and once for every dead Rumble row; one undo point per press, no network, no take
+// touched (`umtool links <p> --embed-ids` is the twin). inspector-rumble-fixture (WRITES): r01 v7slug1 -> v7emb01,
+// r02 v7slug2 -> v7emb02 (both dead at the last check), r03 its own id.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/inspector-rumble-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-rumble-fixture");
+type Clip = { id: string; video: string; siteVideo?: string };
+const clips = () => (JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")) as { timeline: Clip[] }).timeline;
+const sv = () => Object.fromEntries(clips().map((c) => [c.id, c.siteVideo ?? null]));
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+test("one row: Use the published embed id -- siteVideo in the draft, the folder id kept", async ({ page, request }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="links"]');
+ await expect(panel.locator("[data-embed-row]")).toHaveCount(2);
+ await expect(panel.locator('[data-embed-row="r01"]')).toHaveAttribute("data-embed-state", "dead");
+ await expect(panel.locator('[data-embed-row="r01"]')).toContainText("inspectrumble/v7slug1 → v7emb01");
+ await expect(panel.locator('[data-embed-row="r03"]')).toHaveCount(0);
+ await expect(panel.locator("[data-embed-use-all]")).toContainText("for all 2 dead");
+ await page.screenshot({ path: test.info().outputPath("rumble-cites.png") });
+
+ await panel.locator('[data-embed-use="r01"]').click();
+ await expect(panel.locator('[data-embed-said="ok"]')).toContainText("r01 → v7emb01");
+ expect(sv()).toEqual({ r01: "v7emb01", r02: null, r03: null });
+ expect(clips().find((c) => c.id === "r01")?.video).toBe("v7slug1");
+ await expect(panel.locator("[data-embed-row]")).toHaveCount(1);
+ expect(takeText()).toBe(take);
+
+ // One press, one undo step.
+ const r = await request.post("/api/report/timeline", { data: { project: P, op: "undo" } });
+ expect(r.ok(), await r.text()).toBe(true);
+ expect((await r.json()).op).toBe("embed-ids");
+ expect(sv()).toEqual({ r01: null, r02: null, r03: null });
+});
+
+test("every dead Rumble row in one press", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="links"]');
+ await expect(panel.locator("[data-embed-row]")).toHaveCount(2);
+ await panel.locator("[data-embed-use-all]").click();
+ await expect(panel.locator('[data-embed-said="ok"]')).toContainText("r01 → v7emb01, r02 → v7emb02");
+ expect(sv()).toEqual({ r01: "v7emb01", r02: "v7emb02", r03: null });
+ await expect(panel.locator("[data-embed-none]")).toBeVisible();
+ expect(takeText()).toBe(take);
+});
diff --git a/umtool/e2e/inspector-still.spec.ts b/umtool/e2e/inspector-still.spec.ts
@@ -0,0 +1,47 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync, readdirSync, statSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { openPanel } from "./panels";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// A STILL AT SECOND N (umtool redesign L6, item 6; components/projects/inspector/StillInspector.tsx): Play's Still
+// button keeps the frame on screen -- the clip's fetched window at the playhead's source second, one ffmpeg frame --
+// as shots/still-<clip>-<s>s.png, listed on the Cut tab's Project panel; the cut itself is never written
+// (`umtool still` is the twin). inspector-still-fixture (WRITES shots/): play-cut-fixture's cut, its window cached.
+// ---------------------------------------------------------------------------
+
+const P = "reports/inspector-still-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-still-fixture");
+const manifestText = () => readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+test("Still in Play: the frame at the playhead into shots/, listed on the Cut tab, the draft untouched", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const before = manifestText();
+ const take = takeText();
+ await page.goto(urls.playHref(P, { clip: "c01", at: 0.5 }));
+ const root = page.locator("[data-play-cut]");
+ await expect(root).toHaveAttribute("data-play-state", "paused", { timeout: 30_000 });
+ await expect(page.locator("[data-play-readout]")).toContainText("c01");
+ await page.locator("[data-play-still]").click();
+ const said = page.locator('[data-play-still-said="ok"]');
+ await expect(said).toContainText("shots/still-c01-", { timeout: 20_000 });
+ await page.screenshot({ path: test.info().outputPath("play-still.png") });
+ const shots = readdirSync(path.join(DIR, "shots")).filter((f) => f.startsWith("still-c01-"));
+ expect(shots).toHaveLength(1);
+ expect(statSync(path.join(DIR, "shots", shots[0])).size).toBeGreaterThan(100);
+ // Its second is the clip's source second (c01 plays 1.0-3.0): inside the clip.
+ const at = Number(/still-c01-(\d+)_(\d{2})s\.png/.exec(shots[0])?.slice(1, 3).join("."));
+ expect(at).toBeGreaterThanOrEqual(1);
+ expect(at).toBeLessThanOrEqual(3);
+ expect(manifestText()).toBe(before);
+ expect(takeText()).toBe(take);
+
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="still"]');
+ await expect(panel.locator(`[data-shot="shots/${shots[0]}"]`)).toBeVisible();
+ await expect(panel.locator(`[data-shot="shots/${shots[0]}"] img`)).toHaveJSProperty("complete", true);
+});
diff --git a/umtool/e2e/inspector-teaser-insert.spec.ts b/umtool/e2e/inspector-teaser-insert.spec.ts
@@ -0,0 +1,79 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// INSERT A TEASER OR CLOSING CARD (umtool redesign L6, item 2; components/projects/inspector/TeaserInspector.tsx):
+// the Cut tab's "Insert a teaser or closing card" -- where, the lines with a break and a hold, the beat -- writes
+// a `teaser` entry into the draft (`umtool timeline <p> teaser-insert` is the twin), refused in the build's teaser
+// words, its row's Edit changes it after; no take touched. inspector-teaser-fixture (WRITES).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/inspector-teaser-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-teaser-fixture");
+const manifestText = () => readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+const timeline = () => (JSON.parse(manifestText()) as { timeline: Record<string, unknown>[] }).timeline;
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+test("a closing card at the end: its lines, a break and a hold, its beat -- and a bad break refused", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await page.locator("[data-cut-insert-card]").click();
+ const panel = page.locator('[data-inspector="teaser"]');
+ await expect(panel.locator("[data-teaser-position]")).toHaveValue("end");
+ await panel.locator('[data-teaser-line="0"] [data-teaser-line-field="text"]').fill("The 291 scale bet");
+ await panel.locator("[data-teaser-add-line]").click();
+ const l1 = panel.locator('[data-teaser-line="1"]');
+ await l1.locator('[data-teaser-line-field="text"]').fill("Scale video: not posted as of Nov 8");
+ // A break that is not the end of its words: the build's rule, said; nothing written.
+ await l1.locator('[data-teaser-line-field="break"]').fill("not posted");
+ const before = manifestText();
+ await panel.locator('[data-teaser-insert="insert"]').click();
+ await expect(panel.locator('[data-teaser-said="refused"]')).toContainText("break must be the end of its text");
+ expect(manifestText()).toBe(before);
+
+ await l1.locator('[data-teaser-line-field="break"]').fill("as of Nov 8");
+ await l1.locator('[data-teaser-line-field="hold"]').fill("1.6");
+ await panel.locator("[data-teaser-beat]").fill("1.3");
+ await page.screenshot({ path: test.info().outputPath("teaser-insert.png") });
+ await panel.locator('[data-teaser-insert="insert"]').click();
+ await expect(panel.locator('[data-teaser-said="ok"]')).toContainText("Inserted close at 6");
+ expect(timeline().at(-1)).toEqual({ type: "teaser", id: "close", lines: ["The 291 scale bet", { text: "Scale video: not posted as of Nov 8", break: "as of Nov 8", hold: 1.6 }], beat: 1.3 });
+ expect(takeText()).toBe(take);
+ // Its row is in the cut.
+ await expect(page.locator('[data-entry="close"][data-kind="teaser"]')).toBeVisible();
+});
+
+test("a cold open at the start, then its row's Edit changes its beat; Undo takes that edit back", async ({ page, request }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await page.locator("[data-cut-insert-card]").click();
+ const panel = page.locator('[data-inspector="teaser"]');
+ await panel.locator("[data-teaser-position]").selectOption("start");
+ await panel.locator('[data-teaser-line="0"] [data-teaser-line-field="text"]').fill("Cold open");
+ await panel.locator('[data-teaser-insert="insert"]').click();
+ await expect(panel.locator('[data-teaser-said="ok"]')).toContainText("Inserted cold at 1");
+ expect(timeline()[0]).toEqual({ type: "teaser", id: "cold", lines: ["Cold open"] });
+
+ await page.reload();
+ const row = page.locator('[data-entry="cold"]');
+ await row.locator("[data-teaser-edit]").click();
+ const edit = row.locator('[data-inspector="teaser"]');
+ await expect(edit.locator('[data-teaser-line="0"] [data-teaser-line-field="text"]')).toHaveValue("Cold open");
+ await edit.locator("[data-teaser-beat]").fill("0.9");
+ await edit.locator('[data-teaser-insert="set"]').click();
+ await expect(edit.locator('[data-teaser-said="ok"]')).toContainText("Saved cold to the draft.");
+ expect(timeline()[0]).toEqual({ type: "teaser", id: "cold", lines: ["Cold open"], beat: 0.9 });
+ expect(takeText()).toBe(take);
+
+ const r = await request.post("/api/report/timeline", { data: { project: P, op: "undo" } });
+ expect(r.ok(), await r.text()).toBe(true);
+ expect((await r.json()).op).toBe("teaser");
+ expect(timeline()[0]).toEqual({ type: "teaser", id: "cold", lines: ["Cold open"] });
+});
diff --git a/umtool/e2e/inspector-title.spec.ts b/umtool/e2e/inspector-title.spec.ts
@@ -0,0 +1,44 @@
+import { test, expect } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { openPanel } from "./panels";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE TITLE PANEL (umtool redesign L6, item 7; 9 Nov: four news projects' title/subtitle set with jq): the Cut
+// tab's Project panel writes the manifest's `title` and `subtitle` in the draft (`umtool title` is the twin),
+// an empty subtitle removes it, no take touched. inspector-title-fixture (WRITES).
+// ---------------------------------------------------------------------------
+
+const P = "reports/inspector-title-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song", "reports", "inspector-title-fixture");
+const manifest = () => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8")) as { title?: string; subtitle?: string };
+const takeText = () => readFileSync(path.join(DIR, "takes", "short", "take.json"), "utf8");
+
+test("retitle the project and drop its subtitle from the Cut tab", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ const take = takeText();
+ await page.goto(urls.projectHref(P, { tab: "cut" }));
+ await openPanel(page, "options", "cut-project");
+ const panel = page.locator('[data-inspector="title"]');
+ await expect(panel.locator('[data-title-field="title"]')).toHaveValue("The Inspector Title Fixture");
+ await expect(panel.locator('[data-title-field="subtitle"]')).toHaveValue("an old subtitle");
+ await panel.locator('[data-title-field="title"]').fill("Losing the same hundred pounds");
+ await panel.locator('[data-title-field="subtitle"]').fill("Every weight he has given on camera");
+ await panel.locator("[data-title-save]").click();
+ await expect(panel.locator('[data-title-said="ok"]')).toContainText("Saved to the draft.");
+ expect(manifest()).toMatchObject({ title: "Losing the same hundred pounds", subtitle: "Every weight he has given on camera" });
+ // The head follows (the crumb is the title).
+ await expect(page.locator("body")).toContainText("Losing the same hundred pounds");
+ await page.screenshot({ path: test.info().outputPath("title-panel.png") });
+
+ await panel.locator('[data-title-field="subtitle"]').fill("");
+ await panel.locator("[data-title-save]").click();
+ await expect(panel.locator('[data-title-said="ok"]')).toBeVisible();
+ expect("subtitle" in manifest()).toBe(false);
+ // An empty title cannot be saved.
+ await panel.locator('[data-title-field="title"]').fill(" ");
+ await expect(panel.locator("[data-title-save]")).toBeDisabled();
+ expect(takeText()).toBe(take);
+});