commit e3513528d09c1f26b9ca8cf1f30fa8d8d71e9833
parent ae7716baf18bd1ec337045076628c1167fbd1aa7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 22 Oct 2026 12:54:11 -0400
deck finale: entry layout guarded at every writer, the lint validates render.chrome, rail dates said once; tests, knobs doc, plans/deck-finale.md
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 337 insertions(+), 2 deletions(-)
diff --git a/plans/deck-finale.md b/plans/deck-finale.md
@@ -0,0 +1,53 @@
+# Deck finale — the timeline in primary view (lane `lane/deck-finale`, K3)
+
+Asked by the operator on 2026-10-22 for the Huck seizure-timeline video: "For the finale we can move the
+timeline into primary view, and prominently show our totals as well as 'seizures per year' and maybe
+'incidents per year'." Scope narrowed the same day to what the render needs (the Huck video's first release).
+
+## Rulings
+
+- A timeline clip's `layout: "finale"` (default `"clip"`) marks the finale. The marked clips are ONE run of
+ consecutive clips, with at least one clip before it and no clip after it; a card, still or teaser may follow.
+ `validateFinaleEntries` (finale.mjs) refuses anything else — the build, the lint, `structureErrors` and
+ `updateClip` (`umtool set <p> <clip> layout=…`; a write that adds a run problem is refused).
+- `render.chrome.deck.finale`: `video` side|corner|hidden (side), `motion` grow|cut (grow), `totals` (true),
+ `stats` ≤ 8 `{label ≤ 32, value ≤ 16, note? ≤ 60, color?}`, `statsTitle` ≤ 40, `railLabels` all|nodes (all).
+ Validated in `validateChrome` (unknown keys refused); no default is filled into `DECK_DEFAULTS`.
+- Geometry at 1080p (`finaleGeometry`, scaled with the frame): the rail across y 36–412, rail labels 28 px
+ and dates/marker labels 24 px (floor 24), totals numbers 128 px (floor 96), pips 2.5× the footer's (floor
+ 2×); the clip 768×432 at (1104, 448) ("side"), 538×302 bottom right ("corner"), none ("hidden").
+- Rail labels: each pip's deck title (else its date); consecutive equal labels share one, anchored between
+ their pips over a span line; a date the label already says is not repeated; one row, else two, else turned
+ 35°/50°/65° and hung down-left of the pip (the track starts far enough in for the first to read whole).
+- The schedule (`deckSchedule`): `segments[i].finale`, `finale {segments, video, motion, start, at, grow,
+ cover, hide, from, to, out?, box, footage, dates}`; each finale clip's footage moves into the box through
+ `schedule.moves` (the existing footage move, at the join, so `--chrome-only` changes it) — the first over
+ 0.8 s from `at` ("grow"), the rest from their first frame; "hidden" moves nothing.
+- "grow": `at` = start + max(D, D/2 + 0.08 + deck.motion.in) — the deck hands its words over to the first
+ finale clip as to any clip, then goes at `at`; the page draws the deck's ground, words, rail, tally and QR
+ where it stood and moves them up; the ground's hole shrinks with the footage on the move's smoothstep.
+ "cut": the page dissolves in over the run's first dissolve; the deck goes once it is covered.
+- A claim stamped on a finale clip counts at the finale's start (`landed` = `start`) and is not drawn
+ (`stamp: false`, `finale: true`): the finale's totals are final.
+- Popup posts on a finale clip are not drawn (no hold, no move); the feed keeps its column (covered).
+- The finale page is a full-frame window region (`finaleRegions`, compose-chrome `--region finale`), laid last.
+- Absent a valid finale run the schedule, the deck page and the graph are the bytes they were, `deck.finale`
+ set or not (finale.test.mjs).
+
+## Owed (deferred by the scope change)
+
+- `umtool/components/projects/FinaleEditor.tsx` (deck.finale fields, the stats list editor, a per-clip
+ "Finale layout" toggle list through `updateClip`'s `layout`), its one-line mount in OnscreenSection.tsx, and
+ OnscreenSection's `saveSettings` carrying `deck.finale` through (today a deck-settings save there drops it;
+ `umtool look deck.finale=…` and `PUT /api/report/chrome` keep it).
+- An umtool e2e spec for the editor.
+- umtool's live On-screen preview (`/api/report/chrome/preview`, `previewSchedule`) does not compose the
+ finale page; a build or `--chrome-only` renders it. A still: `compose-chrome.mjs --region finale --still`.
+- `verify-build` checks the finale window's frame count; the Huck cut has not been rebuilt here.
+
+## Files
+
+`umtool/report-to-video/`: `finale.mjs`, `chrome-finale.mjs`, `finale.test.mjs` (new); `deck.mjs`,
+`chrome-deck.mjs`, `compose-chrome.mjs`, `build-video.mjs`, `verify-build.mjs`, `lint.mjs`, `package.json`
+(`./finale`). `umtool/lib/report/manifest.mjs` (`updateClip`'s run guard, `structureErrors`),
+`lib/report/knobsCli.test.mjs`. Docs: `umtool/docs/knobs.md`.
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -45,6 +45,34 @@ claim's id and verdict and keeps its knobs while the id stays the same.
The default ladder: `master`, `1080p` (crf 22), `720p` (crf 23), `fit24` (at most 24 MiB). `umtool look` also sets
the look's keys (`transition=0.3`, …: [report-video.md](report-video.md#the-look-captions-loudness-shorts-release-36)).
+## The finale (the timeline in primary view)
+
+The cut's last clips with the footer's rail redrawn large across the top (every pip lit, the markers flagged,
+each pip's label), the tally's final counts large under it, stats cards beside them, and the clip in a smaller
+box with its title, source line and QR. The deck footer and popup posts are not drawn over it.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| clip `layout` | `clip` · `finale` (default `clip`) — one run of consecutive clips, after at least one clip, no clip after it (a card, still or teaser may follow). A write that would break the run is refused: mark from the last clip back, unmark from the first on | `umtool set <p> <clip> layout=finale` |
+| `deck.finale.video` | `side` (the clip 40 % wide, right) · `corner` (28 %, bottom right) · `hidden` (heard only) · default `side` | `umtool look <p> deck.finale='{"video":"corner"}'` |
+| `deck.finale.motion` | `grow` (the footer's rail, tally and QR travel to their places over 0.8 s once the deck's words are in; the footage shrinks into its box with them) · `cut` (the page dissolves in over the run's first dissolve) · default `grow` | same |
+| `deck.finale.totals` | bool · `true` — the verdicts' final counts, 128 px | same |
+| `deck.finale.stats` | ≤ 8 `{label ≤ 32, value ≤ 16, note? ≤ 60, color?}` (`color`: a `#hex` or `fg` `muted` `accent` `amber`) · none | same |
+| `deck.finale.statsTitle` | ≤ 40 characters · none | same |
+| `deck.finale.railLabels` | `all` (each pip's label, its date when the label does not already say it, the markers' labels) · `nodes` (the pips' labels only) · default `all` | same |
+
+Every key of `deck.finale` goes in one JSON value, e.g.
+
+```sh
+umtool look <p> deck.finale='{"statsTitle":"Seizures he reported","stats":[{"label":"2025 (from 26 Feb)","value":"5+","note":"4 incidents"}]}'
+umtool set <p> heartstrings layout=finale
+```
+
+The totals use the fact-check's verdict labels and colours (`factcheck.verdicts.<V>.label`). A claim whose stamp
+would land inside the finale counts as the finale opens and is not drawn. Without a finale entry the cut is the
+bytes it was, `deck.finale` set or not. The render: `<out>/<variant>/chrome/finale-frames/` (a full-frame window
+over the run, laid last); a still: `compose-chrome.mjs <manifest> --region finale --still <cut s> --png <file>`.
+
## Make variants, and the sync report
| | In umtool | From a terminal | Route |
diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs
@@ -72,6 +72,10 @@ test("umtool set: claim and audio knobs through the writers; key= clears; a bad
assert.equal("layout" in (await read(dir)).timeline[1], false);
assert.equal(await run("set", "c02", "layout=wide"), 1);
assert.match(lines.at(-1), /layout must be/);
+ // The finale is one run of the last clips: c01 alone would have c02 after it (finale.mjs).
+ assert.equal(await run("set", "c01", "layout=finale"), 1);
+ assert.match(lines.at(-1), /no clip may follow the finale/);
+ assert.equal("layout" in (await read(dir)).timeline[0], false);
});
test("umtool look: the fact-check's stamp, a verdict's stamp word, markers, layout, the ladder, a look key", async () => {
diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs
@@ -38,6 +38,7 @@ import { LOOK_KEYS, applyLookPatch, lookOf } from "yt-dlp-transcript-common/lib/
import { validateRoom } from "umtool-report-to-video/room";
import { applySectionEnter } from "./sections.mjs";
import { normalizeClaim, validateClaims } from "umtool-report-to-video/factcheck";
+import { validateFinaleEntries } from "umtool-report-to-video/finale";
import { validateClipAudio } from "umtool-report-to-video/clip-audio";
import { CLAIM_KNOBS, claimKnobsOf, claimKnobValue, normalizeClaimKnobPatch, stampingEntryId, variantsProblems } from "./knobs.mjs";
import { validateNarration } from "umtool-report-to-video/narration";
@@ -394,6 +395,12 @@ export async function updateClip(dir, clipId, patch, { token = null, edit = "tri
if (v === null || v === "" || v === "clip") delete entry.layout;
else if (v === "finale") entry.layout = "finale";
else throw new Error(`layout must be "finale" or "clip" (the default), not ${JSON.stringify(v)}`);
+ // The finale's run (finale.mjs): a write may not break it -- refused
+ // when it adds a problem the file did not have. Mark from the last
+ // clip back, unmark from the first on.
+ const was = new Set(validateFinaleEntries(JSON.parse(raw)));
+ const bad = validateFinaleEntries(manifest).filter((e) => !was.has(e));
+ if (bad.length) throw new Error(`layout: ${bad.join("; ")}`);
}
// ---- the walk's verdict -------------------------------------------------
@@ -1313,6 +1320,8 @@ function structureErrors(manifest) {
...validateClaims(manifest),
// The deck's markers follow clips: removing one a marker names is refused.
...validateDeckMarkers(manifest),
+ // The finale is one run of the last clips: moving a clip past it is refused.
+ ...validateFinaleEntries(manifest),
...validateTeasers(manifest),
...validateNarration(manifest),
...validateDrafted(manifest),
diff --git a/umtool/report-to-video/finale.mjs b/umtool/report-to-video/finale.mjs
@@ -344,6 +344,26 @@ export function finaleGeometry(render, { verdicts = 0, stats = 0, statsTitle = f
}
/**
+ * Does `label` already say the date `date` says, in any spelling ("26 Aug
+ * 2026", "Aug 26, 2026", "2026-08-26")? Then the date line would say it twice.
+ */
+export function sameDate(label, date) {
+ const tokens = (s) => {
+ const t = String(s ?? "").toLowerCase();
+ const iso = /(\d{4})-(\d{2})-(\d{2})/.exec(t);
+ if (iso) return { y: iso[1], m: Number(iso[2]), d: Number(iso[3]) };
+ const y = /\b(\d{4})\b/.exec(t)?.[1] ?? null;
+ const mi = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"].findIndex((m) => t.includes(m));
+ const d = /\b(\d{1,2})\b/.exec(t.replace(/\b\d{4}\b/, ""))?.[1] ?? null;
+ return { y, m: mi < 0 ? null : mi + 1, d: d === null ? null : Number(d) };
+ };
+ const a = tokens(label), b = tokens(date);
+ if (String(label).trim() === String(date).trim()) return true;
+ if (b.y === null || b.m === null) return String(label).includes(String(date));
+ return a.y === b.y && a.m === b.m && (b.d === null || a.d === b.d);
+}
+
+/**
* The large rail's pip labels, laid: consecutive pips with the same words
* share one label (anchored between them). Each label is `label` (the
* segment's deck title, else its date) over `date` (with `railLabels:
@@ -365,7 +385,7 @@ export function railLabelLayout(pips, geo, { dates = true } = {}) {
for (let i = 0; i < pips.length; i += 1) {
const label = String(pips[i].label ?? "").trim();
const raw = dates ? String(pips[i].date ?? "").trim() : "";
- const date = raw && !label.includes(raw) && raw !== label ? raw : "";
+ const date = raw && !sameDate(label, raw) ? raw : "";
const last = groups[groups.length - 1];
if (last && last.label === label && last.date === date) { last.to = i; continue; }
groups.push({ from: i, to: i, label, date });
diff --git a/umtool/report-to-video/finale.test.mjs b/umtool/report-to-video/finale.test.mjs
@@ -0,0 +1,218 @@
+// The deck's finale (finale.mjs, chrome-finale.mjs): validation of
+// `render.chrome.deck.finale` and an entry's `layout`, the run rule, the
+// schedule's `finale` (the clip's move, the deck's hide, stamps landed before
+// it), the legibility floors, the page -- and a cut without a finale written
+// byte for byte as before.
+//
+// Run with: node --test finale.test.mjs
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { deckChoreography, deckSchedule, estimateSchedule, validateChrome } from "./deck.mjs";
+import { deckHtml } from "./chrome-deck.mjs";
+import { finaleCues, finaleHtml, finaleLayout } from "./chrome-finale.mjs";
+import {
+ FINALE_DEFAULTS, FINALE_MIN, FINALE_MOTION, finaleGeometry, finaleRunProblems, railLabelLayout, validateFinaleEntries,
+ validateFinaleSettings,
+} from "./finale.mjs";
+import { validatorErrors } from "./lint.mjs";
+import { finaleRegions } from "./build-video.mjs";
+
+const PALETTE = { bg: "#101219", fg: "#f2f0ea", muted: "#979caa", accent: "#e5534b", amber: "#ffc860" };
+const CHROME = { engine: "hyperframes", layout: "deck" };
+const BASE = { width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE };
+const PROV = { siteOrigin: "https://example.test", channelSlug: "chan" };
+const STATS = [
+ { label: "2025 (from 26 Feb)", value: "5+", note: "4 incidents" },
+ { label: "2026 (to 21 Oct)", value: "23+", note: "8 incidents" },
+ { label: "His “seizure free” 18 months", value: "8+", note: "7 incidents, before the Costco refill" },
+];
+const renderWith = (deck = {}, extra = {}) => ({
+ ...BASE,
+ chrome: {
+ ...CHROME,
+ deck: { pip: { color: "verdict" }, ...deck },
+ factcheck: { verdicts: { CORROBORATED: { label: "Seizure episodes", color: "#6fa8dc" }, CONTRADICTED: { label: "Grift", color: "#e3b23c" } } },
+ ...extra,
+ },
+});
+
+// 26 clips, every other one claimed, the last marked for the finale.
+const N = 26;
+const clips = (finale = [N - 1]) => Array.from({ length: N }, (_, i) => ({
+ id: `c${i}`, type: "clip", video: `v${i}`, start: 100, end: 130,
+ onscreen: { title: `${(i % 28) + 1} Oct 2026` },
+ ...(i % 2 ? { claim: { id: `k${i}`, verdict: i % 4 === 1 ? "CORROBORATED" : "CONTRADICTED" } } : {}),
+ ...(finale.includes(i) ? { layout: "finale" } : {}),
+}));
+const DURS = Array.from({ length: N }, () => 30);
+const sched = (entries, render, D = 0.5) => deckSchedule({ entries, durs: entries.map(() => 30), D, render, provenance: PROV });
+
+test("deck.finale: every key validated, unknown keys refused, the defaults", () => {
+ assert.deepEqual(validateFinaleSettings(undefined), []);
+ assert.deepEqual(validateFinaleSettings({ video: "corner", motion: "cut", totals: false, railLabels: "nodes", statsTitle: "Seizures he reported", stats: STATS }), []);
+ const errs = validateFinaleSettings({
+ video: "left", motion: "slide", totals: "yes", railLabels: "some", statsTitle: "x".repeat(41), colour: 1,
+ stats: [{ label: "", value: "1" }, { label: "ok", value: "12345678901234567" }, { label: "ok", value: "1", note: "n".repeat(61), color: "red" }, { label: "ok", value: "1", size: 2 }],
+ });
+ for (const want of [
+ 'render.chrome.deck.finale.video must be "side", "corner", "hidden"',
+ 'render.chrome.deck.finale.motion must be "grow", "cut"',
+ 'render.chrome.deck.finale.railLabels must be "all", "nodes"',
+ "render.chrome.deck.finale.totals must be true or false",
+ "render.chrome.deck.finale.statsTitle is 41 characters (at most 40)",
+ "render.chrome.deck.finale.stats[0].label must not be empty",
+ "render.chrome.deck.finale.stats[1].value is 17 characters (at most 16)",
+ "render.chrome.deck.finale.stats[2].note is 61 characters (at most 60)",
+ "render.chrome.deck.finale.stats[2].color must be a #hex colour or one of fg, muted, accent, amber",
+ "render.chrome.deck.finale.stats[3].size is not a stat field (label, value, note, color)",
+ ]) assert.ok(errs.includes(want), `missing: ${want}\n${errs.join("\n")}`);
+ assert.ok(errs.some((e) => e.startsWith("render.chrome.deck.finale.colour is not a finale setting")));
+ assert.ok(validateFinaleSettings({ stats: Array.from({ length: 9 }, () => ({ label: "a", value: "1" })) }).includes("render.chrome.deck.finale.stats has 9 (at most 8)"));
+ assert.deepEqual(FINALE_DEFAULTS.video, "side");
+ assert.deepEqual(FINALE_DEFAULTS.motion, "grow");
+ assert.deepEqual(FINALE_DEFAULTS.railLabels, "all");
+ // Through validateChrome (the writer's and the build's door).
+ assert.deepEqual(validateChrome({ ...CHROME, deck: { finale: { stats: STATS, statsTitle: "Seizures he reported" } } }), []);
+ assert.ok(validateChrome({ ...CHROME, deck: { finale: { video: "pip" } } }).includes('render.chrome.deck.finale.video must be "side", "corner", "hidden"'));
+});
+
+test("layout: clip or finale, finale on a clip; one run, a clip before it, none after", () => {
+ assert.deepEqual(validateFinaleEntries({ timeline: clips() }), []);
+ assert.deepEqual(validateFinaleEntries({ timeline: clips([24, 25]) }), []);
+ assert.deepEqual(validateFinaleEntries({ timeline: [...clips([25]), { id: "end", type: "card" }] }), [], "a card may follow");
+ const bad = validateFinaleEntries({ timeline: [{ id: "a", type: "clip", layout: "wide" }, { id: "b", type: "card", layout: "finale" }] });
+ assert.ok(bad.includes('timeline[0] (a).layout must be "clip" or "finale"'), bad.join("\n"));
+ assert.ok(bad.includes('timeline[1] (b).layout: "finale" is a clip\'s layout, not a card\'s'), bad.join("\n"));
+ assert.ok(finaleRunProblems(clips([23, 25])).some((e) => e.includes("consecutive") && e.includes("c24")));
+ assert.ok(finaleRunProblems(clips([24])).some((e) => e.startsWith("no clip may follow the finale") && e.includes("c25")));
+ assert.ok(finaleRunProblems(clips([0])).some((e) => e.includes("needs a clip before it")));
+ // The lint names them, as the build refuses them.
+ assert.ok(validatorErrors({ render: renderWith(), timeline: clips([24]) }).some((e) => e.includes("no clip may follow")));
+ assert.ok(validatorErrors({ render: renderWith({ finale: { video: "pip" } }), timeline: clips() })
+ .includes('render.chrome.deck.finale.video must be "side", "corner", "hidden"'), "the lint validates deck.finale");
+ assert.deepEqual(validatorErrors({ render: renderWith({ finale: { stats: STATS } }), timeline: clips() }), []);
+});
+
+test("legibility at 1080p: rail labels ≥ 24 px, totals ≥ 96 px, pips ≥ 2× the footer's", () => {
+ for (const video of ["side", "corner", "hidden"]) {
+ const g = finaleGeometry(renderWith({ finale: { video, stats: STATS } }), { verdicts: 2, stats: 3, statsTitle: true });
+ assert.ok(g.rail.labelSize >= FINALE_MIN.railLabel && g.rail.dateSize >= FINALE_MIN.railLabel && g.rail.markerSize >= FINALE_MIN.railLabel, video);
+ assert.ok(g.totals.numberSize >= FINALE_MIN.totals, `${video}: ${g.totals.numberSize}`);
+ assert.ok(g.rail.x1 - g.rail.x0 >= 1600, "the rail runs the frame's width");
+ // Everything inside the frame and below the rail.
+ for (const box of [g.totals, g.stats, g.video, { ...g.qr, width: g.qr.size, height: g.qr.size }].filter(Boolean)) {
+ assert.ok(box.x >= 0 && box.y >= g.rail.bottom && box.x + box.width <= 1920 && box.y + box.height <= 1080, `${video}: ${JSON.stringify(box)}`);
+ }
+ }
+ const side = finaleGeometry(renderWith({ finale: { video: "side" } }));
+ assert.deepEqual(side.video, { x: 1104, y: 448, width: 768, height: 432 }, "40 % of the width");
+ assert.equal(finaleGeometry(renderWith({ finale: { video: "corner" } })).video.width, 538, "28 %");
+ assert.equal(finaleGeometry(renderWith({ finale: { video: "hidden" } })).video, null);
+ // Five verdicts still get ≥ 96 px numbers.
+ assert.ok(finaleGeometry(renderWith({ finale: {} }), { verdicts: 5, stats: 8 }).totals.numberSize >= 96);
+
+ const r = renderWith({ finale: { stats: STATS } });
+ const s = sched(clips(), r);
+ const L = finaleLayout(s, r);
+ for (const p of L.pips) assert.ok(p.size >= FINALE_MIN.pipScale * p.foot.size, `${p.id}: ${p.size} vs ${p.foot.size}`);
+ assert.equal(L.pips.length, N, "every clip has its pip, the finale's too");
+ assert.equal(L.pips.filter((p) => p.here).length, 1);
+});
+
+test("rail labels: shared words merge, crowded labels turn, every label stays on the frame", () => {
+ const g = finaleGeometry(renderWith({ finale: {} }));
+ const few = railLabelLayout([{ x: 300, label: "Arrives" }, { x: 900, label: "First seizure" }, { x: 1500, label: "ER" }], g);
+ assert.equal(few.mode, "row");
+ const crowd = railLabelLayout(Array.from({ length: 26 }, (_, i) => ({ x: 160 + i * 68, label: `${i} Oct 2026` })), g);
+ assert.equal(crowd.mode, "turned");
+ assert.ok(crowd.angle >= 35 && crowd.angle <= 65);
+ const merged = railLabelLayout([{ x: 200, label: "24 Aug" }, { x: 260, label: "24 Aug" }, { x: 900, label: "25 Aug" }], g);
+ assert.equal(merged.groups.length, 2);
+ assert.equal(merged.groups[0].x, 230);
+ // A date the label already says is not said twice.
+ assert.equal(railLabelLayout([{ x: 500, label: "Oct 21, 2026", date: "Oct 21, 2026" }], g).groups[0].date, "");
+ assert.equal(railLabelLayout([{ x: 500, label: "26 Aug 2026", date: "Aug 26, 2026" }], g).groups[0].date, "", "in another spelling");
+ assert.equal(railLabelLayout([{ x: 500, label: "26 Aug 2026", date: "2026-08-26" }], g).groups[0].date, "");
+ assert.equal(railLabelLayout([{ x: 500, label: "The ER", date: "Aug 24, 2026" }], g).groups[0].date, "Aug 24, 2026");
+ assert.equal(railLabelLayout([{ x: 500, label: "24 Aug 2026", date: "Aug 26, 2026" }], g).groups[0].date, "Aug 26, 2026", "a different day is said");
+});
+
+test("the schedule: the run, the clip's move, the deck's hide, stamps landed before it", () => {
+ const r = renderWith({ finale: { stats: STATS } });
+ const s = sched(clips([24, 25]), r);
+ const f = s.finale;
+ const first = s.segments[24];
+ assert.deepEqual(f.segments, ["c24", "c25"]);
+ assert.equal(f.start, first.start);
+ assert.ok(Math.abs(f.at - (first.start + Math.max(0.5, 0.25 + 0.08 + 0.45))) < 1e-3, "grow waits for the dissolve and the words");
+ assert.equal(f.hide, f.at);
+ assert.ok(Math.abs(f.cover - (f.at + FINALE_MOTION.cover)) < 1e-3);
+ assert.equal(f.to, s.total);
+ assert.ok(s.segments[24].finale && s.segments[25].finale && !s.segments[23].finale);
+ // Each finale clip's footage moves into the box: the first grows, the next is there.
+ const moves = s.moves.filter((m) => m.segment === "c24" || m.segment === "c25");
+ assert.equal(moves[0].seconds, FINALE_MOTION.grow);
+ assert.ok(Math.abs(moves[0].segmentAt - (f.at - first.start)) < 1e-3);
+ assert.deepEqual([moves[1].seconds, moves[1].segmentAt], [0, 0]);
+ assert.deepEqual(moves[0].to, f.box);
+ // c25's claim would stamp inside the finale: counted at its start, not drawn.
+ const k25 = s.factcheck.stamps.find((x) => x.claim === "k25");
+ assert.deepEqual([k25.landed, k25.stamp, k25.finale], [f.start, false, true]);
+ assert.ok(s.factcheck.stamps.every((x) => x.landed <= f.start));
+ // The deck hands over into the run, and goes at `hide`.
+ const ch = deckChoreography(s, r);
+ assert.ok(ch.handovers.some((h) => h.to === "c24"));
+ assert.ok(!ch.handovers.some((h) => h.to === "c25"));
+ assert.deepEqual(ch.visibility.find((v) => v.i === 24), { i: 24, hide: true, at: [f.hide, f.hide] });
+ // "cut": the page dissolves in over the run's first dissolve; the deck goes once covered.
+ const c = sched(clips(), renderWith({ finale: { motion: "cut", video: "hidden" } })).finale;
+ assert.deepEqual([c.at, c.grow, c.hide, c.box], [c.start, 0, c.cover, null]);
+ // A card after the run: the page leaves through its dissolve.
+ const withCard = deckSchedule({ entries: [...clips(), { id: "end", type: "card", seconds: 5 }], durs: [...DURS, 5], D: 0.5, render: r, provenance: PROV });
+ assert.deepEqual(withCard.finale.out, [withCard.segments[N].start, withCard.segments[N].start + 0.5].map((v) => Math.round(v * 1000) / 1000));
+});
+
+test("the page: the large rail, the totals at their final counts, the stats, the clip's caption", () => {
+ const r = renderWith({ finale: { statsTitle: "Seizures he reported", stats: STATS } });
+ const s = sched(clips(), r);
+ const win = finaleRegions(r, "/tmp/x", s)[0].window;
+ const html = finaleHtml(s, r, win, {});
+ assert.equal((html.match(/class="pip"/g) ?? []).length, N);
+ assert.equal((html.match(/class="pl[ "]/g) ?? []).length, N, "a label per pip (none shared here)");
+ assert.equal((html.match(/class="sc"/g) ?? []).length, 3);
+ assert.match(html, /Seizures he reported/);
+ assert.match(html, /<div class="tnum">6<\/div><div class="tlab">Grift<\/div>/);
+ assert.match(html, /<div class="tnum">7<\/div><div class="tlab">Seizure episodes<\/div>/);
+ assert.match(html, /His “seizure free” 18 months/);
+ assert.match(html, /class="ct">26 Oct 2026</);
+ assert.match(html, /data-composition-id="finale"/);
+ // Every cue states its from; the hole eases on the move's smoothstep.
+ const { cues } = finaleCues(s, r);
+ assert.ok(cues.every((c) => Object.keys(c.to).every((p) => p in c.from)));
+ const hole = cues.find((c) => c.k === "hole");
+ assert.equal(hole.ease, "smoothstep");
+ assert.equal(hole.at, s.finale.at);
+ assert.equal(hole.dur, FINALE_MOTION.grow);
+ // The region: the whole frame, a window from `at` to the end.
+ const reg = finaleRegions(r, "/tmp/x", s)[0];
+ assert.deepEqual([reg.x, reg.y, reg.width, reg.height], [0, 0, 1920, 1080]);
+ assert.ok(reg.offset <= s.finale.from && reg.offset > s.finale.from - 1 / 30);
+});
+
+test("byte identity: no finale entry -- the schedule and the deck page are as they were, finale settings or not", () => {
+ const entries = clips([]);
+ const plain = renderWith();
+ const withSettings = renderWith({ finale: { stats: STATS, video: "corner" } });
+ const a = sched(entries, plain);
+ const b = sched(entries, withSettings);
+ assert.equal(JSON.stringify(a), JSON.stringify(b));
+ assert.equal(a.finale, undefined);
+ assert.ok(a.segments.every((x) => !("finale" in x)));
+ assert.equal(deckHtml(a, plain), deckHtml(b, withSettings));
+ assert.deepEqual(finaleRegions(plain, "/tmp/x", a), []);
+ // A finale that breaks the run is not drawn (the validators refuse it).
+ assert.equal(sched(clips([24]), withSettings).finale, undefined);
+ // An estimate carries the finale as the build's schedule does.
+ assert.ok(estimateSchedule({ render: withSettings, timeline: clips(), provenance: PROV }).finale);
+});
diff --git a/umtool/report-to-video/lint.mjs b/umtool/report-to-video/lint.mjs
@@ -78,7 +78,7 @@ import { existsSync } from "node:fs";
import path from "node:path";
import {
deckOn, deckQrUrl, postArchiveUrl, postNativeId, postQrUrl, resolveDeck, teaserLines,
- validateCutEdits, validateDeckMarkers, validatePosts, validateTeasers,
+ validateChrome, validateCutEdits, validateDeckMarkers, validatePosts, validateTeasers,
} from "./deck.mjs";
import { validateClaims } from "./factcheck.mjs";
import { validateClipAudioEntries } from "./clip-audio.mjs";
@@ -251,6 +251,9 @@ export function validatorErrors(whole) {
];
if (deckOn(whole.render)) {
errors.push(...validatePosts(whole.posts, whole.timeline ?? [], whole.render).map((m) => `posts: ${m}`));
+ // render.chrome itself (deck.finale included), as the build refuses it.
+ const { chrome, ...rest } = whole.render;
+ errors.push(...validateChrome(chrome, rest));
// The deck's markers against the whole timeline, as the build refuses them.
errors.push(...validateDeckMarkers(whole));
}