Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 706f48390b0ffdb3c59bffd7a5d3692b45416b99
parent 71631adc0bc5ed8a9362c3bdd0cf112d2a7eb357
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 03:31:20 -0500

umtool e2e: ui-ops.spec -- the sites' deploys and Publish, the link policy and its fix, the render queue and a take's ETA, the walk's speaker badge (UI notes #9 #10 #18 #15)

- fixtures/ui-ops-fixture.mjs: its own project and channels (u2 uploaded after the site's 9 Oct build; a YouTube channel for the policy; three past takes for the ETA -- one known only by its files and its log's wait), and a speaker project of synthetic voices with speakers.json
- the spec runs its own archive (corpus.json, a manifest, a shard), writes the site's site.json for the run, and writes the heavy slot's tickets into the fixture's slot (HEAVY_LOCK_FILE, set for the app server); the editor stub records Publish's build-deploy
- found by the run: the speaker badge is one compact line (the bench is one screen at 1366x768: "+ voice" opens the box, the reference sets in a short "vs Host 2 · Guest 1" with the whole in its title); Save link policy is an outline button (one filled action a page); memory in decimal GB

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/RenderQueuePanel.tsx | 2+-
Mumtool/components/projects/SpeakerBadge.tsx | 70++++++++++++++++++++++++++++++++++++++++++++++------------------------
Mumtool/components/projects/report/LinkPolicyPanel.tsx | 2+-
Mumtool/e2e/fixtures/make-fixture.mjs | 3+++
Aumtool/e2e/fixtures/ui-ops-fixture.mjs | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/e2e/ui-ops.spec.ts | 218+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/playwright.config.ts | 5+++++
7 files changed, 383 insertions(+), 26 deletions(-)

diff --git a/umtool/components/projects/RenderQueuePanel.tsx b/umtool/components/projects/RenderQueuePanel.tsx @@ -45,7 +45,7 @@ const dur = (s: number | null | undefined) => { const m = Math.round(s / 60); return m >= 60 ? `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")} min` : `${m} min`; }; -const gb = (mb: number) => `${(mb / 1024).toFixed(1)} GB`; +const gb = (mb: number) => `${(mb / 1000).toFixed(1)} GB`; const clock = (s: number) => `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, "0")}`; function RowLine({ r, waiting }: { r: Row; waiting?: boolean }) { diff --git a/umtool/components/projects/SpeakerBadge.tsx b/umtool/components/projects/SpeakerBadge.tsx @@ -25,6 +25,7 @@ export default function SpeakerBadge({ project, clip }: { project: string; clip: const [job, setJob] = useState<JobPoll | null>(null); const [err, setErr] = useState<string | null>(null); const [voice, setVoice] = useState(""); + const [adding, setAdding] = useState(false); const timer = useRef<ReturnType<typeof setTimeout> | null>(null); const load = useCallback(async () => { @@ -86,6 +87,7 @@ export default function SpeakerBadge({ project, clip }: { project: string; clip: const j = (await r.json().catch(() => ({}))) as { error?: string }; if (!r.ok) setErr(j.error ?? `HTTP ${r.status}`); setVoice(""); + setAdding(false); void load(); }; @@ -99,50 +101,70 @@ export default function SpeakerBadge({ project, clip }: { project: string; clip: .map((s) => `${s.name}: ${s.pieces} piece${s.pieces === 1 ? "" : "s"}${s.kept ? ` (${s.kept} kept)` : ""}`) .join(" · "); + // Compact: one line in the verdict bar (the bench is a one-screen layout at + // 1366×768 -- clip-bench.spec), the voice box only when asked for. + const refShort = (badge.reference ?? badge.speakers.map((s) => ({ name: s.name, pieces: s.clips.length + s.videos.length }))) + .map((s) => `${s.name} ${s.pieces}`) + .join(" · "); return ( - <span data-speaker-badge={label} className="inline-flex flex-wrap items-center gap-2 text-[12px]"> + <span data-speaker-badge={label} className="inline-flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px]"> <span data-speaker-line="" className={tone} title={refWords ? `measured against: ${refWords}` : undefined}> Speaker: {res ? res.line : badge.speakers.length ? "not checked" : "no voices named"} </span> {res && ( - <span data-speaker-reference="" className="text-[11px] text-muted"> - against {refWords || "—"} - {res.madeAt ? ` · ${res.madeAt.slice(0, 16).replace("T", " ")}` : ""} + <span + data-speaker-reference="" + className="text-[11px] text-muted" + title={`measured against: ${refWords}${res.madeAt ? ` · ${res.madeAt.slice(0, 16).replace("T", " ")}` : ""}`} + > + vs {refShort || "—"} </span> )} - {mine && <span className="text-[11px] text-muted">this clip is in {mine.name}&rsquo;s voice</span>} + {mine && <span className="text-[11px] text-muted">in {mine.name}&rsquo;s voice</span>} <button type="button" data-speaker-check="" disabled={running || !badge.speakers.length} onClick={() => void check()} - className={buttonVariants({ variant: "quiet", size: "md" })} + className={buttonVariants({ variant: "quiet", size: "sm" })} title={ badge.speakers.length ? "scores this clip's voice against each named voice (TitaNet-small, local) as a job through the heavy slot" - : "name the voices first: Add to a voice, or umtool speaker-check <p> --set 'Name=…'" + : "name the voices first: + voice, or umtool speaker-check <p> --set 'Name=…'" } > {running ? "Checking…" : "Check speaker"} </button> - <span className="inline-flex items-center gap-1"> - <input - data-speaker-voice="" - list={`voices-${clip}`} - value={voice} - onChange={(e) => setVoice(e.target.value)} - placeholder="voice name" - className="w-[8.5rem] rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px]" - /> - <datalist id={`voices-${clip}`}> - {badge.speakers.map((s) => ( - <option key={s.name} value={s.name} /> - ))} - </datalist> - <button type="button" data-speaker-add="" disabled={!voice.trim()} onClick={() => void addTo()} className={buttonVariants({ variant: "quiet", size: "md" })} title="this clip is that voice: it joins the voice's reference set (speakers.json)"> - Add to a voice + {adding ? ( + <span className="inline-flex items-center gap-1"> + <input + data-speaker-voice="" + list={`voices-${clip}`} + value={voice} + autoFocus + onChange={(e) => setVoice(e.target.value)} + onKeyDown={(e) => { + e.stopPropagation(); + if (e.key === "Enter") void addTo(); + if (e.key === "Escape") setAdding(false); + }} + placeholder="voice name" + className="w-[7.5rem] rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px]" + /> + <datalist id={`voices-${clip}`}> + {badge.speakers.map((s) => ( + <option key={s.name} value={s.name} /> + ))} + </datalist> + <button type="button" data-speaker-add="" disabled={!voice.trim()} onClick={() => void addTo()} className={buttonVariants({ variant: "quiet", size: "sm" })} title="this clip is that voice: it joins the voice's reference set (speakers.json)"> + Add + </button> + </span> + ) : ( + <button type="button" data-speaker-add-open="" onClick={() => setAdding(true)} className={buttonVariants({ variant: "quiet", size: "sm" })} title="this clip is a known voice: add it to that voice's reference set (speakers.json)"> + + voice </button> - </span> + )} {job?.state === "failed" && ( <span data-speaker-error="" className="text-[11.5px] text-doubt-text"> {job.error ?? job.log.at(-1) ?? "the check failed"} diff --git a/umtool/components/projects/report/LinkPolicyPanel.tsx b/umtool/components/projects/report/LinkPolicyPanel.tsx @@ -127,7 +127,7 @@ export default function LinkPolicyPanel({ project }: { project: string }) { data-link-policy-save="" disabled={busy || !dirty} onClick={() => void save()} - className={buttonVariants({ variant: "go", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} title="writes provenance.linkPolicy; new clips take its links, and the check names the clips that break it" > {busy ? "Saving…" : "Save link policy"} diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -36,6 +36,7 @@ import { makeClipEditorFixture } from "./clip-editor-fixture.mjs"; import { makeBenchShellFixture } from "./bench-shell-fixture.mjs"; import { makeTakeWalkFixture } from "./take-walk-fixture.mjs"; import { makeCutIntegrityFixture } from "./cut-integrity-fixture.mjs"; +import { makeUiOpsFixture } from "./ui-ops-fixture.mjs"; import { makeYoutubeFixture } from "./youtube-fixture.mjs"; import { makeBoardFixture, makeResearchFixture } from "./research-fixture.mjs"; import { makeDigestContextFixture } from "./digest-context-fixture.mjs"; @@ -1855,6 +1856,8 @@ makeBenchShellFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out" makeTakeWalkFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Cut integrity (UI notes 2026-10-30): the cite following the edge, repeatOf, ★ and walk notes, take patch markers, the QR link check (cut-integrity.spec.ts). makeCutIntegrityFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); +// ui-ops.spec's own project and channels (UI notes #9 #10 #15 #18). +makeUiOpsFixture({ reports, channels: CHANNELS, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), ff }); // Release 28 M6: the YouTube text, previewed and built (media-draft-e.spec.ts). makeYoutubeFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Release 36 lane D: the assistant's labels, Suggest, Ask and Apply in the clip editor (clips-suggest.spec.ts). diff --git a/umtool/e2e/fixtures/ui-ops-fixture.mjs b/umtool/e2e/fixtures/ui-ops-fixture.mjs @@ -0,0 +1,109 @@ +// What ui-ops.spec.ts acts on (UI notes 2026-10-30, #9 #10 #15 #18): its own +// project and its own two channels, written by that spec alone. +// +// channels/uiopschan/ u1 (uploaded 2025-01-01, transcribed here long ago) +// u2 (uploaded 2026-10-20: newer than the site's deploy) +// channels/uiopsdirect/ d1, a YouTube upload (webpageUrl) -- the channel the +// link policy links direct +// reports/ui-ops-fixture/ +// video.manifest.json o01 u1, o02 u2, o03 d1; every QR on the spec's own +// site (a local server; SITE_PLACEHOLDER is replaced +// with its origin before a page opens) +// takes/draft-0..2 three past renders of the whole cut (take.json +// seconds + renderSeconds), and draft-2 made `from` +// draft-1: the ETA's records +// draft-0.log an older render's log line ("take draft-0: done (…)"), +// the ETA's other source +// out/clips-raw/ u1 0.00-9.00, so the speaker check has a window +// +// Synthetic, like every fixture. +import { copyFileSync, mkdirSync, utimesSync, writeFileSync } from "node:fs"; +import path from "node:path"; + +export const UI_OPS = "ui-ops-fixture"; +export const UI_OPS_SITE_PLACEHOLDER = "http://127.0.0.1:9"; +export const UI_OPS_SPEAKER = "ui-ops-speaker-fixture"; + +const write = (dir, name, doc) => { + mkdirSync(dir, { recursive: true }); + writeFileSync(path.join(dir, name), typeof doc === "string" ? doc : JSON.stringify(doc, null, 2) + "\n"); +}; + +const LONG_AGO = new Date("2025-01-02T00:00:00Z"); + +function source(channels, slug, id, { uploadDate, webpageUrl, old = true }) { + const dir = path.join(channels, slug, "data", id); + const cues = Array.from({ length: 30 }, (_, i) => ({ start: i * 2, end: i * 2 + 2, text: `Line ${i} of ${id}.` })); + write(dir, "transcript.cues.json", { title: `UI ops source ${id}`, uploadDate, channel: "UI Ops", webpageUrl, duration: 60, cues }); + if (old) utimesSync(path.join(dir, "transcript.cues.json"), LONG_AGO, LONG_AGO); +} + +/** The fixture's manifest, its QRs on `site`. Exported so the spec writes the same thing with its server's origin. */ +export function uiOpsManifest(manifest, site) { + const link = (chan, id, t) => `${site}/?v=${encodeURIComponent(`${chan}/${id}`)}&t=${t}`; + const clip = (id, channel, video, start, end) => ({ + type: "clip", id, channel, video, start, end, cite: start, citeUrl: link(channel, video, start), lock: true, section: 0, quote: `Line of ${video}.`, + }); + const doc = manifest(UI_OPS, "The UI Ops Fixture", { siteOrigin: "https://archive.example", channelSlug: "uiopschan" }, [ + clip("o01", "uiopschan", "u1", 2, 6), + clip("o02", "uiopschan", "u2", 4, 8), + clip("o03", "uiopsdirect", "d1", 10, 14), + ]); + doc.render.fetchPad = 0; + return doc; +} + +/** + * @param {{ reports: string, channels: string, manifest: Function, cachedWindow: string, ff: (args: string[]) => void }} o + */ +export function makeUiOpsFixture({ reports, channels, manifest, cachedWindow, ff }) { + source(channels, "uiopschan", "u1", { uploadDate: "20250101", webpageUrl: "https://example.invalid/watch?v=u1" }); + source(channels, "uiopschan", "u2", { uploadDate: "20261020", webpageUrl: "https://example.invalid/watch?v=u2" }); + source(channels, "uiopsdirect", "d1", { uploadDate: "20250301", webpageUrl: "https://www.youtube.com/watch?v=d1" }); + write(path.join(channels, "uiopsdirect"), "config.json", { name: "UI Ops Direct", url: "https://www.youtube.com/@uiopsdirect", platform: "youtube" }); + const dir = path.join(reports, UI_OPS); + write(dir, "video.manifest.json", uiOpsManifest(manifest, UI_OPS_SITE_PLACEHOLDER)); + // Three past renders of the whole cut (30 s of video each): draft-0 known only + // by its files (its manifest 11 min before builtAt) and its log's 1 min wait + // at the slot -- 600 s; draft-1 recorded 600 s; draft-2, made from draft-1, 240 s. + const take = (id, order, extra) => ({ id, group: "takes", order, label: id.replace("-", " "), kind: "reference", preview: "preview.mp4", seconds: 30, window: "full", ...extra }); + write(path.join(dir, "takes", "draft-0"), "take.json", take("draft-0", 0, { builtAt: "2026-10-29T10:11:00.000Z" })); + write(path.join(dir, "takes", "draft-0"), "video.manifest.json", "{}\n"); + const at0 = new Date("2026-10-29T10:00:00.000Z"); + utimesSync(path.join(dir, "takes", "draft-0", "video.manifest.json"), at0, at0); + write(dir, "draft-0.log", "heavy: waiting for memory — 2917 MB available, the floor is 6000 MB\nheavy: 8879 MB available after 1m00s — admitted\ntake draft-0: done (30 s)\n"); + write(path.join(dir, "takes", "draft-1"), "take.json", take("draft-1", 1, { builtAt: "2026-10-30T10:10:00.000Z", renderSeconds: 600 })); + write(path.join(dir, "takes", "draft-2"), "take.json", take("draft-2", 2, { builtAt: "2026-10-31T10:04:00.000Z", renderSeconds: 240, from: "draft-1" })); + mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); + copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", "u1_0.00-9.00.mp4")); + makeSpeakerProject({ reports, channels, manifest, ff }); + return dir; +} + +// THE SPEAKER CHECK'S PROJECT (#15): four clips, each window already in the +// corpus under its own channel -- three of one "voice" (a 150 Hz tone and its +// octave), one of another (1.1 kHz) -- and speakers.json naming Host (k01, k02) +// and Guest (k03). k04 is the clip the walk checks. The app's job runs the test +// kit's fake embedder (VOICE_MATCH_* in playwright.config.ts). +function makeSpeakerProject({ reports, channels, manifest, ff }) { + const chan = "uiopsvoice"; + const voices = { host: "0.3*sin(2*PI*150*t)+0.15*sin(2*PI*300*t)", guest: "0.3*sin(2*PI*1100*t)+0.1*sin(2*PI*2300*t)" }; + const timeline = []; + for (const [id, who] of [["k01", "host"], ["k02", "host"], ["k03", "guest"], ["k04", "host"]]) { + const vid = `voice-${id}`; + const vdir = path.join(channels, chan, "data", vid); + mkdirSync(path.join(vdir, "clips"), { recursive: true }); + write(vdir, "transcript.cues.json", { title: `Voice ${vid}`, uploadDate: "20250101", channel: "UI Ops Voices", webpageUrl: `https://example.invalid/watch?v=${vid}`, duration: 20, cues: [{ start: 2, end: 4.5, text: "slow news day." }] }); + ff([ + "-f", "lavfi", "-i", "color=c=gray:size=160x90:rate=15:duration=6", + "-f", "lavfi", "-i", `aevalsrc=${voices[who]}:s=48000:d=6`, + "-map", "0:v", "-map", "1:a", "-t", "6", + "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-ar", "48000", "-ac", "2", + path.join(vdir, "clips", "0.00-6.00.mp4"), + ]); + timeline.push({ type: "clip", id, channel: chan, video: vid, start: 0.5, end: 5.5, cutStart: 2, cutEnd: 4.5, cite: 2, section: 0, lock: true, quote: "slow news day." }); + } + const dir = path.join(reports, UI_OPS_SPEAKER); + write(dir, "video.manifest.json", manifest(UI_OPS_SPEAKER, "The Speaker Check Fixture", { siteOrigin: "https://archive.example", channelSlug: chan }, timeline)); + write(dir, "speakers.json", { speakers: [{ name: "Host", clips: ["k01", "k02"] }, { name: "Guest", clips: ["k03"] }] }); +} diff --git a/umtool/e2e/ui-ops.spec.ts b/umtool/e2e/ui-ops.spec.ts @@ -0,0 +1,218 @@ +import { test, expect, type Page } from "@playwright/test"; +import { createServer, type Server } from "node:http"; +import type { AddressInfo } from "node:net"; +import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; +import { WARM_TIMEOUT, warm } from "./warm"; +import { UI_OPS, UI_OPS_SITE_PLACEHOLDER, UI_OPS_SPEAKER } from "./fixtures/ui-ops-fixture.mjs"; + +// --------------------------------------------------------------------------- +// OPERATIONS UI (UI notes 2026-10-30), each through the app: +// +// #9 the sites the cut's links depend on, each with its deploy's date, and +// the warning when cited videos are newer than it; Publish <site> asks +// the editor (its stub records build-deploy) +// #10 the link policy: "these channels direct" saved through its writer, +// the check's clip-link-policy row and its one-press fix, and a new +// clip written by the policy +// #18 the render queue panel, read from the slot's own files (the +// fixture's: HEAVY_LOCK_FILE), and a take's ETA from past renders +// #15 the walk's speaker badge and Check speaker (the fake embedder) +// +// Fixture: fixtures/ui-ops-fixture.mjs, written for this file alone. Serial: +// each test leaves what the next reads. +// --------------------------------------------------------------------------- + +test.describe.configure({ mode: "serial" }); + +const PROJECT = `reports/${UI_OPS}`; +const SPEAKERS = `reports/${UI_OPS_SPEAKER}`; +const FIXTURE = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".e2e-song"); +const DIR = path.join(FIXTURE, "reports", UI_OPS); +const MANIFEST = path.join(DIR, "video.manifest.json"); +const SITE_DIR = path.join(FIXTURE, "sites", "ui-ops-site"); +const HEAVY = path.join(FIXTURE, "heavy"); +const STUB_LOG = path.join(FIXTURE, "editor-stub.requests.json"); +type Entry = { id: string; type: string; citeUrl?: string; channel?: string; video?: string }; +const entries = () => (JSON.parse(readFileSync(MANIFEST, "utf8")) as { timeline: Entry[] }).timeline; +const entry = (id: string) => entries().find((e) => e.id === id); +// Screenshots for the morning review, when asked for (UI_OPS_SHOTS=<dir>). +const SHOTS = process.env.UI_OPS_SHOTS ?? ""; +const shot = async (page: Page, name: string, el?: ReturnType<Page["locator"]>) => { + if (!SHOTS) return; + mkdirSync(SHOTS, { recursive: true }); + if (el) await el.screenshot({ path: path.join(SHOTS, `${name}.png`) }); + else await page.screenshot({ path: path.join(SHOTS, `${name}.png`), fullPage: false }); +}; + +// The site the QRs link: built 9 Oct, with uiopschan's u1 only -- no u2 +// (uploaded the 20th), no uiopsdirect. +let server: Server; +let origin = ""; +const startSite = () => + new Promise<void>((resolve) => { + server = createServer((req, res) => { + const p = new URL(req.url ?? "/", "http://x").pathname; + const json = (doc: unknown) => { + res.writeHead(200, { "content-type": "application/json" }); + res.end(JSON.stringify(doc)); + }; + if (p === "/corpus.json") { + return json({ + spec: 5, + generatedAt: "2026-10-09T10:00:00.000Z", + site: { title: "UI ops archive" }, + channels: [{ slug: "uiopschan", manifests: { transcripts: `${origin}/transcripts/uiopschan/manifest.json` } }], + }); + } + if (p === "/transcripts/uiopschan/manifest.json") return json({ pageCount: 1, slugToPage: { u1: 0 } }); + if (p === "/transcripts/uiopschan/page-0000.json") return json([{ id: "u1" }]); + res.writeHead(404); + res.end(); + }); + server.listen(0, "127.0.0.1", () => { + origin = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; + resolve(); + }); + }); + +test.beforeAll(async ({ playwright }) => { + test.setTimeout(WARM_TIMEOUT); + await startSite(); + writeFileSync(MANIFEST, readFileSync(MANIFEST, "utf8").split(UI_OPS_SITE_PLACEHOLDER).join(origin)); + // The site the QRs open, as transcripts/sites/<id>/site.json names it. + mkdirSync(SITE_DIR, { recursive: true }); + writeFileSync(path.join(SITE_DIR, "site.json"), JSON.stringify({ siteId: "ui-ops-site", siteTitle: "UI Ops Site", siteUrl: origin, channels: [{ slug: "uiopschan", order: 0 }] })); + await warm(playwright, [urls.projectHref(PROJECT), urls.takesHref(PROJECT), urls.clipBenchHref(SPEAKERS, "k04")]); +}); +test.afterAll(() => { + server?.close(); + rmSync(SITE_DIR, { recursive: true, force: true }); + rmSync(HEAVY, { recursive: true, force: true }); +}); + +const row = (page: Page, kind: string, target: string) => page.locator(`[data-decision="${kind}"][data-target="${target}"]`); + +test("#9 the sites the links depend on: the deploy's date, the cited videos newer than it, and Publish <site>", async ({ page }) => { + const host = new URL(origin).host; + await page.goto(urls.projectHref(PROJECT)); + const site = page.locator(`[data-link-site="${host}"]`); + await expect(site).toHaveAttribute("data-link-site-id", "ui-ops-site"); + await expect(site.locator("[data-link-site-deploy]")).toContainText("deploy date unknown · not checked yet"); + // Check links reads every site's corpus.json; its date is the deploy's. + await site.locator('[data-settle-button="links"]').click(); + await expect(site).toHaveAttribute("data-link-site-deployed", "2026-10-09", { timeout: 30_000 }); + await expect(site.locator("[data-link-site-deploy]")).toContainText("deployed 2026-10-09 (its corpus.json)"); + await expect(site).toHaveAttribute("data-link-site-newer", "1"); + await expect(site.locator("[data-link-site-warning]")).toHaveText("1 cited video is newer than this deploy: o02 (uploaded 2026-10-20)"); + const behind = row(page, "site-deploy-behind", host); + await expect(behind).toContainText("ui-ops-site's deploy is from 2026-10-09; 1 cited video is newer: o02 (uploaded 2026-10-20)"); + await expect(behind.locator("[data-fix]")).toHaveAttribute("data-fix", `pnpm ops build-deploy --json '{"siteId":"ui-ops-site"}'`); + await shot(page, "9-site-deploy-warning"); + await shot(page, "9-site-deploy-warning-panel", site); + // Publish asks the editor's build-deploy (the stub records it). + await site.locator('[data-settle-button="publish-ui-ops-site"]').click(); + await expect(site.locator('[data-settle="publish-site"] [data-settle-said]')).toContainText(/queued on the editor's publish queue \(job deploy-\d+\)/); + const asked = (JSON.parse(readFileSync(STUB_LOG, "utf8")) as { route?: string; siteId?: string; authorization?: string }[]).filter((r) => r.route === "build-deploy"); + expect(asked.at(-1)).toMatchObject({ siteId: "ui-ops-site", authorization: "Bearer umtool-e2e-token" }); +}); + +test("#10 the link policy: cite via ui-ops-site, uiopsdirect direct; the check's row and its fix; a new clip is written by it", async ({ page }) => { + await page.goto(urls.projectHref(PROJECT)); + const panel = page.locator("[data-link-policy]"); + await expect(panel).toHaveAttribute("data-link-policy", "none"); + // "Cite via ui-ops-site; uiopsdirect direct." + await panel.locator("[data-link-policy-via]").selectOption(origin); + await panel.locator('[data-link-policy-direct="uiopsdirect"]').check(); + await panel.locator("[data-link-policy-save]").click(); + await expect(panel.locator("[data-link-policy-said]")).toContainText("saved"); + await expect(panel).toHaveAttribute("data-link-policy", "set"); + expect((JSON.parse(readFileSync(MANIFEST, "utf8")) as { provenance: { linkPolicy?: unknown } }).provenance.linkPolicy).toEqual({ via: origin, direct: ["uiopsdirect"] }); + // Only o03 breaks it: o01 and o02 already open ui-ops-site. + await expect(page.locator('[data-decision="clip-link-policy"]')).toHaveCount(1); + const policyRow = row(page, "clip-link-policy", "o03"); + await expect(policyRow).toContainText(`uiopsdirect links direct by the project's link policy, but its QR opens ${new URL(origin).host}`); + await expect(policyRow.locator('[data-settle-button="o03"]')).toHaveText("Link its YouTube page"); + await expect(policyRow.locator("[data-fix]")).toHaveAttribute("data-fix", `umtool window ${PROJECT} o03 --cite-url 'https://www.youtube.com/watch?v=d1&t=10s'`); + await shot(page, "10-link-policy-row"); + await shot(page, "10-link-policy-panel", panel); + await policyRow.locator('[data-settle-button="o03"]').click(); + await expect(row(page, "clip-link-policy", "o03")).toHaveCount(0); + expect(entry("o03")?.citeUrl).toBe("https://www.youtube.com/watch?v=d1&t=10s"); + await shot(page, "10-link-policy-fixed"); + // A new clip of the direct channel: the inserter writes its YouTube page. + const r = await page.request.post("/api/report/timeline", { + data: { project: PROJECT, op: "insert", afterId: "o03", entry: { type: "clip", channel: "uiopsdirect", video: "d1", start: 20, end: 24, citeUrl: `${origin}/?v=uiopsdirect%2Fd1&t=20` } }, + }); + expect(r.ok()).toBe(true); + const added = entries().find((e) => e.type === "clip" && e.video === "d1" && e.id !== "o03"); + expect(added?.citeUrl).toBe("https://www.youtube.com/watch?v=d1&t=20s"); +}); + +test("#18 the render queue: what runs and waits at the heavy slot, from its files, and a take's ETA from past renders", async ({ page }) => { + // The slot's own files, as queue-lock writes them (the fixture's slot): an + // e2e suite running, a render of this project waiting for memory. Both name + // live pids (this worker and its parent), so they count. + const lock = path.join(HEAVY, "heavy-queue.lock"); + const put = (file: string, doc: unknown) => { + mkdirSync(path.dirname(file), { recursive: true }); + writeFileSync(file, JSON.stringify(doc)); + }; + const now = Date.now(); + put(`${lock}.jobs/${process.pid}.json`, { pid: process.pid, estimateMb: 1500, build: false, exclusive: false, worktree: "/w/lane-a", branch: "lane/a", cmd: "playwright test", startedAt: new Date(now - 12 * 60_000).toISOString() }); + put(path.join(HEAVY, "e2e-editor-queue.lock.holder.json"), { name: "e2e-editor", pid: process.pid, worktree: "/w/lane-a", branch: "lane/a", cmd: "playwright test", startedAt: new Date(now - 13 * 60_000).toISOString() }); + put(`${lock}.waiting/${process.ppid}.json`, { + pid: process.ppid, estimateMb: 6020, build: false, exclusive: false, worktree: "/w/main", branch: "main", + cmd: `node /repo/umtool/report-to-video/build-video.mjs ${DIR}/.take-draft-3.render.json --out ${DIR}/takes/draft-3/out --progress ndjson`, + since: new Date(now - 3 * 60_000).toISOString(), stage: "memory", stageSince: new Date(now - 2 * 60_000).toISOString(), + }); + await page.goto(urls.takesHref(PROJECT)); + const q = page.locator("[data-render-queue]"); + await expect(q).toHaveAttribute("data-render-queue", "busy", { timeout: 15_000 }); + await expect(q.locator("[data-render-queue-held-by]")).toHaveText("held by e2e suite e2e-editor"); + const running = q.locator('[data-queue-state="running"]'); + await expect(running).toHaveCount(1); + await expect(running).toContainText("e2e suite e2e-editor"); + await expect(running).toContainText("lane-a (lane/a)"); + await expect(running).toContainText("12 min"); + const waiting = q.locator('[data-queue-state="waiting"]'); + await expect(waiting).toContainText("render of draft-3"); + await expect(waiting).toContainText("at the head of the line, for memory"); + await expect(q.locator("[data-render-queue-mine]")).toContainText("draft-3: waiting 3 min — at the head of the line, for memory"); + // The ETA: draft-2 (from draft-1) 240 s for 30 s; draft-0 and draft-1 600 s fresh. + const eta = q.locator("[data-take-eta]"); + await expect(eta).toHaveAttribute("data-take-eta", "known"); + await expect(eta.locator("[data-take-eta-reuse]")).toHaveText("~4 min made from draft-2 (reuse)"); + await expect(eta.locator("[data-take-eta-fresh]")).toHaveText("~10 min fresh"); + await eta.locator("summary").click(); + await expect(eta).toContainText("draft-0 (fresh): 0:30 of video in 10 min (from its files' times)"); + await shot(page, "18-render-queue-eta", q); + await shot(page, "18-render-queue-page"); + // The job lets go: its ticket is gone and the panel says so. + rmSync(HEAVY, { recursive: true, force: true }); + await expect(q).toHaveAttribute("data-render-queue", "idle", { timeout: 15_000 }); + await expect(q.locator("[data-render-queue-held-by]")).toHaveText("the heavy slot is free"); +}); + +test("#15 the walk's speaker badge: Check speaker scores the clip against the named voices", async ({ page }) => { + await page.goto(urls.clipBenchHref(SPEAKERS, "k04")); + const badge = page.locator("[data-speaker-badge]"); + await expect(badge).toHaveAttribute("data-speaker-badge", "unchecked"); + await expect(badge.locator("[data-speaker-line]")).toHaveText("Speaker: not checked"); + await badge.locator("[data-speaker-check]").click(); + await expect(badge).toHaveAttribute("data-speaker-badge", "matches", { timeout: 60_000 }); + await expect(badge.locator("[data-speaker-line]")).toHaveText(/^Speaker: matches Host \d\.\d\d \/ Guest 0\.\d\d$/); + await expect(badge.locator("[data-speaker-reference]")).toHaveText("vs Host 2 · Guest 1"); + await expect(badge.locator("[data-speaker-reference]")).toHaveAttribute("title", /^measured against: Host: 2 pieces \(2 kept\) · Guest: 1 piece \(1 kept\) · \d{4}-\d\d-\d\d \d\d:\d\d$/); + await shot(page, "15-speaker-badge", page.locator("[data-verdict-bar]").first()); + await shot(page, "15-speaker-badge-page"); + // This clip is Host's: it joins Host's reference set. + await badge.locator("[data-speaker-add-open]").click(); + await badge.locator("[data-speaker-voice]").fill("Host"); + await badge.locator("[data-speaker-add]").click(); + await expect(badge).toContainText("in Host’s voice"); + const speakers = JSON.parse(readFileSync(path.join(FIXTURE, "reports", UI_OPS_SPEAKER, "speakers.json"), "utf8")) as { speakers: { name: string; clips?: string[] }[] }; + expect(speakers.speakers.find((s) => s.name === "Host")?.clips).toEqual(["k01", "k02", "k04"]); +}); diff --git a/umtool/playwright.config.ts b/umtool/playwright.config.ts @@ -221,6 +221,11 @@ export default defineConfig({ // so a take made here never joins — and the banner never shows — the // machine's render mode, and a --priority take holds the stub's lanes. `RENDER_PRIORITY_FILE=${FIXTURE}/render-priority.json ` + + // The heavy slot the render queue panel reads (common/lib/heavyQueue.mjs, + // UI notes #18): the fixture's own, so ui-ops.spec writes the tickets it + // asserts and never reads the machine's. A take made here still passes + // through the slot this suite holds (HEAVY_HELD), touching no lock. + `HEAVY_LOCK_FILE=${FIXTURE}/heavy/heavy-queue.lock ` + // Two seconds of pacing per CUT, so the deliver spec can press Stop in // the middle of a job and prove that cancelling abandons the rest while // the next run resumes. Read only by bin/cut-from-cache.mjs.