Archilyzer · Source

archilyzer

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

commit c8b92b167bcb18b58849c7fc43382f3d8413bc1d
parent e124d3cfc54be7e61a14818bd5cb2af1fbf747ad
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 10:44:52 -0400

umtool: specs for the bench shell and the Media tab; Signal only where the screen's one action is (P4b)

e2e/bench-shell.spec.ts (5): the clip bench's top bar, its one question with
its consequence and the reader's lit cue at 1366×768; n/p; the claim bench's
reader and verdict bar; the drafts review as a bench (j, a, r); narration and
takes in the shell. piece.spec: the Media tab (provenance, approve per field
and all, chips, on-screen moved from Build). media-surfaces drafts on the
Media tab and runs Draft everything there; article-iterations narrates from
it. fixtures/bench-shell-fixture.mjs: bench-shell-, media-tab- and
media-review-fixture. The P1 Signal-outline buttons in the benches, the
on-screen panel and the badges are outlines; the verdict bar's question is
its own span.

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

Diffstat:
Mumtool/components/projects/ClaimBench.tsx | 7++++++-
Mumtool/components/projects/ClipBench.tsx | 23+++++++++++++----------
Mumtool/components/projects/MediaDrafts.tsx | 25+++++++++++++++++++------
Mumtool/components/projects/NarrationReview.tsx | 2+-
Mumtool/components/projects/OnscreenSection.tsx | 8++++----
Mumtool/components/projects/ReviewPage.tsx | 4+++-
Mumtool/components/projects/TakesBench.tsx | 2+-
Mumtool/components/projects/bench/BenchShell.tsx | 6+++---
Mumtool/components/projects/drafts.tsx | 2+-
Mumtool/e2e/article-iterations.spec.ts | 15+++++++++++----
Aumtool/e2e/bench-shell.spec.ts | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/e2e/fixtures/bench-shell-fixture.mjs | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/e2e/fixtures/make-fixture.mjs | 4++++
Mumtool/e2e/media-surfaces.spec.ts | 40++++++++++++++++++++++------------------
Mumtool/e2e/piece.spec.ts | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 files changed, 410 insertions(+), 50 deletions(-)

diff --git a/umtool/components/projects/ClaimBench.tsx b/umtool/components/projects/ClaimBench.tsx @@ -311,7 +311,12 @@ export default function ClaimBench({ data }: { data: ClaimBenchData }) { )} </VerdictBar> ); - const firstCited = cues.findIndex((c) => c.cited); + // The cue the cited second falls in: a cite on a boundary marks both cues + // around it, and the line is the one it STARTS (the later of the two). + let firstCited = -1; + cues.forEach((c, i) => { + if (c.cited) firstCited = i; + }); const reader = ( <ReaderPane className="h-full" diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx @@ -2154,9 +2154,12 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { </span> </div> - <div className="grid min-h-0 flex-1 gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(22rem,26rem)]"> + <div className="grid min-h-0 flex-1 gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,23rem)]"> {/* ================= the picture, and its edges ================= */} - <div className="flex min-h-0 flex-col gap-2"> + {/* Since P4b the words are the bench's reader pane: this column is the + picture and everything that moves its edges, and it scrolls on its + own before the picture shrinks below a usable height. */} + <div className="flex min-h-0 flex-col gap-2 lg:overflow-y-auto"> {cached ? ( <video ref={video} @@ -2168,12 +2171,12 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { // than either taking a fixed number of pixels: a laptop and a // 1080p screen have very different amounts to give away, and a // 130px player is not a player. - className="aspect-video w-full rounded border border-[var(--color-line)] bg-black object-contain lg:aspect-auto lg:min-h-0 lg:flex-[3_1_0%]" + className="aspect-video w-full rounded border border-[var(--color-line)] bg-black object-contain lg:aspect-auto lg:min-h-[200px] lg:flex-[3_1_0%]" preload="metadata" controls /> ) : ( - <div className="flex aspect-video w-full items-center justify-center rounded border border-dashed border-[var(--color-line)] text-[12px] text-[var(--color-dim)] lg:aspect-auto lg:min-h-0 lg:flex-[3_1_0%]"> + <div className="flex aspect-video w-full items-center justify-center rounded border border-dashed border-[var(--color-line)] text-[12px] text-[var(--color-dim)] lg:aspect-auto lg:min-h-[200px] lg:flex-[3_1_0%]"> nothing fetched for this clip yet </div> )} @@ -2198,7 +2201,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { <button type="button" data-save-window="" - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} disabled={!unsaved || !!busy} onClick={saveWindow} > @@ -2264,7 +2267,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { data-auto-audition={playback.auto ? "on" : "off"} aria-pressed={playback.auto} className={buttonVariants({ - variant: playback.auto ? "primary" : "outline", + variant: "outline", size: "sm", })} onClick={() => choosePlayback((pb) => ({ ...pb, auto: !pb.auto }))} @@ -2384,7 +2387,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { type="button" data-mute-pick={mutePick ? "armed" : ""} aria-pressed={mutePick} - className={buttonVariants({ variant: mutePick ? "primary" : "outline", size: "sm" })} + className={`${buttonVariants({ variant: "outline", size: "sm" })}${mutePick ? " bg-panel-2 border-muted" : ""}`} title="the next click on the waveform places the mute mark (Esc cancels)" onClick={() => setMutePick((v) => !v)} > @@ -2512,7 +2515,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { <button type="button" data-fetch-after={nextAfter} - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} disabled={!!busy} onClick={() => void fetchMore({ padBefore: keepBefore, padAfter: nextAfter })} > @@ -2697,7 +2700,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { </span> <button type="button" - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} onClick={() => void save({ start: round2(sel.from), @@ -2814,7 +2817,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { <button type="button" data-rerender="" - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} disabled={!!busy} onClick={() => void rerender()} > diff --git a/umtool/components/projects/MediaDrafts.tsx b/umtool/components/projects/MediaDrafts.tsx @@ -120,6 +120,7 @@ function FieldLine({ view, act, lit, + go, noteRef, }: { row: DraftRow; @@ -127,6 +128,8 @@ function FieldLine({ view: DraftsView; act: DraftAct; lit: boolean; + /** The lit line's Approve draft is the screen's one filled action (the tab); a bench's is its verdict bar's. */ + go: boolean; noteRef?: (el: HTMLInputElement | null) => void; }) { const [note, setNote] = useState(row.note ?? ""); @@ -175,7 +178,7 @@ function FieldLine({ aria-pressed={row.state === "approved"} disabled={busy} title={row.state === "approved" ? "take the approval back" : "approve this draft as it is now"} - className={buttonVariants({ variant: row.state === "approved" ? "outline" : lit ? "go" : "outline", size: "sm" })} + className={buttonVariants({ variant: row.state !== "approved" && lit && go ? "go" : "outline", size: "sm" })} onClick={() => void run(row.state === "approved" ? "clear" : "approve", row.state === "approved" ? {} : { note })} > {row.state === "approved" ? "Approved" : "Approve draft"} @@ -245,10 +248,12 @@ export type MediaFieldsProps = { /** Only these sections (a chip's filter). */ only?: string | null; onLit?: (address: string | null) => void; + /** The lit field's Approve draft is filled (false on a bench: the verdict bar's is). */ + lineGo?: boolean; }; /** The field list: one lit list, grouped by section, `a` / `r` on the lit field. */ -export function MediaFields({ project, view, act, provenance, heads, only = null, onLit }: MediaFieldsProps) { +export function MediaFields({ project, view, act, provenance, heads, only = null, onLit, lineGo = true }: MediaFieldsProps) { const rows = view.rows; const shown = new Set(rows.map((r) => r.address)); const loose = [...new Set(view.alternatives.filter((a) => !a.inUse && !shown.has(a.address)).map((a) => a.address))]; @@ -328,6 +333,7 @@ export function MediaFields({ project, view, act, provenance, heads, only = null view={v} act={act} lit={lit === r.address} + go={lineGo} noteRef={(el) => { if (el) notes.current.set(r.address, el); else notes.current.delete(r.address); @@ -445,8 +451,12 @@ export default function MediaDrafts({ router.refresh(); }, [project, router]); + // A section's head: what it writes, what it holds, its Draft with. A cut + // made from no iteration drafts nothing, so only the narration's head (its + // bench's link) is drawn there. const heads: Record<string, React.ReactNode> = {}; for (const row of rows) { + if (!linked && !(row.task === "narrate" && narrated > 0)) continue; heads[row.task] = ( <div className="space-y-1"> <div className="flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-[12px]"> @@ -467,8 +477,11 @@ export default function MediaDrafts({ ); } - const counts = view.counts; + // Every field on the list, drafted or a narration written by hand (the + // view's own counts are the drafted fields', the final gate's). const total = view.rows.length; + const counts = { approved: 0, rejected: 0, edited: 0, unreviewed: 0 }; + for (const r of view.rows) counts[r.state] += 1; const chips = MEDIA_SECTIONS.map((s) => ({ ...s, n: view.rows.filter((r) => sectionOf(r.address) === s.task).length })); return ( <section aria-label="Media drafts" data-draft-panel={link.ok ? `${link.article}/i${link.n}` : ""} className="space-y-3"> @@ -488,8 +501,8 @@ export default function MediaDrafts({ )} <span className="ml-auto flex flex-wrap items-center gap-2"> {total > 0 && ( - <Link href={reviewHref(project)} data-review-link={view.drafted} className={buttonVariants({ variant: "quiet", size: "md" })}> - Review drafts — {view.drafted} + <Link href={reviewHref(project)} data-review-link={total} className={buttonVariants({ variant: "quiet", size: "md" })}> + Review drafts — {total} </Link> )} {linked && ( @@ -671,7 +684,7 @@ export function MediaReview({ return ( <BenchBody verdict={verdict} reader={reader} workClassName="space-y-3"> <GateLine view={view} /> - <MediaFields project={project} view={view} act={drafts.act} provenance={provenance} onLit={setLit} /> + <MediaFields project={project} view={view} act={drafts.act} provenance={provenance} onLit={setLit} lineGo={false} /> </BenchBody> ); } diff --git a/umtool/components/projects/NarrationReview.tsx b/umtool/components/projects/NarrationReview.tsx @@ -360,7 +360,7 @@ function NarrationCard({ aria-pressed={r.state === "approved"} disabled={!ready || busy || dirty} title={dirty ? "save the words first: a verdict is on the words as saved" : "approve these words in this voice"} - className={buttonVariants({ variant: r.state === "approved" ? "primary" : "outline", size: "sm" })} + className={`${buttonVariants({ variant: "outline", size: "sm" })}${r.state === "approved" ? " bg-panel-2 border-muted" : ""}`} onClick={() => void run(() => act(r.id, r.state === "approved" ? "clear" : "approve", r.state === "approved" ? {} : { note }))} > {r.state === "approved" ? "Approved" : "Approve"} diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx @@ -1343,7 +1343,7 @@ export default function OnscreenSection({ <button type="button" data-testid="onscreen-save" - className={`${buttonVariants({ variant: "primary", size: "sm" })} ml-auto`} + className={`${buttonVariants({ variant: "outline", size: "sm" })} ml-auto`} disabled={!!busy || dirtyIds.length === 0} onClick={() => void saveRows()} > @@ -1522,7 +1522,7 @@ export default function OnscreenSection({ <button type="button" data-testid="onscreen-posts-save" - className={`${buttonVariants({ variant: "primary", size: "sm" })} ml-auto`} + className={`${buttonVariants({ variant: "outline", size: "sm" })} ml-auto`} disabled={!!busy || dirtyPostIds.length === 0} onClick={() => void savePosts()} > @@ -1929,7 +1929,7 @@ export default function OnscreenSection({ <button type="button" data-testid="onscreen-rerender" - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} // Over the segments a build left, so there must have been one. disabled={job?.state === "running" || finalV === "none"} onClick={() => void rerender()} @@ -2010,7 +2010,7 @@ export default function OnscreenSection({ <button type="button" data-testid="onscreen-settings-save" - className={`${buttonVariants({ variant: "primary", size: "sm" })} ml-auto`} + className={`${buttonVariants({ variant: "outline", size: "sm" })} ml-auto`} disabled={!!busy || !formDirty} onClick={() => void saveSettings()} > diff --git a/umtool/components/projects/ReviewPage.tsx b/umtool/components/projects/ReviewPage.tsx @@ -29,7 +29,9 @@ export default async function ReviewPage({ project }: { project: ProjectRef }) { manifestToken(project.dir), manifest ? readClipDetail(project.dir, { manifest }) : Promise.resolve(null), ]); - const { counts } = view; + // Every field on the list, drafted or a narration written by hand. + const counts = { approved: 0, rejected: 0, edited: 0, unreviewed: 0 }; + for (const r of view.rows) counts[r.state] += 1; // The source of every clip a drafted field is drawn over: the reader's. const evidence: Record<string, FieldEvidence> = {}; diff --git a/umtool/components/projects/TakesBench.tsx b/umtool/components/projects/TakesBench.tsx @@ -231,7 +231,7 @@ export default function TakesBench({ type="button" data-action="play-all" disabled={!ready} - className={buttonVariants({ variant: "primary", size: "sm" })} + className={buttonVariants({ variant: "outline", size: "sm" })} onClick={() => void playAll(g)} > Play all from start diff --git a/umtool/components/projects/bench/BenchShell.tsx b/umtool/components/projects/bench/BenchShell.tsx @@ -182,7 +182,7 @@ export function BenchBody({ data-bench-body="" className={cn( "flex min-h-0 flex-1 flex-col lg:grid", - reader ? "lg:grid-cols-[minmax(0,1fr)_minmax(340px,30%)]" : "lg:grid-cols-[minmax(0,1fr)]", + reader ? "lg:grid-cols-[minmax(0,1fr)_minmax(320px,28%)]" : "lg:grid-cols-[minmax(0,1fr)]", )} > <div className="flex min-h-0 min-w-0 flex-col"> @@ -218,8 +218,8 @@ export function VerdictBar({ className={cn("flex shrink-0 flex-wrap items-center gap-2 border-t border-seam bg-ground px-4 pb-3 pt-2.5", className)} {...props} > - <p data-verdict-question="" className="m-0 basis-full text-[14px] leading-snug text-text"> - {question} + <p className="m-0 basis-full text-[14px] leading-snug text-text"> + <span data-verdict-question="">{question}</span> {consequence && ( <> {" "} diff --git a/umtool/components/projects/drafts.tsx b/umtool/components/projects/drafts.tsx @@ -151,7 +151,7 @@ export function DraftBadge({ address, view, act, compact = false }: { address: s aria-pressed={row.state === "approved"} disabled={!ready || busy} title="approve this draft as it is now" - className={buttonVariants({ variant: row.state === "approved" ? "primary" : "outline", size: "sm" })} + className={`${buttonVariants({ variant: "outline", size: "sm" })}${row.state === "approved" ? " bg-panel-2 border-muted" : ""}`} onClick={() => void run(row.state === "approved" ? "clear" : "approve", row.state === "approved" ? {} : { note })} > {row.state === "approved" ? "Approved" : "Approve"} diff --git a/umtool/e2e/article-iterations.spec.ts b/umtool/e2e/article-iterations.spec.ts @@ -72,14 +72,21 @@ test("an article in the making: listed as such on Work, opened as its piece, its }); test("narrate an iteration's cut on a model: a step, its job followed to done", async ({ page }) => { + // The Iterations tab links a cut's media drafts (P4b); narration is drafted + // on the Media tab, its job followed on the ONE JobProgress. await page.goto(urls.articleHref(ZETA, { tab: "iterations" })); const one = card(page, 1); - await one.getByRole("combobox", { name: "narration model for i1" }).selectOption("claude-sonnet-5-5"); - await one.getByRole("button", { name: "Narrate" }).click(); - await expect(page.getByRole("status").filter({ hasText: "i1 started" })).toBeVisible(); - await expect(one.locator("[data-step='narrate']")).toHaveAttribute("data-step-status", "done", { timeout: 20_000 }); + await expect(one.locator("[data-media-link]")).toHaveAttribute("href", urls.projectHref("gen-projects/zeta/i1", { tab: "media" })); + await one.locator("[data-media-link]").click(); + await expect(page).toHaveURL(new RegExp(`${urls.articleHref(ZETA, { tab: "media", project: "gen-projects/zeta/i1" }).replace(/[?]/g, "\\?")}$`)); + const narrate = page.locator("[data-media-section='narrate'] [data-draft-task='narrate']"); + await narrate.getByRole("combobox", { name: "model for narration" }).selectOption("claude-sonnet-5-5"); + await narrate.getByRole("button", { name: "Draft narration" }).click(); + await expect(narrate).toHaveAttribute("data-draft-job", "done", { timeout: 20_000 }); const asked = stubAsked("report-draft").at(-1)!; expect(asked).toMatchObject({ task: "narrate", article: "zeta", iteration: 1, model: "claude-sonnet-5-5", authorization: "Bearer umtool-e2e-token" }); + await page.goto(urls.articleHref(ZETA, { tab: "iterations" })); + await expect(one.locator("[data-step='narrate']")).toHaveAttribute("data-step-status", "done", { timeout: 20_000 }); }); test("use, revise, copy with model, cancel: each through the editor, the list following its jobs", async ({ page, request }) => { diff --git a/umtool/e2e/bench-shell.spec.ts b/umtool/e2e/bench-shell.spec.ts @@ -0,0 +1,155 @@ +import { test, expect, type Page } from "@playwright/test"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// THE BENCH SHELL (plans/umtool-redesign.md, P4b; canvas "Clip bench"): one +// frame for the clip, claim, narration, takes and drafts-review benches -- +// the top bar ← the piece · the bench · N of M · ‹ prev / next › · keys +// the verdict bar ONE question, its consequence, the actions by result +// the reader the source's cues, the cited one lit, the cite thread +// -- fitting 1366×768, no rail, no page scroll. +// +// Fixtures (fixtures/bench-shell-fixture.mjs): bench-shell-fixture (READ-ONLY: +// s01 ends mid-sentence, s02 is the rest of the sentence), media-review-fixture +// (three fields to review, written by the review test alone); bench-fixture's +// ledger for the claim bench (read here, never written); takes-fixture. +// --------------------------------------------------------------------------- + +const SHELL = "reports/bench-shell-fixture"; +const REVIEW = "reports/media-review-fixture"; +const BENCH = "reports/bench-fixture"; + +/** The page fits the laptop: no horizontal scroll, no vertical page scroll. */ +async function fits(page: Page) { + const { w, h } = await page.evaluate(() => ({ + w: document.documentElement.scrollWidth, + h: document.documentElement.scrollHeight, + })); + expect(w).toBeLessThanOrEqual(1366); + expect(h).toBeLessThanOrEqual(768); +} + +test.beforeEach(async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 768 }); +}); + +test("the clip bench: the top bar, the one question with its consequence, the reader with the cited cue lit", async ({ page }) => { + await page.goto(urls.clipBenchHref(SHELL, "s01")); + const top = page.locator("[data-bench-top]"); + // The head: home, the piece (its Cut), the bench, where you are, the walk, the keys. + await expect(top).toHaveAttribute("data-app-header", "bench"); + await expect(top.getByRole("link", { name: "umtool home" })).toHaveAttribute("href", "/"); + await expect(top.locator("[data-bench-back]")).toHaveAttribute("href", urls.projectHref(SHELL, { tab: "cut" })); + await expect(top.locator("[data-bench-kind]")).toHaveText("Clip bench"); + await expect(top.locator("[data-bench-pos]")).toHaveText("1 of 2"); + await expect(top.locator("[data-clip-nav=prev]")).toHaveCount(0); + await expect(top.locator("[data-clip-nav=next]")).toHaveText(/s02/); + await expect(top.locator("[data-bench-keys]")).toContainText("confirm"); + // No rail on a bench. + await expect(page.locator(".app-rail")).toHaveCount(0); + + // ONE question: s01 ends mid-sentence, so the bar asks to extend it -- and + // says what that would cover before you choose. + const bar = page.locator("[data-verdict-bar]"); + await expect(bar.locator("[data-verdict-question]")).toContainText("Extend s01 to the end of the sentence?"); + await expect(bar.locator("[data-verdict-consequence]")).toHaveText("It would end at 0:09.00 (+3.0 s), covering all of s02."); + const extend = bar.locator("[data-verdict-extend]"); + await expect(extend).toHaveText("Extend to 0:09.00"); + await expect(extend).toHaveClass(/bg-signal/); + // The walk's own answers stay, as outlines while the extension is the question. + await expect(bar.locator("[data-verdict-yes]")).not.toHaveClass(/bg-signal/); + await expect(bar.locator("[data-verdict-keep]")).toHaveText("Keep the cut here"); + + // The reader: the source on the reader surface, the cited cue (3 s) lit, Copy citation. + const reader = page.getByRole("complementary", { name: "Reader" }); + await expect(reader).toBeVisible(); + await expect(reader.locator("[data-transcript] [data-tcue][data-lit]")).toHaveAttribute("data-tcue", "3"); + await expect(reader.locator("[data-tcue='3']")).toHaveAttribute("data-cited", "1"); + await expect(reader.locator("[data-copy-citation]")).toBeVisible(); + await expect(reader).toContainText("cites 0:03"); + + // The answer column still holds the last field on screen. + const box = await page.locator("[data-attrib-field=correction]").boundingBox(); + expect(box!.y + box!.height).toBeLessThanOrEqual(768); + await fits(page); +}); + +test("the clip bench's keys walk the cut: n and p", async ({ page }) => { + await page.goto(urls.clipBenchHref(SHELL, "s01")); + // Live once the bench's own keys answer: `x` puts the cursor in the note. + const note = page.locator("[data-attrib-field=correction]"); + await expect(async () => { + await page.locator("body").press("x"); + await expect(note).toBeFocused({ timeout: 500 }); + }).toPass({ timeout: 10_000 }); + await note.blur(); + await page.locator("body").press("n"); + await expect(page.locator("[data-bench=s02]")).toBeVisible(); + await expect(page.locator("[data-bench-pos]")).toHaveText("2 of 2"); + // s02 ends the sentence and is locked: the bar asks the walk's question. + await expect(page.locator("[data-verdict-question]")).toHaveText("Is s02 what the report says it is?"); + await expect(page.locator("[data-verdict-yes]")).toHaveClass(/bg-signal/); + await page.locator("body").press("p"); + await expect(page.locator("[data-bench=s01]")).toBeVisible(); +}); + +test("the claim bench: its context on the reader, the cited cue lit, j/k from anywhere, Save ruling in the verdict bar", async ({ page }) => { + await page.goto(urls.claimBenchHref(BENCH, "k01")); + await expect(page.locator("[data-bench-top] [data-bench-kind]")).toHaveText("Claim bench"); + await expect(page.locator("[data-bench-pos]")).toHaveText("1 of 3"); + const ctx = page.getByTestId("claim-context"); + const lit = ctx.locator("[data-lit-line][data-lit]"); + await expect(lit).toHaveAttribute("data-cited", "1"); + await expect(page.locator("[data-verdict-question]")).toHaveText("Save the ruling on k01?"); + await expect(page.getByTestId("claim-save")).toHaveText("Save ruling"); + // j moves the lit cue, from anywhere on the page that is not a field. + const first = await lit.textContent(); + await page.locator("body").press("j"); + await expect(lit).not.toHaveText(first ?? ""); + await fits(page); +}); + +test("the drafts review is a bench: j/k light a field, the bar asks about it, a approves, r goes to the note", async ({ page }) => { + await page.goto(urls.reviewHref(REVIEW)); + await expect(page.locator("[data-bench-top] [data-bench-kind]")).toHaveText("Drafts review"); + await expect(page.locator("[data-bench-back]")).toHaveAttribute("href", urls.projectHref(REVIEW, { tab: "media" })); + const rows = page.locator("[data-draft-row]"); + await expect(rows).toHaveCount(3); + const bar = page.locator("[data-verdict-bar]"); + // The first field is lit: m01's on-screen text, the clip it is drawn over on the reader. + await expect(bar.locator("[data-verdict-question]")).toHaveText("Approve the drafted on-screen text of m01?"); + await expect(bar.locator("[data-verdict-consequence]")).toHaveText("A final build refuses it until it is approved."); + const reader = page.getByRole("complementary", { name: "Reader" }); + await expect(reader.locator("[data-lit-line][data-lit]")).toBeVisible(); + // Its provenance: the second attempt kept, the first's broken rule said. + await expect(page.locator("[data-draft-row='onscreen/m01/onscreen'] [data-draft-prov]")).toContainText("attempt 2 of 2 chosen"); + await expect(page.locator("[data-draft-row='onscreen/m01/onscreen'] [data-draft-prov]")).toContainText("title over 60 characters"); + + // Live once the list has hydrated; then j, a. + await expect(page.getByRole("group", { name: "Drafted fields" })).toHaveAttribute("data-hydrated", ""); + await page.locator("body").press("j"); + await expect(bar).toHaveAttribute("data-verdict-for", "onscreen/m02/onscreen"); + await page.locator("body").press("a"); + await expect(page.locator("[data-draft-row='onscreen/m02/onscreen']")).toHaveAttribute("data-state", "approved"); + await expect(bar.locator("[data-verdict-question]")).toHaveText("The on-screen text of m02 is approved."); + + // The narration card: no clip under it -- the reader says so; r puts the cursor in its note. + await page.locator("body").press("j"); + await expect(bar).toHaveAttribute("data-verdict-for", "narrate/k01/narration"); + await expect(reader).toContainText("No source window for this field"); + await page.locator("body").press("r"); + await expect(page.locator("[data-draft-row='narrate/k01/narration'] [data-draft-note]")).toBeFocused(); + await fits(page); +}); + +test("narration and takes wear the same shell: the top bar back to the piece, and one question", async ({ page }) => { + await page.goto(urls.narrationHref("reports/narration-review-fixture")); + await expect(page.locator("[data-bench-shell=narration] [data-bench-kind]")).toHaveText("Narration"); + await expect(page.locator("[data-verdict-question]")).toContainText("narration of"); + await fits(page); + + await page.goto(urls.takesHref("reports/takes-fixture")); + await expect(page.locator("[data-bench-shell=takes] [data-bench-kind]")).toHaveText("Takes"); + await expect(page.locator("[data-verdict-question]")).toHaveText("Listen to a take to judge it: like, maybe or no."); + await expect(page.locator("[data-bench-keys]")).toContainText("listen"); +}); diff --git a/umtool/e2e/fixtures/bench-shell-fixture.mjs b/umtool/e2e/fixtures/bench-shell-fixture.mjs @@ -0,0 +1,109 @@ +// What bench-shell.spec.ts and piece.spec.ts's Media test act on (P4b): their +// own projects, so the other specs' writes never move what they assert. +// +// reports/bench-shell-fixture/ READ-ONLY. vid1's run-on cue (3-6 s) and the +// sentence that closes at 9 s: +// s01 3.00-6.00 ends mid-sentence: the verdict bar asks to extend it +// to 0:09.00, which would cover all of s02 +// s02 6.00-9.00 locked +// reports/media-tab-fixture/ writable by piece.spec's Media test: three +// reports/media-review-fixture/ fields to review, and the same for the +// review bench (bench-shell.spec), each with the draft files that say +// where they came from: +// m01 on-screen text drafted by qwen3:8b on its SECOND attempt; the +// first broke "title over 60 characters" (onscreen-draft.json) +// m02 on-screen text drafted on its first attempt +// k01 a card's narration from release 25's narrate (narration-draft.json, +// its units at the top level, no mark in the manifest): attempt 1 +// broke "text in quotation marks", attempt 2 was kept +// +// Synthetic, like every fixture. +import { copyFileSync, mkdirSync, writeFileSync } from "node:fs"; +import path from "node:path"; + +const AT = "2026-10-13T10:00:00.000Z"; +const P = (task, attempt) => ({ task, model: "qwen3:8b", at: AT, iteration: 1, attempt }); + +const write = (dir, name, doc) => { + mkdirSync(dir, { recursive: true }); + writeFileSync(path.join(dir, name), JSON.stringify(doc, null, 2) + "\n"); +}; + +/** + * @param {{ reports: string, manifest: Function, cachedWindow: string }} o + * `manifest` is make-fixture's manifest(slug, title, provenance, timeline); + * `cachedWindow` the vid1 0-9 s window the build fixtures share. + */ +export function makeBenchShellFixture({ reports, manifest, cachedWindow }) { + const bench = path.join(reports, "bench-shell-fixture"); + write( + bench, + "video.manifest.json", + manifest("bench-shell-fixture", "The Bench Shell Fixture", { siteOrigin: "https://archive.example" }, [ + { type: "clip", id: "s01", video: "vid1", start: 3.0, end: 6.0, cite: 3, section: 0, quote: "and because" }, + { type: "clip", id: "s02", video: "vid1", start: 6.0, end: 9.0, cite: 6, section: 0, lock: true, quote: "the rest of it" }, + ]), + ); + mkdirSync(path.join(bench, "out", "clips-raw"), { recursive: true }); + copyFileSync(cachedWindow, path.join(bench, "out", "clips-raw", path.basename(cachedWindow))); + + const made = []; + for (const slug of ["media-tab-fixture", "media-review-fixture"]) { + const dir = path.join(reports, slug); + write( + dir, + "video.manifest.json", + manifest(slug, "The Media Tab Fixture", { siteOrigin: "https://archive.example" }, [ + { + type: "clip", id: "m01", video: "vid1", start: 3.0, end: 6.0, cite: 3, section: 0, lock: true, quote: "and because", + onscreen: { title: "She will not sell" }, drafted: { onscreen: P("onscreen", 2) }, + }, + { + type: "clip", id: "m02", video: "vid1", start: 9.0, end: 12.0, cite: 9, section: 0, lock: true, quote: "another whole sentence", + onscreen: { title: "The county voted" }, drafted: { onscreen: P("onscreen", 1) }, + }, + { type: "card", id: "k01", style: "chapter", seconds: "auto", heading: "The county", narration: { text: "Half a year on, the county said yes." } }, + ]), + ); + write(dir, "onscreen-draft.json", { + task: "onscreen", + model: "qwen3:8b", + at: AT, + article: "media-tab", + iteration: 1, + units: { + m01: { + target: { entry: "m01", field: "onscreen" }, + label: "m01", + attempts: [ + { value: { title: "She says she would never, ever sell the family bakery to any chain" }, hard: ["title over 60 characters"], soft: [] }, + { value: { title: "She will not sell" }, hard: [], soft: [] }, + ], + chosen: { value: { title: "She will not sell" }, hard: [], soft: [] }, + applied: "applied", + }, + m02: { + target: { entry: "m02", field: "onscreen" }, + label: "m02", + attempts: [{ value: { title: "The county voted" }, hard: [], soft: [] }], + chosen: { value: { title: "The county voted" }, hard: [], soft: [] }, + applied: "applied", + }, + }, + checks: [{ name: "onscreen", ok: true, detail: "2 field(s) drafted" }], + alternatives: [], + }); + write(dir, "narration-draft.json", { + k01: { + heading: "The county", + attempts: [ + { text: "\"Yes,\" said the county.", hard: ["text in quotation marks: no quotes in narration"], soft: [] }, + { text: "Half a year on, the county said yes.", hard: [], soft: [] }, + ], + chosen: { text: "Half a year on, the county said yes.", hard: [], soft: [] }, + }, + }); + made.push(dir); + } + return { bench, media: made }; +} diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -28,6 +28,7 @@ import { makeMediaDraftFixture } from "./media-draft-fixture.mjs"; import { makeMediaSurfacesFixture } from "./media-surfaces-fixture.mjs"; import { makeDeleteFixture } from "./delete-fixture.mjs"; import { makeDraftReviewFixture } from "./draft-review-fixture.mjs"; +import { makeBenchShellFixture } from "./bench-shell-fixture.mjs"; import { makeYoutubeFixture } from "./youtube-fixture.mjs"; import { makeBoardFixture, makeResearchFixture } from "./research-fixture.mjs"; import { makeRunTraceFixture } from "./run-trace-fixture.mjs"; @@ -1661,6 +1662,8 @@ for (const dir of [BENCH, BUILD, ONSCREEN, ONSCREEN_BUILD, ONSCREEN_POSTS, ONSCR // Release 28: drafted fields to review, and a final build they hold // (draft-review.spec.ts). makeDraftReviewFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); +// P4b: the bench shell's own clips, and the Media tab's fields with their draft files. +makeBenchShellFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // 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") }); @@ -1978,5 +1981,6 @@ console.log(` takes-fixture (writable: takes/ with 4 takes over 2 gro console.log(` narration-fixture (writable: a narrated card, voiced by the editor stub's tone)`); console.log(` narration-review-fixture (writable: two narrated cards, nothing judged)`); console.log(` draft-review-fixture (writable: drafted on-screen, narration, teaser; an alternative), draft-review-build-fixture`); +console.log(` bench-shell-fixture (read-only: s01 mid-sentence), media-tab-fixture, media-review-fixture (three fields with draft files)`); console.log(` youtube-fixture (writable: a drafted publish.youtube, built fast to out/youtube.txt)`); console.log(` ${taken} candidate files copied, 2 mix tracks synthesised`); diff --git a/umtool/e2e/media-surfaces.spec.ts b/umtool/e2e/media-surfaces.spec.ts @@ -6,13 +6,14 @@ import { WARM_TIMEOUT, warm } from "./warm"; import * as urls from "./urls"; // --------------------------------------------------------------------------- -// Release 28 M9, the surfaces of the media drafts: -// - "Draft with <model>" per section on a project page: the job asked of the -// editor (its model, its entries, its force), followed to its end; then -// the section re-read — the badge, the last run, the alternative kept for -// the operator's field and Use this; a project made from no iteration -// offers none, and says why; -// - Draft everything on the Iterations tab: the chain with its drafts, a +// Release 28 M9, the surfaces of the media drafts -- since P4b ONE surface, +// the Media tab: +// - "Draft with <model>" per section: the job asked of the editor (its +// model, its entries, its force), followed to its end; then the section +// re-read — the field's line with its provenance and review, the last +// run, the alternative kept for the operator's field and Use this; a +// project made from no iteration offers none, and says why; +// - Draft everything on the Media tab: the chain with its drafts, a // refused draft recorded failed and passed, the panels skipped, the // voices, the fast build and the podcast, then the YouTube draft and // out/youtube.txt. @@ -39,7 +40,7 @@ test.beforeAll(async ({ playwright }) => { test("Draft with <model> per section: the job followed, the badge, the last run, an alternative and Use this", async ({ page }) => { test.setTimeout(180_000); await page.goto(urls.section(PROJECT, "drafts")); - const panel = page.getByRole("region", { name: "draft with a model" }); + const panel = page.getByRole("region", { name: "Media drafts" }); await expect(panel).toHaveAttribute("data-draft-panel", `${ARTICLE}/i1`); // Seven sections; flips and threads say why they cannot draft on this cut. await expect(panel.locator("[data-draft-task]")).toHaveCount(7); @@ -53,11 +54,14 @@ test("Draft with <model> per section: the job followed, the badge, the last run, await cut.getByRole("button", { name: "Draft the cut" }).click(); await expect(cut).toHaveAttribute("data-draft-job", "done", { timeout: 30_000 }); expect(asked().at(-1)).toMatchObject({ task: "cut", article: ARTICLE, iteration: 1, model: "claude-sonnet-5-5", authorization: "Bearer umtool-e2e-token" }); - await expect(cut.locator("[data-draft-badge='cut/*/timeline'] [data-draft-by]")).toHaveText("drafted by claude-sonnet-5-5"); + // The field's line: its provenance (the draft file, by what model, the attempt) and its review. + const order = panel.locator("[data-draft-row='cut/*/timeline']"); + await expect(order.locator("[data-draft-prov]")).toContainText("by claude-sonnet-5-5"); + await expect(order.locator("[data-draft-prov]")).toContainText("cut-draft.json"); await expect(cut.locator("[data-draft-run='cut']")).toContainText("1 written"); expect(manifestOf(1).timeline.filter((e: { type: string }) => e.type === "clip").map((e: { id: string }) => e.id)).toEqual(["c02", "c01"]); - await cut.locator("[data-draft-badge='cut/*/timeline']").getByRole("button", { name: "Approve" }).click(); - await expect(cut.locator("[data-draft-badge='cut/*/timeline']")).toHaveAttribute("data-state", "approved"); + await order.locator("[data-draft-action='approve']").click(); + await expect(order).toHaveAttribute("data-state", "approved"); // On-screen, limited to the entry ticked. const onscreen = panel.locator("[data-draft-task='onscreen']"); @@ -84,7 +88,7 @@ test("Draft with <model> per section: the job followed, the badge, the last run, await expect(yt.locator("[data-draft-run='youtube']")).toContainText("1 kept as an alternative", { timeout: 30_000 }); expect(asked().at(-1)).toMatchObject({ task: "youtube", force: true }); expect(manifestOf(1).publish.youtube.title).toBe("The operator's own title"); - const alt = yt.locator("[data-draft-alternatives='youtube/*/publish.youtube']"); + const alt = panel.locator("[data-media-section='youtube'] [data-draft-alternatives='youtube/*/publish.youtube']"); await expect(alt).toContainText("The county vote, as the channel told it"); await alt.getByRole("button", { name: "Use this" }).click(); await expect.poll(() => manifestOf(1).publish.youtube.title, { timeout: 15_000 }).toBe("The county vote, as the channel told it"); @@ -93,18 +97,18 @@ test("Draft with <model> per section: the job followed, the badge, the last run, // A project made from no iteration offers no draft, and says why. await page.goto(urls.section("reports/youtube-fixture", "drafts")); - await expect(page.getByRole("region", { name: "draft with a model" }).locator("[data-draft-unlinked]")).toContainText("not made from an article's iteration"); + await expect(page.getByRole("region", { name: "Media drafts" }).locator("[data-draft-unlinked]")).toContainText("not made from an article's iteration"); }); test("Draft everything: every draft in order on the model chosen, a refused one passed, the panels skipped, then the fast build, the podcast and out/youtube.txt", async ({ page }) => { test.setTimeout(420_000); + // On i2's cut's Media tab (P4b): the Iterations tab links it. await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); - const two = page.locator("[data-iteration='2']"); - // The Iterations tab's per-step drafts, beside Narrate. - await expect(two.getByRole("combobox", { name: "draft task for i2" })).toBeVisible(); - await two.getByRole("combobox", { name: "Draft everything model for i2" }).selectOption("qwen3:8b"); + await page.locator("[data-iteration='2'] [data-media-link]").click(); + await expect(page.getByRole("region", { name: "Media drafts" })).toHaveAttribute("data-draft-panel", `${ARTICLE}/i2`); + await page.getByRole("combobox", { name: "Draft everything model" }).selectOption("qwen3:8b"); const before = asked().length; - await two.getByRole("button", { name: "Draft everything" }).click(); + await page.getByRole("button", { name: "Draft everything" }).click(); const chain = page.getByRole("region", { name: "i2 Draft everything" }); await expect(chain.locator("[data-chain-step]")).toHaveCount(15); const step = (name: string) => chain.locator(`[data-chain-step='${name}']`); diff --git a/umtool/e2e/piece.spec.ts b/umtool/e2e/piece.spec.ts @@ -360,3 +360,61 @@ test("an article drafted from a research board: at Research (its sweep running, rmSync(path.join(FIXTURE, "articles", article), { recursive: true, force: true }); } }); + +// --------------------------------------------------------------------------- +// The Media tab (P4b; canvas "Piece · Media"): ONE surface for every drafted +// field -- its words, where it came from (the draft file, the model, the +// attempt kept, the rule a refused attempt broke), approve or reject per +// field and all at once -- with the on-screen panel moved in from Build. +// fixtures/bench-shell-fixture.mjs: media-tab-fixture, written here alone. +// --------------------------------------------------------------------------- +test("the Media tab: every drafted field with where it came from, approve per field and all, on-screen moved from Build", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 768 }); + const P = "reports/media-tab-fixture"; + await page.goto(urls.projectHref(P, { tab: "media" })); + await expect(tab(page, "media")).toHaveAttribute("aria-current", "page"); + await expect(tab(page, "media")).toHaveText("Media2"); + const media = page.getByRole("region", { name: "Media drafts" }); + await expect(media.locator("[data-draft-row]")).toHaveCount(3); + // Made from no iteration, it drafts nothing: the sections with fields, in Draft everything's order. + await expect(media.locator("[data-media-section]")).toHaveCount(2); + await expect(media.locator("[data-draft-unlinked]")).toContainText("not made from an article's iteration"); + + const m01 = media.locator("[data-draft-row='onscreen/m01/onscreen']"); + await expect(m01.locator("[data-draft-text]")).toContainText("She will not sell"); + const prov = m01.locator("[data-draft-prov]"); + for (const words of ["onscreen-draft.json", "by qwen3:8b", "attempt 2 of 2 chosen", "attempt 1 failed", "title over 60 characters", "not reviewed"]) { + await expect(prov).toContainText(words); + } + // A release-25 narration: no mark in the manifest, its file says how it was made. + const k01 = media.locator("[data-draft-row='narrate/k01/narration']").locator("[data-draft-prov]"); + await expect(k01).toContainText("narration-draft.json"); + await expect(k01).toContainText("text in quotation marks"); + // Signal on the lit field's Approve draft only. + await expect(media.locator("[data-draft-action=approve].bg-signal")).toHaveCount(1); + + // A chip narrows the list to its section. + await media.locator("[data-media-chip=narrate]").click(); + await expect(media.locator("[data-media-section]")).toHaveCount(1); + await expect(media.locator("[data-draft-row]")).toHaveCount(1); + await media.locator("[data-media-chip=all]").click(); + await expect(media.locator("[data-draft-row]")).toHaveCount(3); + + // Approve one, then all the rest. + const m02 = media.locator("[data-draft-row='onscreen/m02/onscreen']"); + await m02.locator("[data-draft-action=approve]").click(); + await expect(m02).toHaveAttribute("data-state", "approved"); + await expect(media.locator("[data-approve-all]")).toHaveText("Approve all 2"); + await media.locator("[data-approve-all]").click(); + await expect(media.locator("[data-draft-row][data-state=approved]")).toHaveCount(3); + await expect(media.locator("[data-drafts-gate]")).toHaveAttribute("data-drafts-gate", "passes"); + await expect(media.locator("[data-approve-all]")).toHaveCount(0); + + // The on-screen panel is Media's now; the Build tab is the build. + await expect(page.getByTestId("onscreen-section")).toBeVisible(); + const w = await page.evaluate(() => document.documentElement.scrollWidth); + expect(w).toBeLessThanOrEqual(1366); + await page.goto(urls.projectHref(P, { tab: "build" })); + await expect(page.getByTestId("onscreen-section")).toHaveCount(0); + await expect(page.locator("[data-build-options]")).toBeVisible(); +});