commit 83e9965238d4712f1d9713cdc93f4ba8763d3a44
parent c6d103d0a514a76b4df26bdf91b28a955b166b98
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 3 Nov 2026 14:08:18 -0500
umtool e2e: a word zoom on the post bench -- Get word timings (the stub editor's transcribe op writes the words it "heard" where `out` says), click a word, Zoom here, saved; Play pushes the card in on it at its time
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/umtool/e2e/fixtures/editor-stub-case-stages.mjs b/umtool/e2e/fixtures/editor-stub-case-stages.mjs
@@ -1,9 +1,12 @@
// The editor's side of a research case's verify, leads and evidence stages
// (release 38 lane C), stubbed:
//
-// POST /api/ops/transcribe {path, start, end, whilePaused?}
+// POST /api/ops/transcribe {path, start, end, whilePaused?, words?, out?}
// job "cs-<n>", done after 0.6 s, its log ending with the editor's
-// `@@transcribe-result {…}` -- the text the fixture's HEARD
+// `@@transcribe-result {…}` -- the text the fixture's HEARD; with `out`, the
+// result written there, and with `words` its words: `<path>.heard.json`
+// beside the file when a fixture put one there (a word zoom's take), else
+// HEARD's words, a third of a second each
// POST /api/ops/wayback-lookup {url}
// 403 {refusal: "excluded"} for the fixture's EXCLUDED_URL, else two captures
// POST /api/ops/fetch-posts {slug, …}
@@ -15,6 +18,7 @@
// worker, the Wayback Machine or a forum. Every request is recorded by the
// main stub's `record`.
+import { existsSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { EXCLUDED_URL, HEARD } from "./case-stages-fixture.mjs";
@@ -64,6 +68,11 @@ export function caseStagesRoute(req, res, url, ctx) {
};
const id = job("transcribe-file", [`Transcribe ${path.basename(body.path)} [${body.start}, ${body.end})${body.whilePaused ? " while paused" : ""}`], (j) => {
j.log.push(`@@transcribe-result ${JSON.stringify(result)}`);
+ if (typeof body.out === "string" && path.isAbsolute(body.out)) {
+ const sidecar = `${body.path}.heard.json`;
+ const words = body.words !== true ? undefined : existsSync(sidecar) ? JSON.parse(readFileSync(sidecar, "utf8")) : HEARD.split(/\s+/).map((w, i) => ({ w, start: i / 3, end: i / 3 + 0.3 }));
+ writeFileSync(body.out, JSON.stringify({ ...result, ...(words ? { words } : {}) }));
+ }
});
json(res, 200, { ok: true, jobId: id });
})
diff --git a/umtool/e2e/fixtures/post-narration-fixture.mjs b/umtool/e2e/fixtures/post-narration-fixture.mjs
@@ -39,6 +39,8 @@ export function makePostNarrationFixture({ reports, deckManifest }) {
const takes = path.join(dir, "narration", "posts", "11");
mkdirSync(takes, { recursive: true });
ff(["-f", "lavfi", "-i", "sine=frequency=262:sample_rate=48000:duration=2", "-ac", "1", "-c:a", "pcm_s16le", path.join(takes, "take-1.orpheus-zac.wav")]);
+ // What the editor's stubbed transcription "hears" in that take (a word zoom's word timings; editor-stub-case-stages.mjs).
+ writeFileSync(path.join(takes, "take-1.orpheus-zac.wav.heard.json"), JSON.stringify([["The", 0.1, 0.3], ["video", 0.35, 0.7], ["speaks", 0.75, 1.1], ["for", 1.15, 1.3], ["itself.", 1.35, 1.8]].map(([w, start, end]) => ({ w, start, end }))));
const base = (id, text, o = {}) => ({
type: "post", id, post: `narrchan-x/${id.slice(2)}`, platform: "x", author: "Narr Subject", handle: "narrsubject",
date: "2026-10-30T10:00:00.000Z", text, url: `https://x.com/narrsubject/status/${id}`, engagement: { likes: 4 }, subjects: ["narrsubject"], ...o,
diff --git a/umtool/e2e/post-narration.spec.ts b/umtool/e2e/post-narration.spec.ts
@@ -279,6 +279,52 @@ test.describe("the recording session", () => {
});
});
+test("A WORD ZOOM: Get word timings (the editor's transcription), click a word -> Zoom here -> saved; Play pushes the card in on it at its time", async ({ page }) => {
+ await page.setViewportSize({ width: 1500, height: 1100 });
+ await page.goto(urls.postBenchHref(PROJECT, "p-11"));
+ const panel = page.locator('[data-post-zoom-panel="p-11"]');
+ await expect(panel.locator("[data-post-zoom-words-state]")).toHaveText(/no word timings/);
+ // The take's word timings: the editor's transcribe op (the stub "hears" the take), aligned to its script.
+ await panel.locator("[data-post-zoom-get-words]").click();
+ await expect(panel.locator("[data-post-zoom-words-state]")).toHaveText(/the take is timed \(5 words\)/, { timeout: 20_000 });
+ const t0 = (narr("p-11") as { takes: Array<Take & { words?: Array<{ w: string; start: number }> }> }).takes[0];
+ expect(t0.words?.[2]).toEqual({ w: "speaks", start: 0.75, end: 1.1 });
+ // Click "speaks" and zoom on it.
+ await panel.locator('[data-post-zoom-word="2"]').click();
+ await expect(panel.locator("[data-post-zoom-sel]")).toHaveText("“speaks”");
+ await panel.locator("[data-post-zoom-here]").click();
+ await expect(panel.locator('[data-post-zoom-fx="0"]')).toBeVisible();
+ expect((timeline().find((e) => e.id === "p-11") as { fx?: unknown[] }).fx).toEqual([{ kind: "word-zoom", match: "speaks" }]);
+ // Its time: the read's lead 0.4 + the word's 0.75 s in the take.
+ await expect(panel.locator("[data-post-zoom-at]")).toHaveAttribute("data-post-zoom-at", "1.15");
+ await expect(page.locator('[data-post-bench-zoom-mark="0"]')).toBeVisible();
+ await expect(page.locator('[data-post-lane-zoom="0"]')).toBeVisible();
+ // A knob: scale 3, one write.
+ const scale = panel.locator('[data-post-zoom-knob="scale"]');
+ await scale.fill("3");
+ await scale.blur();
+ await expect.poll(() => (timeline().find((e) => e.id === "p-11") as { fx?: Array<{ scale?: number }> }).fx?.[0]?.scale).toBe(3);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-word-zoom-bench.png") });
+
+ // Play the cut: at the word's time the card's contents are pushed in, on the render's curve.
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-11" }));
+ const player = page.locator('[data-post-play="p-11"]');
+ await expect(player).toHaveAttribute("data-post-zooms", "1", { timeout: 15_000 });
+ await expect(player).toHaveAttribute("data-post-zoom", "1");
+ await page.locator("[data-play-toggle]").click();
+ // Fully in from 1.15 s to 2.35 s: scale 3.
+ await expect(player).toHaveAttribute("data-post-zoom", "3", { timeout: 15_000 });
+ await expect(player).toHaveAttribute("data-post-zoom-fx", "0");
+ const transform = await page.frameLocator('[data-post-card-frame="read"]').locator("[data-post-words]").evaluate((el) => (el as HTMLElement).style.transform);
+ expect(transform).toMatch(/scale\(3\)/);
+ const lit = await page.frameLocator('[data-post-card-frame="read"]').locator('[data-w="post:2"]').evaluate((el) => (el as HTMLElement).style.background);
+ expect(lit).toMatch(/rgba\(255, 216, 77/);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-word-zoom-play.png") });
+ // And back out after it.
+ await expect(player).toHaveAttribute("data-post-zoom", "1", { timeout: 15_000 });
+ await page.locator("[data-play-toggle]").click();
+});
+
test("THE RECORDING SESSION: part by part, a reload resumes, redo one, the last part makes the recorded take and picks it", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1200 });
await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));