commit 1e44b09ad122b58b34df48cf92aac38fc474deec
parent d598a6aef52c753a3fa736b2683b2bcd56d0a1bd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 19:56:06 -0500
umtool: the ingredient rail's e2e (ingredient-rail.spec.ts), its fixture and its docs (lane L5)
The fixture: railchan/railvid used by reports/rail-a (ra1, ra2; a saved version v1 holding ra1,
rendered; ra1 quote-checked) and reports/rail-b (rb1, its link checked), two windows (one asked for a
clip no project has now), a Rumble recording (folder v7rslug1, embed id v7rembd1) cited by its embed id.
The spec: all nine pills render with their glyphs, Used in lists both projects, ?window= focuses one
window and narrows the stages after it, either Rumble id opens the same recording and shows both, the
clip bench's and Play's Life cycle links, and each action asks (cost, queue) then posts to its route --
persist-videos, transcribe-one, fetch-windows and a targeted evict-clips on the stub editor (which now
records transcribe-one and evict-clips, and serves railchan's fetch-windows), the link check through
/api/report/links, the quote check as a umtool job let finish. docs: knobs.md "An ingredient's life
cycle (the rail)", cli.md's `ingredient` row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 339 insertions(+), 2 deletions(-)
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -135,6 +135,7 @@ Inbox cannot disagree about what is wrong with one.
| `preset list [--json]` · `preset show <name> [--json]` · `preset save <name> --from <project> [--description D] [--force]` · `preset apply <name\|none> <project> [--replace] [--json]` | the **look presets** (`umtool/presets/<name>.json`, or `UMTOOL_PRESETS_DIR`; built in: `plain-deck` `huck-deck` `ember-deck` `archive-catalog` `basic`): a render block a manifest stands on (`"preset": "<name>"`), laid under it — preset → manifest → style → take patch. `save` keeps a project's look and leaves its content out; `apply` names the preset on the cut through `updatePreset` (nothing copied in), refused when the cut over it would not build (a basic cut's chrome is not checked); `--replace` also clears the manifest's own value of every key the preset sets, after an undo point (`revisions/…-auto-before-preset-replace`), and prints what went ([knobs.md](knobs.md#look-presets)) |
| `clip <channel>/<video>@<start>-<end> [--snap words] [--title T] [--site <id>] [--folder F] [--json] [--progress ndjson]` | **quick clip**: a basic-mode project (`quick-clips/<slug>`, the footage alone), its window asked of the editor (fetch-windows, followed to its end; Rumble fetched whole), `--snap words` its edges snapped to the words heard (the editor's transcribe op), rendered as the take `clip` (`take <p> --id clip --full`: the heavy slot), then the mp4's path and the share line. `--json`: `{project, output, share: {platform, archive, text}, snapped?}`; `--progress ndjson`: events, the last `quick-clip` (the app's `POST /api/report/quick-clip` job). **Exit 0 · 1 failed (the editor, the render) · 2 usage** ([knobs.md](knobs.md#basic-output-the-footage-alone)) |
| `share <project> [<clip>] [--take <t>] [--site <id>] [--json]` | a clip's **share line** (the clip named, else the first): its platform page at the first second it plays and its archive moment, a Rumble folder id as the embed id the archive serves — the twin of **Copy share line** (`GET /api/report/share-line`). `--json`: `{clip, seconds, platform, archive, text}` |
+| `ingredient <channel>/<video> [--window <from>-<to>] [--used-in] [--json]` | **one recording's life cycle**, the twin of `/ingredients/<channel>/<video>` ([knobs.md](knobs.md#an-ingredients-life-cycle-the-rail)): nine stages — found, downloaded, transcribed, clock, windows, used in, checked, rendered, published — each **✓**, a count, **!** or **—**, and its line, then every project clip that cuts from it (the draft and each saved version, from the usage index `<REPORTS_ROOT>/.umtool/usage-index.json`). A Rumble recording answers to its folder slug or its embed id; both are printed. `--window`: one clip window, the stages after it narrowed to the clips it plays. `--used-in`: the clips alone. `--json`: the page's object. Read-only over the corpus. **Exit 0 · 1 failed · 2 usage** |
| `take status <project> [--id <take>] [--json] [--log] [--tail N]` | a take's **render record** (`takes/<take>/render.json`, written by every render whoever started it — a terminal, the Takes page, the queue): `state` (`running`, `waiting` at the heavy slot, `done`, `failed`, `cancelled`; `queued` or `blocked` while a queue step waits to render it), `stage` and a rough `percent`, the `error` (the first error line, not a bare "exited 1") and the log's last 40 lines (`tail`), on done the `mp4` and its measured `seconds`; `--log` prints the FULL `takes/<take>/render.log`. A "running" whose process is gone reads **failed** ("the render process is gone"); a done whose mp4 is missing or 0 bytes reads **failed**. **Exit 0 done · 3 queued, waiting or running · 1 failed, cancelled, blocked or none.** Without `--id`: every take with a record, the newest's exit ([queue and poll](#queue-and-poll-instead-of-scripting)); and its fast-feedback renders beside it, `preview` and `changes` (each one's state, mp4, seconds, log; a changes reel's piece count, its base and its list), a queued `--preview`/`--changes` step said as such -- never as the take's own render |
| `queue add [--after <qid>\|last] [--label T] [--timeout <minutes>] [--json] -- <umtool subcommand argv…>` | a **step** of the durable queue: the argv of a umtool command, one word per argument (no shell), stored under `<reports root>/.umtool-queue/` and run by the **umtool app** (its systemd unit), one step at a time, in order — so it survives the session that queued it, an app restart and a ship. Prints the qid (`q<N>`) alone on stdout. `--after` waits for that step to be **done**; when it fails or is cancelled this one is **blocked** (and so is whatever waits on it). `--timeout`: the step's limit (default 720 minutes). A step does not start while the app's own job runner is busy (a Takes-page job), and a heavy step still takes the machine's heavy slot and render mode by itself |
| `queue ls [--all] [--json]` · `queue status <qid> [--json]` · `queue wait <qid> [--timeout <s>]` · `queue log <qid> [--tail N]` · `queue cancel <qid>` · `queue retry <qid>` | the queue: `ls` the runner (is the app running it) and the steps not finished or finished in the last 24 h; `status` one step (**exit 0 done · 3 queued or running · 1 failed, blocked or cancelled**); `wait` the same after up to `<s>` seconds (default 90); `log` its FULL log (`logs/<qid>.log`; earlier attempts kept as `<qid>.<n>.log`); `cancel` a queued or blocked step at once, a running one stopped (its process group); `retry` a failed or cancelled step back in the queue with every step blocked behind it. A step that was running when the app died reads **failed** ("the step's process is gone"), its log kept — it is never re-run on its own |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -377,6 +377,40 @@ The Rumble mapping is ONE helper (`lib/report/shareLine.mjs` `siteVideoFor`, ove
`citeUrl` that was the dead link moves with it); and `umtool timeline insert <rumble-channel>/<folder>@…`, which
writes the inserted clip with its `siteVideo`. A clip that pins `siteVideo` is never looked up.
+## An ingredient's life cycle (the rail)
+
+`/ingredients/<channel>/<video>` is one recording of the corpus across its whole life: nine stages across the top,
+each a pill — **✓** (done), **a count**, **!** (needs you) or **—** (nothing yet) — and the selected stage's panel
+below. `?window=<from>-<to>` (a clip window's own name) focuses one window: it is lit, and the stages after it
+(Used in, Checked, Rendered, Published) narrow to the clips it plays. A Rumble recording answers to its folder slug
+or its embed id, and the head shows both. Every stage reads files that already exist, read-only over the corpus
+(`lib/ingredients/stages.mjs`: `metadata.info.json` and `transcript.cues.json` by their ends, never whole):
+
+| Stage | Read from | Its action | From a terminal | Route |
+|---|---|---|---|---|
+| Found | `find-clips.json`; research sessions' marks; research cases' `candidates.jsonl` | Find in Research; the case's candidates | `umtool ingredient <ch>/<id>` | — |
+| Downloaded | the metadata's head, `metadata.history.json`, `download-outcome.json`, `availability.json`, `saved-video.json`, `media-import.json`, the media files and their links | **Persist source video** (Rumble: the whole recording) | `pnpm ops persist-videos --json '{"items":[{"slug":…,"id":…}]}'` | `POST /api/ops/persist-videos` (editor) |
+| Transcribed | the cues' head and tail (source, reach), the `.vtt` files, `transcript-pin.json`, `transcribe-outcome.json`, `words.json` | **Transcribe** (the GPU) | `pnpm ops transcribe-one --json '{"slug":…,"id":…}'` | `POST /api/ops/transcribe-one` (editor) |
+| Clock | `clock.json` (`describeClock`) | — | `umtool ingredient <ch>/<id>` | — |
+| Windows | `clips/<from>-<to>.*` and their sidecars, cross-checked against the usage index: a draft clip no window holds, a window asked for a clip no project uses | **Fetch** the clips no window holds (the project's own fetch body, narrowed to them); **Evict** one window | `umtool fetch <p>` · `pnpm ops evict-clips --json '{"slug":…,"id":…,"windows":["<from>-<to>"]}'` | `POST /api/ops/fetch-windows` · `POST /api/ops/evict-clips` (editor) |
+| Used in | the usage index: every project clip that cuts from it, in the draft and in each saved version | each clip opens its bench | `umtool ingredient <ch>/<id> --used-in [--json]` | — |
+| Checked | each project's `quote-check.json` rows for those clips (a row the cut has moved past reads stale) | **Check quotes** (the GPU) | `umtool quote-check <p> --clips a,b` | `POST /api/ingredients/action` (a umtool job) |
+| Rendered | each version's `render.json` (else its preview), `out/segments/<clip>.cut.json` | play the version at that clip | `umtool take status <p> --id <v>` | — |
+| Published | each project's `out/links.json` rows for those clips, the archive moment | **Check links**; **Fix dead links** | `umtool links <p> [--fix]` | `POST /api/report/links {project, fix?}` |
+
+Every action ASKS first: `POST /api/ingredients/action {action, ch, id, step: "plan", project?, clips?, window?}`
+answers what it will do, what it costs (network, the GPU, a deleted cache file) and the queue it lands on — the
+editor's own dry run for fetch-windows and persist-videos — and nothing starts until **Start** posts the plan's
+`start` (`step: "start"`). The editor decides the queue, the pacing and a whole-recording download.
+
+THE USAGE INDEX (`lib/ingredients/usedIn.mjs`) is `<REPORTS_ROOT>/.umtool/usage-index.json` (`UMTOOL_USAGE_INDEX_FILE`
+moves it): every report-video project's `video.manifest.json` (the draft) and each take's frozen form
+(`takes/<id>/base.manifest.json`, a saved version, or a legacy rendered take's `takes/<id>/video.manifest.json`),
+rebuilt incrementally by each manifest's mtime and size; a project deleted drops out. A clip citing a Rumble embed id
+and one citing the folder slug are one ingredient, keyed by the folder (`resolveVideoDirId`, its answer kept in the
+index). The way in: the clip bench's head (**Life cycle**), Play's row for the clip on screen (**Life cycle**), and the
+editor's video page (**Open in umtool**).
+
## Sections, split and flash-forward (editing the cut)
Under the deck a cut's **sections are its markers** (`render.chrome.deck.markers`): §0 runs to the first marker's
diff --git a/umtool/e2e/fixtures/editor-stub-fetch-windows.mjs b/umtool/e2e/fixtures/editor-stub-fetch-windows.mjs
@@ -23,7 +23,8 @@ import path from "node:path";
// spec's cache lookup finds — specs must stay order-independent. And the
// article chain's `windows` step relies on that 404 to stop (article-iterations.spec).
// basicyt: the quick-clip job's recording (basic-mode-fixture.mjs), a channel of its own for the same reason.
-export const FETCH_WINDOWS_CHANNELS = new Set(["opsrumble", "opsyt", "basicyt"]);
+// railchan: the ingredient rail's recording (ingredient-rail-fixture.mjs), which no other spec reads.
+export const FETCH_WINDOWS_CHANNELS = new Set(["opsrumble", "opsyt", "basicyt", "railchan"]);
const fwJobs = new Map();
let next = 1;
diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs
@@ -1313,7 +1313,9 @@ const server = http.createServer((req, res) => {
// THE CASE PIPELINE'S GAP BUTTONS (release 38 lane A, case-pipeline.spec.ts): the editor's own actions,
// recorded and answered as queued -- download-missing, transcribe-bucket, persist-videos (its dryRun answers
// the buckets) and channel-priority's focus.
- if (req.method === "POST" && ["/api/ops/download-missing", "/api/ops/transcribe-bucket", "/api/ops/persist-videos", "/api/ops/channel-priority"].includes(url.pathname)) {
+ // The ingredient rail's (lane L5, ingredient-rail.spec.ts): transcribe-one and a targeted evict-clips, recorded and
+ // answered as queued the same way -- nothing is transcribed and no window is deleted.
+ if (req.method === "POST" && ["/api/ops/download-missing", "/api/ops/transcribe-bucket", "/api/ops/persist-videos", "/api/ops/channel-priority", "/api/ops/transcribe-one", "/api/ops/evict-clips"].includes(url.pathname)) {
let raw = "";
req.on("data", (c) => (raw += c));
req.on("end", () => {
diff --git a/umtool/e2e/fixtures/ingredient-rail-fixture.mjs b/umtool/e2e/fixtures/ingredient-rail-fixture.mjs
@@ -0,0 +1,83 @@
+// What ingredient-rail.spec.ts reads (lane L5, the ingredient life-cycle rail): one recording of the
+// fixture corpus used by TWO projects, and a Rumble recording cited by its embed id.
+//
+// channels/railchan/ a YouTube channel of its own (fetch-windows serves it: editor-stub-fetch-windows.mjs)
+// data/railvid/ metadata.info.json (its webpage_url past a 64 KB formats array: the head reader never sees it),
+// transcript.cues.json (300 s, 50 cues), transcript.en.vtt, download-outcome.json, availability.json,
+// metadata.history.json, find-clips.json (the clip finder found it: rail-a),
+// clips/10.00-40.00.mp4 (+ sidecar: asked for rail-a's ra1), clips/200.00-230.00.mp4 (+ sidecar:
+// asked for a clip no project has now -- the orphan)
+// channels/railrumble/ platform rumble: data/v7rslug1/ is the URL slug, its metadata's id the
+// embed id v7rembd1, which rail-r cites
+//
+// reports/rail-a ra1 railvid 12-20 (quote; ok in quote-check.json), ra2 railvid 100-110 (quote; no window holds it)
+// takes/v1: a saved version (base.manifest.json) holding ra1, rendered (render.json done, preview.mp4)
+// reports/rail-b rb1 railvid 15-25, its QR link checked ok (out/links.json)
+// reports/rail-r rr1 railrumble/v7rembd1 30-40
+//
+// The site the QRs link is http://127.0.0.1:9 (cut-integrity-fixture's placeholder): a link check there is
+// refused at once, on this machine. The spec WRITES (a link check rewrites rail-b's out/links.json; a quote
+// check may write rail-a's quote-check.json): these projects are its own.
+//
+// Synthetic, like every fixture.
+import { copyFileSync, mkdirSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+export const RAIL_SITE = "http://127.0.0.1:9";
+
+const write = (dir, name, doc) => {
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(dir, name), typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n");
+};
+
+/** @param {{ reports: string, channels: string, manifest: Function, cachedWindow: string }} o */
+export function makeIngredientRailFixture({ reports, channels, manifest, cachedWindow }) {
+ // ── the corpus ──
+ const ch = path.join(channels, "railchan");
+ write(ch, "config.json", { platform: "youtube" });
+ const v = path.join(ch, "data", "railvid");
+ const formats = Array.from({ length: 1500 }, (_, i) => ({ format_id: String(i), url: `https://media.example/${"x".repeat(40)}/${i}` }));
+ write(v, "metadata.info.json", JSON.stringify({ id: "railvid", title: "The Rail Recording", formats, webpage_url: "https://www.youtube.com/watch?v=railvid", duration: 300 }));
+ const cues = Array.from({ length: 50 }, (_, i) => ({ start: i * 6, end: i * 6 + 5.5, text: `the rail recording says line ${i}.` }));
+ write(v, "transcript.cues.json", JSON.stringify({ version: 2, source: "vtt", vttFile: "transcript.en.vtt", transcriptFormat: "vtt", id: "railvid", channelSlug: "railchan", title: "The Rail Recording", uploadDate: "20261101", duration: 300, platform: "youtube", cues }));
+ write(v, "transcript.en.vtt", "WEBVTT\n\n00:00:00.000 --> 00:00:05.500\nthe rail recording says line 0.\n");
+ write(v, "download-outcome.json", { videoId: "railvid", webpageUrl: "https://www.youtube.com/watch?v=railvid", status: "ok", startedAt: "2026-11-01T10:00:00.000Z", finishedAt: "2026-11-01T10:00:20.000Z", attempts: [{ n: 0, kind: "primary" }] });
+ write(v, "availability.json", { checkedAt: "2026-11-02T00:00:00.000Z", availability: "public", history: [] });
+ write(v, "metadata.history.json", { entries: [{ at: "2026-11-03T00:00:00.000Z", by: "refresh", from: { sha256: "a", bytes: 1 }, to: { sha256: "b", bytes: 2 }, changed: {}, added: {}, removed: {}, counters: {}, volatile: [] }] });
+ write(v, "find-clips.json", { version: 1, at: "2026-11-04T00:00:00.000Z", jobId: "job-1", project: "reports/rail-a", url: "/projects/reports/rail-a/clip-editor", created: true, segments: [{ id: "s1", from: 0, to: 120 }], steps: [] });
+ mkdirSync(path.join(v, "clips"), { recursive: true });
+ copyFileSync(cachedWindow, path.join(v, "clips", "10.00-40.00.mp4"));
+ write(path.join(v, "clips"), "10.00-40.00.json", { requestedBy: "umtool:reports/rail-a", clipId: "ra1", reason: "The Rail A Fixture", fetchedAt: "2026-11-05T00:00:00.000Z", bytes: 1 });
+ copyFileSync(cachedWindow, path.join(v, "clips", "200.00-230.00.mp4"));
+ write(path.join(v, "clips"), "200.00-230.00.json", { requestedBy: "umtool:reports/gone", clipId: "gone1", fetchedAt: "2026-11-05T00:00:00.000Z" });
+
+ const rch = path.join(channels, "railrumble");
+ write(rch, "config.json", { platform: "rumble" });
+ const rv = path.join(rch, "data", "v7rslug1");
+ write(rv, "metadata.info.json", JSON.stringify({ id: "v7rembd1", title: "The Rumble Rail Recording", webpage_url: "https://rumble.com/v7rslug1-the-rumble-rail-recording.html" }));
+ write(rv, "transcript.cues.json", JSON.stringify({ version: 2, source: "whisper", id: "v7rembd1", title: "The Rumble Rail Recording", duration: 120, cues: [{ start: 0, end: 4, text: "rumble." }] }));
+
+ // ── the projects ──
+ const origin = { siteOrigin: RAIL_SITE, channelSlug: "railchan" };
+ const a = manifest("rail-a", "The Rail A Fixture", origin, [
+ { type: "clip", id: "ra1", video: "railvid", start: 12, end: 20, cite: 12, section: 0, quote: "the rail recording says line 2." },
+ { type: "clip", id: "ra2", video: "railvid", start: 100, end: 110, cite: 100, section: 0, quote: "the rail recording says line 17." },
+ ]);
+ const aDir = path.join(reports, "rail-a");
+ write(aDir, "video.manifest.json", a);
+ const base = manifest("rail-a", "The Rail A Fixture", origin, [a.timeline[0]]);
+ const take = path.join(aDir, "takes", "v1");
+ write(take, "base.manifest.json", base);
+ write(take, "take.json", { id: "v1", group: "takes", order: 1, label: "Version 1", kind: "different", preview: "preview.mp4", window: "full", style: null, patch: null, version: true, draft: true, seconds: 8, builtAt: "2026-11-06T00:00:00.000Z" });
+ copyFileSync(cachedWindow, path.join(take, "preview.mp4"));
+ write(take, "render.json", { version: 1, state: "done", project: "reports/rail-a", take: "v1", mp4: "preview.mp4", seconds: 8, startedAt: "2026-11-06T00:00:00.000Z", endedAt: "2026-11-06T00:01:00.000Z", exitCode: 0, stage: "done", percent: 100 });
+ write(aDir, "quote-check.json", { version: 1, checkedAt: "2026-11-06T12:00:00.000Z", clips: { ra1: { status: "ok", offset: 0.02, against: "cues", cut: { from: 12, to: 20 }, quote: "the rail recording says line 2." } } });
+
+ const bDir = path.join(reports, "rail-b");
+ write(bDir, "video.manifest.json", manifest("rail-b", "The Rail B Fixture", origin, [{ type: "clip", id: "rb1", video: "railvid", start: 15, end: 25, cite: 15, section: 0 }]));
+ write(path.join(bDir, "out"), "links.json", { version: 1, checkedAt: "2026-11-07T00:00:00.000Z", fetched: 1, origins: {}, links: [{ clip: "rb1", url: `${RAIL_SITE}/?v=railchan%2Frailvid&t=15`, state: "ok", origin: RAIL_SITE }] });
+
+ const rDir = path.join(reports, "rail-r");
+ write(rDir, "video.manifest.json", manifest("rail-r", "The Rail Rumble Fixture", { siteOrigin: RAIL_SITE, channelSlug: "railrumble" }, [{ type: "clip", id: "rr1", video: "v7rembd1", start: 30, end: 40, cite: 30, section: 0 }]));
+ return { aDir, bDir, rDir };
+}
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 { makeIngredientRailFixture } from "./ingredient-rail-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"));
@@ -2089,6 +2090,10 @@ writeFileSync(ptFile, JSON.stringify(pt, null, 2) + "\n");
// sound of its own, and a whole-cut version v1 the spec switches the intro off and on in. WRITABLE, its own.
makeIntroPlayFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
+// THE INGREDIENT RAIL (ingredient-rail.spec.ts, lane L5): one recording (railchan/railvid) used by two projects,
+// its windows, a saved version, a quote check and a link check; a Rumble recording cited by its embed id. WRITABLE, its own.
+makeIngredientRailFixture({ reports, channels: CHANNELS, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+
// The measure's instruments (instruments.spec.ts): the Play cut with the dial, the odometer and
// the trail on, and a built schedule carrying a measure slice (instruments-fixture.mjs).
await makeInstrumentsFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
diff --git a/umtool/e2e/ingredient-rail.spec.ts b/umtool/e2e/ingredient-rail.spec.ts
@@ -0,0 +1,211 @@
+import { test, expect, type Page } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE INGREDIENT LIFE-CYCLE RAIL (umtool redesign, lane L5; operator, 9 Nov 2026: "the stage rail could be good
+// for viewing a downloaded clip or other video ingredient to see its entire life cycle"): /ingredients/<ch>/<id>
+// shows one recording across nine stages -- found, downloaded, transcribed, clock, windows, used in, checked,
+// rendered, published -- each a pill (✓, a count, ! or —) and a panel, and each stage's action says what it
+// costs and where it lands before it posts to the editor's (stubbed) or umtool's own route.
+//
+// Fixture: e2e/fixtures/ingredient-rail-fixture.mjs -- railchan/railvid used by reports/rail-a (ra1, ra2; a saved
+// version v1 holding ra1, rendered) and reports/rail-b (rb1); railrumble/v7rslug1 (embed id v7rembd1) cited by
+// reports/rail-r. WRITES (rail-b's links.json, maybe rail-a's quote-check.json): its own.
+//
+// INGREDIENT_SHOTS (a directory): the page's screenshots at 1366×768 go there too.
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const FIXTURE = path.join(path.dirname(fileURLToPath(import.meta.url)), ".e2e-song");
+const STUB_LOG = path.join(FIXTURE, "editor-stub.requests.json");
+const SHOTS = process.env.INGREDIENT_SHOTS ?? null;
+const RAIL = urls.ingredientHref("railchan", "railvid");
+
+type StubRequest = { route?: string; slug?: string; id?: string; items?: { slug: string; id: string; clipId?: string }[]; dryRun?: boolean; windows?: string[] };
+const stubLog = (): StubRequest[] => {
+ try {
+ return JSON.parse(readFileSync(STUB_LOG, "utf8")) as StubRequest[];
+ } catch {
+ return [];
+ }
+};
+const railAsks = (route: string) =>
+ stubLog().filter((r) => r.route === route && (r.slug === "railchan" || (r.items ?? []).some((i) => i.slug === "railchan")));
+
+const shot = async (page: Page, name: string) => {
+ await page.screenshot({ path: test.info().outputPath(name) });
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, name) });
+};
+
+const pill = (page: Page, key: string) => page.locator(`[data-ingredient-rail] [data-stage="${key}"]`);
+const openStage = async (page: Page, key: string) => {
+ await pill(page, key).click();
+ await expect(page.locator(`[data-stage-panel="${key}"]`)).toBeVisible();
+};
+
+/** Ask, read the confirmation (cost, queue), Start, and wait for the answer. */
+async function runAction(page: Page, id: string, { cost, queue }: { cost: string; queue?: RegExp }) {
+ await page.locator(`[data-action-ask="${id}"]`).click();
+ const confirm = page.locator(`[data-action-confirm="${id}"]`);
+ await expect(confirm).toBeVisible({ timeout: 20_000 });
+ await expect(confirm).toHaveAttribute("data-action-cost", cost);
+ if (queue) await expect(confirm.locator("[data-action-queue]")).toHaveText(queue);
+ await confirm.locator(`[data-action-start="${id}"]`).click();
+ await expect(page.locator(`[data-action-result="${id}"]`)).toBeVisible({ timeout: 30_000 });
+ await expect(page.locator(`[data-action-error="${id}"]`)).toHaveCount(0);
+}
+
+test.beforeEach(async ({ page }) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+});
+
+test("all nine pills render: ✓, a count, ! or — from the files that exist, and the page fits 1366×768", async ({ page }) => {
+ await page.goto(RAIL);
+ await expect(page.locator("[data-ingredient]")).toHaveAttribute("data-ingredient", "railchan/railvid");
+ const rail = page.locator("[data-ingredient-rail] [data-stage]");
+ await expect(rail).toHaveCount(9);
+ await expect(rail).toHaveText([/Found/, /Downloaded/, /Transcribed/, /Clock/, /Windows/, /Used in/, /Checked/, /Rendered/, /Published/]);
+ const want: Record<string, [string, string]> = {
+ found: ["count", "1"],
+ downloaded: ["ok", "✓"],
+ transcribed: ["ok", "✓"],
+ clock: ["none", "—"],
+ windows: ["warn", "!"],
+ used: ["count", "3"],
+ checked: ["count", "1"],
+ rendered: ["count", "1"],
+ published: ["count", "1"],
+ };
+ for (const [key, [kind, text]] of Object.entries(want)) {
+ await expect(pill(page, key), key).toHaveAttribute("data-pill", kind);
+ await expect(pill(page, key), key).toHaveAttribute("data-pill-text", text);
+ }
+ // The first stage that warns is the one open: two windows, one clip no window holds.
+ await expect(page.locator('[data-stage-panel="windows"]')).toBeVisible();
+ await expect(page.locator("[data-stage-line]")).toHaveText("2 windows, 1 clip not fetched");
+ await expect(page.locator('[data-window="200.00-230.00"]')).toContainText("no project uses it now");
+ await expect(page.locator("[data-uncovered]")).toContainText("reports/rail-a ra2");
+ // The stage with no data says so in one line.
+ await openStage(page, "clock");
+ await expect(page.locator("[data-stage-line]")).toContainText("No time map");
+ // Downloaded read the metadata's head only: its title, not the webpage_url past the formats.
+ await openStage(page, "downloaded");
+ await expect(page.locator('[data-stage-panel="downloaded"]')).toContainText("The Rail Recording");
+ await expect(page.locator('[data-stage-panel="downloaded"]')).toContainText("1 metadata rewrite");
+ await openStage(page, "transcribed");
+ await expect(page.locator("[data-stage-line]")).toContainText("vtt, 100% of 5:00");
+ // App-like: no page scroll at 1366×768.
+ expect(await page.evaluate(() => document.documentElement.scrollHeight <= window.innerHeight + 1)).toBe(true);
+ await openStage(page, "windows");
+ await shot(page, "ingredient-rail.png");
+});
+
+test("Used in lists both projects, each clip a link to its bench, the saved version beside the draft", async ({ page }) => {
+ await page.goto(RAIL);
+ await openStage(page, "used");
+ const rows = page.locator("[data-used-row]");
+ await expect(rows).toHaveCount(3);
+ await expect(page.locator('[data-used-row="reports/rail-a#ra1"]')).toContainText("draft, v1");
+ await expect(page.locator('[data-used-row="reports/rail-a#ra2"]')).toContainText("draft");
+ await expect(page.locator('[data-used-row="reports/rail-b#rb1"]')).toContainText("reports/rail-b");
+ await expect(page.locator('[data-used-row="reports/rail-a#ra1"] [data-used-open]')).toHaveAttribute("href", urls.clipBenchHref("reports/rail-a", "ra1"));
+ await expect(page.locator("[data-stage-line]")).toHaveText("3 clips in 2 projects");
+ await shot(page, "ingredient-used.png");
+ // Rendered: the version v1 holds ra1, rendered; Play opens it at that clip.
+ await openStage(page, "rendered");
+ await expect(page.locator('[data-rendered-row="reports/rail-a#ra1@v1"]')).toContainText("version v1");
+ await expect(page.locator('[data-rendered-row="reports/rail-a#ra1@v1"] [data-rendered-play]')).toHaveAttribute("href", urls.playHref("reports/rail-a", { take: "v1", clip: "ra1" }));
+ // Checked and Published read the projects' own files.
+ await openStage(page, "checked");
+ await expect(page.locator('[data-checked-row="reports/rail-a#ra1"]')).toHaveAttribute("data-status", "ok");
+ await expect(page.locator('[data-checked-row="reports/rail-a#ra2"]')).toContainText("not checked");
+ await openStage(page, "published");
+ await expect(page.locator('[data-published-row="reports/rail-b#rb1"]')).toHaveAttribute("data-state", "ok");
+ await expect(page.locator('[data-published-row="reports/rail-a#ra1"]')).toContainText("never checked");
+});
+
+test("?window= focuses one window: it is lit, and the stages after it narrow to the clips it plays", async ({ page }) => {
+ await page.goto(urls.ingredientHref("railchan", "railvid", { from: 10, to: 40 }));
+ await expect(page.locator("[data-ingredient-focus]")).toHaveAttribute("data-ingredient-focus", "10.00-40.00");
+ await expect(page.locator('[data-stage-panel="windows"]')).toBeVisible();
+ await expect(page.locator("[data-window-focused]")).toHaveCount(1);
+ await expect(page.locator('[data-window="10.00-40.00"]')).toHaveAttribute("data-window-focused", "1");
+ await expect(page.locator('[data-window="10.00-40.00"]')).toContainText("cuts rail-a ra1, rail-b rb1");
+ await expect(pill(page, "used")).toHaveAttribute("data-pill-text", "2");
+ await openStage(page, "used");
+ await expect(page.locator("[data-used-row]")).toHaveCount(2);
+ await expect(page.locator('[data-used-row="reports/rail-a#ra2"]')).toHaveCount(0);
+ await expect(page.locator("[data-stage-line]")).toHaveText("2 clips in 2 projects (of 3 from this recording)");
+ await expect(page.locator("[data-checked-row]")).toHaveCount(0); // the checked panel is not open
+ await openStage(page, "checked");
+ await expect(page.locator("[data-checked-row]")).toHaveCount(2);
+ await shot(page, "ingredient-window.png");
+});
+
+test("Rumble: the folder slug and the embed id open the same recording, and the page shows both", async ({ page }) => {
+ for (const id of ["v7rembd1", "v7rslug1"]) {
+ await page.goto(urls.ingredientHref("railrumble", id));
+ await expect(page.locator("[data-ingredient]")).toHaveAttribute("data-ingredient", "railrumble/v7rslug1");
+ await expect(page.locator("[data-ingredient-site-id]")).toHaveAttribute("data-ingredient-site-id", "v7rembd1");
+ await expect(pill(page, "used")).toHaveAttribute("data-pill-text", "1");
+ }
+ await openStage(page, "used");
+ await expect(page.locator('[data-used-row="reports/rail-r#rr1"]')).toBeVisible();
+ await openStage(page, "downloaded");
+ await expect(page.locator('[data-action-ask="persist"]')).toHaveText("Persist the whole recording…");
+});
+
+test("the entry points: the clip bench's Life cycle and Play's clip row link the clip's recording", async ({ page }) => {
+ await page.goto(urls.clipBenchHref("reports/rail-a", "ra1"));
+ await expect(page.locator("[data-bench-top] [data-bench-life]")).toHaveAttribute("href", RAIL);
+ await page.goto(urls.playHref("reports/rail-a", { clip: "ra1" }));
+ await expect(page.locator("[data-play-life]")).toHaveAttribute("href", RAIL, { timeout: 30_000 });
+});
+
+test("each action asks first -- what it costs, the queue it lands on -- then posts to the right route", async ({ page, request }) => {
+ await page.goto(RAIL);
+ // Downloaded: persist-videos, the editor's dry run first.
+ await openStage(page, "downloaded");
+ const persists = railAsks("persist-videos").length;
+ await runAction(page, "persist", { cost: "network", queue: /railchan channel's download queue/ });
+ const persist = railAsks("persist-videos").slice(persists);
+ expect(persist.map((r) => !!r.dryRun)).toEqual([true, false]);
+ expect(persist[1].items).toEqual([{ slug: "railchan", id: "railvid" }]);
+
+ // Transcribed: transcribe-one, on the GPU.
+ await openStage(page, "transcribed");
+ const transcribes = railAsks("transcribe-one").length;
+ await runAction(page, "transcribe", { cost: "gpu", queue: /transcribe-one:railchan:railvid/ });
+ expect(railAsks("transcribe-one").slice(transcribes)).toMatchObject([{ slug: "railchan", id: "railvid" }]);
+
+ // Windows: fetch-windows for the clip no window holds (rail-a's own body, narrowed to it), then a targeted evict.
+ await openStage(page, "windows");
+ const fetches = railAsks("fetch-windows").length;
+ await runAction(page, "fetch-reports/rail-a", { cost: "network", queue: /clips:youtube/ });
+ const fetch = railAsks("fetch-windows").slice(fetches);
+ expect(fetch.map((r) => !!r.dryRun)).toEqual([true, false]);
+ expect(fetch[1].items?.map((i) => `${i.slug}/${i.id}#${i.clipId}`)).toEqual(["railchan/railvid#ra2"]);
+ const evicts = railAsks("evict-clips").length;
+ await runAction(page, "evict-200.00-230.00", { cost: "disk" });
+ expect(railAsks("evict-clips").slice(evicts)).toMatchObject([{ slug: "railchan", id: "railvid", windows: ["200.00-230.00"] }]);
+
+ // Published: umtool's own link check (/api/report/links) -- the site refuses at once, so the link is unverified.
+ await openStage(page, "published");
+ const links = page.waitForRequest((r) => r.url().endsWith("/api/report/links") && r.method() === "POST");
+ await runAction(page, "links-reports/rail-b", { cost: "network" });
+ expect((await links).postDataJSON()).toEqual({ project: "reports/rail-b" });
+ await expect(page.locator('[data-published-row="reports/rail-b#rb1"]')).toHaveAttribute("data-state", "unverified", { timeout: 15_000 });
+
+ // Checked: a quote check, a umtool job (its transcriptions the editor's); it is let finish before the next spec.
+ await openStage(page, "checked");
+ await runAction(page, "quote-check-reports/rail-a", { cost: "gpu", queue: /umtool's job runner/ });
+ await expect(page.locator('[data-action-result="quote-check-reports/rail-a"]')).toContainText("quote check started");
+ await expect
+ .poll(async () => ((await (await request.get("/api/jobs")).json()) as { running: unknown }).running, { timeout: 90_000 })
+ .toBeNull();
+});