commit 009568a14e634f644b0e307a723c3c90f69c6ff4
parent 28c114ed64c38042d6fa63d034e8174362eef1e7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 23:17:31 -0500
umtool: the measure extras' pages primed for a window; Play spec and fixture
A WINDOW of a whole cue page seeked to exactly 0 -- the renderer's first
frame -- is no change from where its timeline stands, so GSAP renders nothing
and the frame shows init (everything hidden) instead of the cut's state at
`from`; with frame keys every frame keyed like it is reused from that empty
capture (seen in a HyperFrames window render of the diet badge: frames 1-8
empty, then the stamp). cuePageHtml takes `primeWindow` (opt-in: the measure
extras pass it, every other cue page is byte-identical) and renders a window
once at its end and back at its start before anything seeks it. The diet
badge's shake no longer clamps its negative steps to 1 px.
play-measure.spec.ts opens Play the cut on play-measure-fixture -- the Play
cut with a synthetic measure slice laid on its estimate's segments
(e2e/fixtures/measure-extras-fixture.mjs) -- and checks the four pages are
laid in z order, post ready, and draw the playhead's state as it is seeked:
c04 (lose 65 by Christmas, 50 days left; ≈390 and 365.7, +24.3 lb; 11 days,
none posted, the check's words; carnivore #2), back to the cut's start
(nothing), c02 (lose 100 ×2, keto #1, no promise yet).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
6 files changed, 208 insertions(+), 5 deletions(-)
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -50,6 +50,7 @@ import { makeModulesFixture } from "./modules-fixture.mjs";
import { makeMarksFixture } from "./marks-fixture.mjs";
import { makeLivePreviewFixture } from "./live-preview-fixture.mjs";
import { makePlayCutFixture } from "./play-cut-fixture.mjs";
+import { makeMeasureExtrasFixture } from "./measure-extras-fixture.mjs";
import { makeVideoEntryFixture } from "./video-entry-fixture.mjs";
import { makeCutEditingFixture } from "./cut-editing-fixture.mjs";
import { makeReelFixture } from "./reel-fixture.mjs";
@@ -2029,6 +2030,10 @@ pm.timeline = pm.timeline.map((e) => (e.id === "c03" ? { ...e, verdict: "incorre
writeFileSync(pmFile, JSON.stringify(pm, null, 2) + "\n");
}
+// The same cut with a measure slice in its schedule (play-measure.spec.ts): the weight
+// video's goal stack, moving start, promise clock and diet badge drawn in Play the cut.
+await makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+
// Wrong speaker in Play the cut (play-modules.spec.ts), which WRITES (removes c02, then undoes):
// its own copy, so no other spec's cut moves under it.
makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), name: "play-wrong-fixture", title: "The Play Wrong Speaker Fixture" });
diff --git a/umtool/e2e/fixtures/measure-extras-fixture.mjs b/umtool/e2e/fixtures/measure-extras-fixture.mjs
@@ -0,0 +1,77 @@
+// What play-measure.spec.ts plays: play-cut-fixture's short deck cut on playvid
+// with a MEASURE slice in its schedule (the weight video's measure extras:
+// report-to-video/measure-extras.mjs) -- the goal stack, the moving start, the
+// promise clock and the diet badge drawn in Play the cut through the module
+// contract's `play`. The cut is never built: its out/sourced/schedule.json is
+// the estimate's own schedule (deck.mjs estimateSchedule, so Play's clock is
+// the estimate's) with a synthetic measure slice laid on its segments --
+// what the build writes for a manifest with a measure ledger once the
+// measure-ledger lane lands.
+//
+// c01 +0.2 diet keto #1 c01 +0.4 goal "lose 100"
+// c02 +0.2 remembered ≈390 c02 +0.4 goal "lose 100" again (×2) c02 +0.6 remembered 365.7
+// c03 +0.2 diet carnivore #2 c03 +0.4 promise "scale video", said 23 Oct
+// c04 +0.2 goal "lose 65" by Christmas (226.5) c04 +0.4 check "just pull up a video …" (3 Nov)
+//
+// Synthetic, like every fixture.
+import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+import { makePlayCutFixture } from "./play-cut-fixture.mjs";
+
+/** The measure slice's events on the cut's segments, and the state after each. */
+export function measureFor(segments) {
+ const at = (id, dt) => {
+ const s = segments.find((x) => x.id === id);
+ if (!s) throw new Error(`measure fixture: no segment ${id}`);
+ return Math.round((s.start + dt) * 1000) / 1000;
+ };
+ const ev = (o) => ({ asOf: null, value: null, qualifier: null, deadline: null, regime: null, event: null, run: null, source: "clip", label: "", quote: "", ...o });
+ const events = [
+ ev({ t: at("c01", 0.2), row: "r01", segment: "c01", date: "2026-07-19", kind: "diet", display: "Keto", regime: "keto", event: "start" }),
+ ev({ t: at("c01", 0.4), row: "w01", segment: "c01", date: "2026-07-19", kind: "goalLoss", value: -100, display: "lose 100" }),
+ ev({ t: at("c02", 0.2), row: "w02", segment: "c02", date: "2026-08-01", kind: "remembered", value: 390, qualifier: "≈", asOf: "2025-02-01", display: "390 lb" }),
+ ev({ t: at("c02", 0.4), row: "w03", segment: "c02", date: "2026-08-01", kind: "goalLoss", value: -100, display: "lose 100" }),
+ ev({ t: at("c02", 0.6), row: "w04", segment: "c02", date: "2026-08-02", kind: "remembered", value: 365.7, asOf: "2023-12-31", display: "365.7 lb" }),
+ ev({ t: at("c03", 0.2), row: "r02", segment: "c03", date: "2026-09-01", kind: "diet", display: "Carnivore", regime: "carnivore", event: "on" }),
+ ev({ t: at("c03", 0.4), row: "p01", segment: "c03", date: "2026-10-23", kind: "promise", display: "scale video", label: "I'll post a video of the scale", source: "post" }),
+ ev({ t: at("c04", 0.2), row: "w05", segment: "c04", date: "2026-10-26", kind: "goalLoss", value: -65, display: "lose 65", deadline: "by Christmas" }),
+ ev({ t: at("c04", 0.4), row: "p02", segment: "c04", date: "2026-11-03", kind: "promiseCheck", display: "brush-off", label: "\"just pull up a video from three months ago\"", promise: "p01" }),
+ ];
+ const keto = { regime: "keto", display: "Keto", row: "r01", n: 1 };
+ const carn = { regime: "carnivore", display: "Carnivore", row: "r02", n: 2 };
+ const prom = (checks) => [{ row: "p01", said: "2026-10-23", what: "post a video of the scale", due: null, kept: false, checks }];
+ const base = { current: null, remembered: [], lost: { total: 0, runs: [] }, net: { from: null, to: null } };
+ const st = (i, o) => ({ ...base, t: events[i].t, goal: null, goals: [], diet: null, promises: [], ...o });
+ const g100 = { value: null, loss: 100, deadline: null, row: "w01" };
+ const state = [
+ { ...base, t: 0, goal: null, goals: [], diet: null, promises: [] },
+ st(0, { diet: keto }),
+ st(1, { diet: keto, goal: g100, goals: ["w01"] }),
+ st(2, { diet: keto, goal: g100, goals: ["w01"] }),
+ st(3, { diet: keto, goal: { ...g100, row: "w03" }, goals: ["w01", "w03"] }),
+ st(4, { diet: keto, goal: { ...g100, row: "w03" }, goals: ["w01", "w03"] }),
+ st(5, { diet: carn, goal: { ...g100, row: "w03" }, goals: ["w01", "w03"] }),
+ st(6, { diet: carn, goal: { ...g100, row: "w03" }, goals: ["w01", "w03"], promises: prom([]) }),
+ st(7, { diet: carn, goal: { value: 226.5, loss: 65, deadline: "by Christmas", row: "w05" }, goals: ["w01", "w03", "w05"], promises: prom([]) }),
+ st(8, { diet: carn, goal: { value: 226.5, loss: 65, deadline: "by Christmas", row: "w05" }, goals: ["w01", "w03", "w05"], promises: prom(["p02"]) }),
+ ];
+ return {
+ version: 1, unit: "lb", scale: { min: 220, max: 400 }, asOfRender: "2026-11-05", scopes: ["weight", "regime"],
+ events, hidden: [], state,
+ totals: { goals: 3, goalRepeats: { "lose 100": 2 }, diets: 2, peakDrift: [365.7, 390] },
+ };
+}
+
+/**
+ * @param {{ reports: string, deckManifest: Function, cachedWindow: string }} o
+ */
+export async function makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow }) {
+ const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: "play-measure-fixture", title: "The Play Measure Fixture" });
+ const { estimateSchedule } = await import("../../report-to-video/deck.mjs");
+ const manifest = JSON.parse(readFileSync(path.join(dir, "video.manifest.json"), "utf8"));
+ const schedule = estimateSchedule(manifest);
+ mkdirSync(path.join(dir, "out", "sourced"), { recursive: true });
+ writeFileSync(path.join(dir, "out", "sourced", "schedule.json"), JSON.stringify({ ...schedule, measure: measureFor(schedule.segments) }, null, 2) + "\n");
+ return { dir };
+}
diff --git a/umtool/e2e/play-measure.spec.ts b/umtool/e2e/play-measure.spec.ts
@@ -0,0 +1,103 @@
+import { test, expect, type Page } from "@playwright/test";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// Play the cut draws the weight video's measure extras (umtool/docs/knobs.md,
+// Modules: Goal stack, Moving start, Promise clock, Diet badge): each module
+// reads the schedule's `measure` slice and declares `play`, so the full preview
+// returns it as a layer -- its own page, composed for preview, laid at its
+// region over the footage and seeked on the cut clock (`deck:seek`), posting
+// `<region>:ready` once it can be.
+//
+// Fixture: e2e/fixtures/measure-extras-fixture.mjs as play-measure-fixture --
+// the Play cut with a synthetic measure slice on its segments:
+// c01 keto #1, "lose 100" c02 ≈390, "lose 100" again, 365.7
+// c03 carnivore #2, the scale-video promise (23 Oct)
+// c04 "lose 65" by Christmas (226.5), the check (3 Nov)
+// ---------------------------------------------------------------------------
+
+const PROJECT = "reports/play-measure-fixture";
+const IDS = ["diet", "peak", "goals", "promise"] as const;
+
+const root = (page: Page) => page.locator("[data-play-cut]");
+const layer = (page: Page, id: string) => page.locator(`[data-play-layer="${id}"]`);
+
+/**
+ * What a module's page draws at the playhead: the words of the state blocks on
+ * screen, or null while its panel is down -- read inside its own page, which is
+ * what the render captures.
+ */
+const shown = (page: Page, id: string) =>
+ page
+ .frameLocator(`[data-testid="play-layer-${id}-iframe"]`)
+ .locator("#pn")
+ .evaluate((pn) => {
+ if (Number(getComputedStyle(pn).opacity) < 0.5 || getComputedStyle(pn).visibility === "hidden") return null;
+ const on = [...pn.querySelectorAll<HTMLElement>(".st")].filter((e) => getComputedStyle(e).visibility !== "hidden" && Number(getComputedStyle(e).opacity) > 0.5);
+ return on.map((e) => (e.textContent ?? "").replace(/\s+/g, " ").trim()).join(" | ");
+ });
+
+/** Every layer laid and its page ready (it posted `<region>:ready`). */
+async function ready(page: Page) {
+ await expect(root(page)).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 });
+ await expect(page.locator('[data-testid="play-deck"]')).toBeVisible({ timeout: 30_000 });
+ for (const id of IDS) {
+ await expect(layer(page, id)).toHaveAttribute("data-play-layer-up", "1", { timeout: 30_000 });
+ await expect(page.getByTestId(`play-layer-${id}`)).toHaveAttribute("data-feed-ready", "1", { timeout: 30_000 });
+ }
+}
+
+test.beforeEach(() => {
+ test.setTimeout(150_000);
+});
+
+test("the goal stack, the moving start, the promise clock and the diet badge play in Play the cut, seeked to the playhead's state", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+
+ // A second into c04: every event before it has happened.
+ await page.goto(urls.playHref(PROJECT, { clip: "c04", at: 1 }));
+ await ready(page);
+ await expect(root(page)).toHaveAttribute("data-play-item", "c04");
+ // Laid in the build's z order: diet (66), peak (67), goals (68), the promise clock (95, over the finale).
+ expect(await page.locator("[data-play-layer]").evaluateAll((els) => els.map((e) => e.getAttribute("data-play-layer")))).toEqual([...IDS]);
+
+ await expect.poll(() => shown(page, "goals"), { timeout: 10_000 }).toContain("LOSE 65");
+ const goals = await shown(page, "goals");
+ expect(goals).toContain("by Christmas · 50 days left");
+ expect(goals).toContain("needs 226.5");
+ expect(goals).toContain("×2");
+ expect(goals).toContain("3 goals set");
+ const peak = await shown(page, "peak");
+ expect(peak).toContain("≈390");
+ expect(peak).toContain("365.7");
+ expect(peak).toContain("+24.3 lb");
+ const promise = await shown(page, "promise");
+ expect(promise).toContain("scale video offered 23 Oct");
+ expect(promise).toContain("11 days");
+ expect(promise).toContain("None posted");
+ expect(promise).toContain("just pull up a video from three months ago");
+ const diet = await shown(page, "diet");
+ expect(diet).toContain("Carnivore");
+ expect(diet).toContain("Diet #2");
+ await page.screenshot({ path: test.info().outputPath("play-measure-c04.png") });
+
+ // Back to the cut's start (c01's first frame): the pages are seeked back -- nothing has been said yet.
+ await page.locator('[data-play-row="c01"]').press("Enter");
+ await expect(root(page)).toHaveAttribute("data-play-item", "c01");
+ await expect(root(page)).toHaveAttribute("data-play-state", "paused");
+ expect(Number(await root(page).getAttribute("data-play-t"))).toBeLessThan(0.2);
+ for (const id of IDS) await expect.poll(() => shown(page, id), { timeout: 10_000 }).toBeNull();
+ await page.screenshot({ path: test.info().outputPath("play-measure-start.png") });
+
+ // A second into c02: keto, "lose 100" said twice (one note, ×2), two starts told, no promise yet.
+ await page.goto(urls.playHref(PROJECT, { clip: "c02", at: 1 }));
+ await ready(page);
+ await expect(root(page)).toHaveAttribute("data-play-item", "c02");
+ await expect.poll(() => shown(page, "goals"), { timeout: 15_000 }).toContain("×2");
+ expect(await shown(page, "goals")).toContain("2 goals set");
+ expect(await shown(page, "diet")).toContain("Keto");
+ expect(await shown(page, "diet")).toContain("Diet #1");
+ expect(await shown(page, "peak")).toContain("365.7");
+ expect(await shown(page, "promise")).toBeNull();
+ await page.screenshot({ path: test.info().outputPath("play-measure-c02.png") });
+});
diff --git a/umtool/report-to-video/chrome-cues.mjs b/umtool/report-to-video/chrome-cues.mjs
@@ -94,7 +94,14 @@ function fontFaces(fonts) {
* @param {{ id: string, W: number, H: number, fps: number, fonts?: {regular?: string, bold?: string},
* gsapSrc?: string, css: string, body: string, init: object, cues: object[],
* whole?: { total: number, from?: number, duration?: number | null, ids?: string[] },
- * window?: { from: number, dur: number } }} p
+ * window?: { from: number, dur: number }, primeWindow?: boolean }} p
+ *
+ * `primeWindow` (opt-in, the measure extras'): a WINDOW of a whole page is
+ * rendered once at its end and back at its start before anything seeks it. A
+ * window's timeline seeked to exactly 0 -- the renderer's first frame -- is
+ * no change from where it stands, so GSAP renders nothing and the frame shows
+ * init (everything hidden) instead of the cut's state at `from`; with frame
+ * keys, every frame keyed like it is reused from that empty capture.
*/
export function cuePageHtml(p) {
const { id, W, H, fps, css, body, init, cues } = p;
@@ -170,7 +177,9 @@ export function cuePageHtml(p) {
if (!el) continue;
inner.fromTo(el, c.from, { ...c.to, duration: c.dur, ease: c.ease, immediateRender: false }, c.at);
}
- ${play}
+ ${play}${p.primeWindow && !p.window ? `
+ // Primed: a window seeked to 0 must draw the cut's state at its start (see primeWindow).
+ if (S.window) tl.progress(1, true).progress(0, true);` : ""}
window.__timelines = window.__timelines || {};
window.__timelines["${id}"] = tl;
diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs
@@ -61,7 +61,7 @@ function stateCues(states, spans, { overlap = 0, own = () => [] } = {}, initExtr
const page = (id, schedule, opts, { geo, fps }, css, body, init, cues, ids) => cuePageHtml({
id, W: geo.width, H: geo.height, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css: `${displayFace(opts.fonts)}\n ${css}`,
- body, init, cues, whole: { total: schedule.total, from: opts.from, duration: opts.duration, ids },
+ body, init, cues, whole: { total: schedule.total, from: opts.from, duration: opts.duration, ids }, primeWindow: true,
});
// ---------------------------------------------------------------------------
@@ -339,7 +339,7 @@ export function promiseHtml(schedule, render, opts = {}) {
const css = `
#pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
.st { position: absolute; inset: 0; visibility: hidden; opacity: 0; border-radius: ${px(10)}px;
- background: ${rgba(pal.bg, 0.92)}; border-left: ${px(6)}px solid ${red};
+ background: ${rgba(pal.bg, 0.95)}; border-left: ${px(6)}px solid ${red};
box-shadow: 0 ${px(8)}px ${px(26)}px rgba(0, 0, 0, 0.45); padding: ${px(14)}px ${px(22)}px ${px(12)}px ${px(22)}px; }
.st.kept { border-left-color: ${green}; }
.row { display: flex; flex-direction: column; gap: ${px(4)}px; }
@@ -404,7 +404,7 @@ export function dietHtml(schedule, render, opts = {}) {
init[k] = { scale: 2.3, rotation: -15, opacity: 0 };
ev.push({ k, at: st.at, dur: SLAM, to: { scale: 1, rotation: -5, opacity: 1 }, ease: "power4.in" });
init[`s${j}.w`] = { x: 0 };
- const shake = [px(8), px(-6), px(4), px(-2), 0];
+ const shake = [8, -6, 4, -2, 0].map((v) => Math.round(v * F.k));
shake.forEach((x, n) => ev.push({ k: `s${j}.w`, at: st.at + SLAM + n * 0.045, dur: 0.045, to: { x }, ease: "sine.inOut" }));
} else {
init[k] = { opacity: 0 };
diff --git a/umtool/report-to-video/measure-extras.test.mjs b/umtool/report-to-video/measure-extras.test.mjs
@@ -10,6 +10,7 @@ import test from "node:test";
import { fileURLToPath } from "node:url";
import { goalsHtml, dietHtml, peakHtml, promiseHtml, spreadLabels, stampSize } from "./chrome-measure-extras.mjs";
+import { cuePageHtml } from "./chrome-cues.mjs";
import { estimateSchedule, validateChrome } from "./deck.mjs";
import { frameKeys } from "./frame-keys.mjs";
import {
@@ -156,6 +157,14 @@ test("the pages: a block per state, each an item gated by its own autoAlpha, key
}
});
+test("a window of a page is primed, so the renderer's first frame (a seek to 0) draws the cut's state at its start", () => {
+ const { html } = dietHtml(schedule(), RENDER, { fonts: {}, from: 399.4, duration: 1.2 });
+ assert.match(html, /if \(S\.window\) tl\.progress\(1, true\)\.progress\(0, true\);/);
+ // Opt-in: every other cue page is the page it was.
+ const other = cuePageHtml({ id: "x", W: 10, H: 10, fps: 30, css: "", body: "", init: {}, cues: [], whole: { total: 5, from: 1, duration: 2 } });
+ assert.doesNotMatch(other, /progress\(1, true\)/);
+});
+
test("geometry: an anchor in the footage box, or x/y on the frame, scaled; never off the frame", () => {
const f = { x: 173, y: 2, width: 1574, height: 886 };
const g = measureExtraGeometry("goals", RENDER);