Archilyzer · Source

archilyzer

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

commit 193dd957806d7102d9eb5806225d37eb1b7d38eb
parent ff679879b001360870172ff8d38fc94a7e3520f6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 10:27:50 -0400

umtool: song specs open the song piece's tabs; e2e/song-piece.spec.ts

browse, faces and projects open the tab their section is on through
urls.songSection (lib/pieces/song-tabs.mjs SONG_SECTION_TAB); the old
/browse/alpha lands on the Overview, /browse/alpha/wide on the Cuts tab's
view. song-piece.spec (9): the frame, Work's facet against the stepper, the
Next card, a call's tab, the tab as the URL and ?note=<target>, the cut view,
the keys, marked done, 1366×768. A cut card's name is an ink link.

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

Diffstat:
Mumtool/components/projects/song/CutsTab.tsx | 2+-
Mumtool/e2e/browse.spec.ts | 13+++++++------
Mumtool/e2e/faces.spec.ts | 4+++-
Mumtool/e2e/projects.spec.ts | 10+++++++++-
Aumtool/e2e/song-piece.spec.ts | 207+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/e2e/urls.ts | 10++++++++++
6 files changed, 237 insertions(+), 9 deletions(-)

diff --git a/umtool/components/projects/song/CutsTab.tsx b/umtool/components/projects/song/CutsTab.tsx @@ -86,7 +86,7 @@ function CutCard({ <div className="flex flex-wrap items-baseline gap-2"> <Link href={`/projects/${song.id}/${cut.name}`} - className="font-mono text-[13px] text-[var(--color-text)] hover:text-[var(--color-sel)]" + className="ink-link font-mono text-[13px]" > {cut.name} </Link> diff --git a/umtool/e2e/browse.spec.ts b/umtool/e2e/browse.spec.ts @@ -1,5 +1,6 @@ import { test, expect } from "@playwright/test"; import { caps, NO_SONG_DATA } from "./capabilities"; +import * as urls from "./urls"; // The browse pages, against the synthesised videos/ tree in make-fixture.mjs: // @@ -33,7 +34,7 @@ test("the index lists both songs, and says which cuts are missing", async ({ pag // to `wide-short`; a plain startsWith() over an unordered cut list binds it to // `wide`, and then every short's variants collect under the long one. test("a variant binds to the LONGEST matching cut name", async ({ page }) => { - await page.goto("/browse/alpha"); + await page.goto(urls.songSection("alpha", "variants")); const wide = page.locator("[data-cut=wide]"); const wideShort = page.locator("[data-cut='wide-short']"); @@ -55,7 +56,7 @@ test("a variant binds to the LONGEST matching cut name", async ({ page }) => { }); test("a song with a hole shows the hole", async ({ page }) => { - await page.goto("/browse/beta"); + await page.goto(urls.songSection("beta", "cuts")); await expect(page.locator("[data-cut=wide]")).toHaveAttribute("data-present", "1"); await expect(page.locator("[data-cut=vertical]")).toHaveAttribute("data-present", "0"); await expect(page.locator("[data-cut='vertical-short']")).toHaveAttribute("data-present", "0"); @@ -97,7 +98,7 @@ test("a verdict round-trips and survives a reload", async ({ page, request }) => }); expect(post.ok()).toBe(true); - await page.goto("/browse/alpha"); + await page.goto(urls.songSection("alpha", "verdicts")); const chip = page.locator("[data-verdict-for='variants/wide-nokit.mp4']"); await expect(chip.locator("[data-verdict=keep]")).toHaveAttribute("data-on", "1"); await expect(chip.getByText("the kit is wrong")).toBeVisible(); @@ -132,7 +133,7 @@ test("promote MOVES, and the outgoing cut survives as a variant", async ({ reque test("the demoted cut comes back under the SAME cut, with the right length", async ({ page }) => { // Runs after the promote above (the suite is serial, workers: 1). - await page.goto("/browse/alpha"); + await page.goto(urls.songSection("alpha", "cuts")); const wideShort = page.locator("[data-cut='wide-short']"); // The shipped file is now the 4s variant... @@ -243,7 +244,7 @@ test("the song page links to the trim editor once hooks are declared", async ({ await request.put("/api/browse/spec", { data: { song: "alpha", spec: { version: 1, song: "alpha", hooks: { trimSet: "mk-hooks" } } }, }); - await page.goto("/browse/alpha"); + await page.goto(urls.songSection("alpha", "operations")); await expect(page.locator("[data-op=trim-hooks]")).toHaveAttribute("data-blocked", "0"); await page.locator("[data-op=trim-hooks]").getByRole("link").click(); await expect(page).toHaveURL(/\/tools\/trim\/mk-hooks/); @@ -346,7 +347,7 @@ test("a new song gets the shape but NO cut files", async ({ request, page }) => expect(r.ok()).toBe(true); expect((await r.json()).href).toBe("/projects/gamma"); - await page.goto("/browse/gamma"); + await page.goto(urls.songSection("gamma", "cuts")); // Every cut must read as a hole. A zero-byte wide.mp4 would read as built. for (const cut of ["wide", "wide-short", "vertical", "vertical-short"]) { await expect(page.locator(`[data-cut=${cut}]`)).toHaveAttribute("data-present", "0"); diff --git a/umtool/e2e/faces.spec.ts b/umtool/e2e/faces.spec.ts @@ -3,6 +3,7 @@ import { readFileSync } from "node:fs"; import path from "node:path"; import { autoCrop, scaleOf, CORNER_PX, SHOVE_FLOOR, type Box } from "../lib/face-types"; import { caps, NO_FACEDET, NO_SOURCE_MEDIA } from "./capabilities"; +import * as urls from "./urls"; // The face judger, against the REAL episodes the fixture symlinks -- make-fixture // derives its cover corners from media/ precisely so the frame and detect routes @@ -95,7 +96,8 @@ test("/browse/faces is the face judger, at /tools/faces", async ({ page }) => { // The way in is the cover-art bench, not a tenth nav item -- AppNav is at nine // and says a tenth wraps the header on a laptop. test("the bench links to the judger and the nav does not", async ({ page }) => { - await page.goto("/browse/alpha"); + // The cover bench is the song piece's Cover tab (P4a-3). + await page.goto(urls.songSection("alpha", "faces")); const link = page.locator("[data-judge-faces]").first(); await expect(link).toBeVisible(); const cover = (await link.getAttribute("data-judge-faces")) ?? ""; diff --git a/umtool/e2e/projects.spec.ts b/umtool/e2e/projects.spec.ts @@ -194,7 +194,12 @@ test("the song URLs that already existed still mean the same thing", async ({ pa test.skip(!caps.song, NO_SONG_DATA); // A project id is a path now, but /browse/alpha and /browse/alpha/wide are // the URLs in every decision href, every spec, and whatever anybody has open. + // The song is a piece page since P4a-3: the bare address is its Overview, + // with the cut set at a glance; the cut cards are the Cuts tab. await page.goto("/browse/alpha"); + await expect(page).toHaveURL(/\/projects\/alpha$/); + await expect(page.locator("[data-song-slot=wide]")).toBeVisible(); + await page.goto(urls.songSection("alpha", "cuts")); await expect(page.locator("[data-cut=wide]")).toBeVisible(); await page.goto("/browse/alpha/wide"); // The old address rides its redirect to the same view. @@ -203,9 +208,12 @@ test("the song URLs that already existed still mean the same thing", async ({ pa // resolved rather than the project page having been served for both URLs. await expect(page.getByText(/^every note \(\d+\)$/)).toBeVisible(); + // The cut's page is a view of the Cuts tab. + await expect(page.locator("[data-piece-tabs]")).toHaveAttribute("data-piece-tabs", "cuts"); + // And the canonical path works too. await page.goto("/browse/reports/videos/alpha"); - await expect(page.locator("[data-cut=wide]")).toBeVisible(); + await expect(page.locator("[data-song-slot=wide]")).toBeVisible(); }); test("every tool page that was under /browse still answers, at /tools", async ({ page }) => { diff --git a/umtool/e2e/song-piece.spec.ts b/umtool/e2e/song-piece.spec.ts @@ -0,0 +1,207 @@ +import { test, expect, type Page } from "@playwright/test"; +import * as urls from "./urls"; +import { SONG_SECTION_TAB } from "../lib/pieces/song-tabs.mjs"; + +// --------------------------------------------------------------------------- +// The song piece (plans/umtool-redesign.md, P4a-3): a song's page is the P4a +// frame -- the head, the Spec → Cuts → Done stepper, the lifecycle chip, the +// Next card -- around ONE of five tabs, Overview · Cuts · Spec · Cover · Notes, +// and a cut's page is a view of the Cuts tab. Against make-fixture.mjs's songs: +// +// alpha all four cuts (the derived `shipped`: Done, and it looks done) +// beta wide and wide-short only (at Cuts) +// +// browse.spec runs first and promotes, notes and re-specs alpha; nothing here +// depends on which file ships, only on the set being whole. +// --------------------------------------------------------------------------- + +const ALPHA = "reports/videos/alpha"; +const BETA = "reports/videos/beta"; +const PIECE = `p:${ALPHA}`; + +const tab = (page: Page, id: string) => page.getByTestId(`piece-tab-${id}`); +const keysReady = (page: Page) => expect(page.locator("[data-piece-keys=ready]")).toBeAttached(); +const steps = (page: Page) => page.getByRole("list", { name: "Stage" }).locator("li"); + +test("the frame: title, trail, the Spec → Cuts → Done stepper, five tabs, the Overview alone", async ({ page }) => { + const res = await page.goto(urls.projectHref("alpha")); + expect(res?.status()).toBe(200); + const crumbs = page.getByRole("navigation", { name: "Breadcrumb" }); + await expect(crumbs.locator("h1")).toHaveText(/Alpha/); + await expect(crumbs).toContainText(ALPHA); + await expect(page.locator("header .micro").last()).toHaveText(/4\/4 cuts · \d+ variants/i); + + // Every cut built: at Done (a suggestion -- the lifecycle is still Active). + const frame = page.locator(`[data-piece-frame="${PIECE}"]`); + await expect(frame).toHaveAttribute("data-piece-stage", "done"); + await expect(frame).toHaveAttribute("data-piece-lifecycle", "active"); + await expect(steps(page)).toHaveText([/^Spec/, /^Cuts/, /^Done/]); + await expect(steps(page).nth(2)).toHaveAttribute("aria-current", "step"); + await expect(steps(page).nth(1)).toHaveAttribute("data-step", "done"); + + const tabs = page.getByRole("navigation", { name: "Piece" }).getByRole("link"); + await expect(tabs).toHaveText([/^Overview/, /^Cuts/, /^Spec/, /^Cover/, /^Notes/]); + await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page"); + await expect(tab(page, "cuts")).toHaveText("Cuts4"); + await expect(tab(page, "cuts")).toHaveAttribute("href", urls.projectHref(ALPHA, { tab: "cuts" })); + + // The Overview: the Next card, the decisions, the cut set at a glance, the + // looks-done suggestion, the song tools -- and none of the other tabs' sections. + await expect(page.locator("[data-next]:visible")).toBeVisible(); + await expect(page.locator("[data-song-slot]")).toHaveCount(4); + await expect(page.locator("[data-song-slot][data-present='0']")).toHaveCount(0); + await expect(page.locator("[data-song-looks-done]")).toContainText("every cut shipped"); + await expect(page.locator("[data-song-pile=sort]")).toHaveAttribute("href", urls.pileHref("sort")); + await expect(page.locator("[data-song-copy]")).toBeVisible(); + await expect(page.locator("[data-cut]")).toHaveCount(0); + await expect(page.locator("[data-op]")).toHaveCount(0); + await expect(page.locator("[data-note-for=song]")).toHaveCount(0); +}); + +test("a song with a hole is at Cuts, and Work files it where its stepper says", async ({ page }) => { + await page.goto(urls.projectHref(BETA)); + await expect(page.locator(`[data-piece-frame="p:${BETA}"]`)).toHaveAttribute("data-piece-stage", "cuts"); + await expect(steps(page).nth(1)).toHaveAttribute("aria-current", "step"); + await expect(steps(page).nth(2)).toHaveAttribute("data-step", "todo"); + await expect(page.locator("[data-song-slot=vertical]")).toHaveAttribute("data-present", "0"); + await expect(page.locator("[data-song-looks-done]")).toHaveCount(0); + + // Work: the song's own three steps on its bar; its bucket is the one the step stands in for. + await page.goto(urls.workHref({ life: "all" })); + const beta = page.locator(`[data-lit-line][data-piece='p:${BETA}']`); + await expect(beta).toHaveAttribute("data-stage", "video"); + await expect(beta).toContainText("cuts"); + const alpha = page.locator(`[data-lit-line][data-piece='${PIECE}']`); + await expect(alpha).toHaveAttribute("data-stage", "deliver"); + await expect(alpha).toContainText("done"); + await expect(alpha).toContainText("looks done"); +}); + +test("the Next card is the song's top Inbox call, and its one action goes where the Inbox's does", async ({ page, request }) => { + const inbox = (await (await request.get("/api/browse/decisions")).json()) as { + groups: { id: string; cards: { piece: string | null; kind: string; action: { label: string; href: string } }[] }[]; + }; + const top = inbox.groups.filter((g) => g.id !== "quiet").flatMap((g) => g.cards).find((c) => c.piece === PIECE); + expect(top, "the fixture's alpha has a call waiting").toBeTruthy(); + + await page.goto(urls.projectHref(ALPHA)); + const next = page.locator("[data-next]:visible"); + await expect(next.locator("[data-next-kind]")).toHaveAttribute("data-next-kind", top!.kind); + const action = next.locator("[data-next-action] > :is(a, button):visible"); + await expect(action).toHaveText(top!.action.label); +}); + +test("a song's calls land on their tab: the spec's on Spec, a cover's on Cover, a cut's on its page", async ({ request }) => { + const items = ((await (await request.get("/api/browse/decisions?project=alpha")).json()) as { items: { kind: string; href: string }[] }).items; + const WHERE: Record<string, string> = { "spec-problem": "spec", "no-plan": "spec", unattributed: "cuts", "thumb-unaccepted": "cover" }; + const songWide = items.filter((d) => WHERE[d.kind]); + expect(songWide.length, "alpha names no plan, so at least that call").toBeGreaterThan(0); + for (const d of songWide) expect(d.href, d.kind).toBe(`/projects/alpha?tab=${WHERE[d.kind]}`); + for (const d of items.filter((x) => x.kind === "unjudged-variant" || x.kind === "stale-recipe")) { + expect(d.href, d.kind).toMatch(/^\/projects\/alpha\/(wide|wide-short|vertical|vertical-short)(\?|$)/); + } +}); + +test("the tab is the URL: ?tab=, a note's target, a bad tab the Overview, and the old addresses land", async ({ page }) => { + // Every section a spec names is on the tab the table says. + expect(SONG_SECTION_TAB.cuts).toBe("cuts"); + + await page.goto(urls.songSection("alpha", "cuts")); + await expect(tab(page, "cuts")).toHaveAttribute("aria-current", "page"); + await expect(page.locator("[data-cut]")).toHaveCount(4); + await expect(page.locator("[data-song-slot]")).toHaveCount(0); + + await page.goto(urls.songSection("alpha", "spec")); + await expect(page.locator("[data-op=trim-hooks]")).toBeVisible(); + await expect(page.locator("[data-song-plans]")).toBeVisible(); + + await page.goto(urls.songSection("alpha", "cover")); + await expect(page.locator("[data-judge-faces]").first()).toBeVisible(); + + await page.goto(urls.songSection("alpha", "notes")); + await expect(page.locator("[data-note-for=song]").first()).toBeVisible(); + await expect(page.locator("[data-song-notes]")).toBeVisible(); + + await page.goto(urls.projectHref(ALPHA, { tab: "nonsense" })); + await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page"); + + // A song's notes are keyed by target: `?note=` opens the tab it is written on. + await page.goto(urls.projectHref("alpha", { note: "song" })); + await expect(tab(page, "notes")).toHaveAttribute("aria-current", "page"); + await page.goto(urls.projectHref("alpha", { note: "plan:alpha.plan.json" })); + await expect(tab(page, "spec")).toHaveAttribute("aria-current", "page"); + await page.goto(urls.projectHref("alpha", { note: "cut:vertical" })); + await expect(tab(page, "cuts")).toHaveAttribute("aria-current", "page"); + + // The old address rides P3's redirect to the Overview. + await page.goto("/browse/alpha"); + await expect(page).toHaveURL(/\/projects\/alpha$/); + await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page"); +}); + +test("a cut's page is a view of the Cuts tab: the frame, the four cuts beside the title, the bench under it", async ({ page }) => { + const res = await page.goto("/browse/alpha/wide"); + expect(res?.status()).toBe(200); + await expect(page).toHaveURL(/\/projects\/alpha\/wide$/); + await expect(tab(page, "cuts")).toHaveAttribute("aria-current", "page"); + await expect(page.locator(`[data-piece-frame="${PIECE}"]`)).toBeVisible(); + const picker = page.locator("[data-song-cut-picker=wide]"); + await expect(picker.locator("[aria-current=page]")).toHaveText("wide"); + await expect(page.locator("[data-loudness='wide.mp4']")).toBeVisible(); + // The trail's project id is the way back to the song. + await expect(page.getByRole("navigation", { name: "Breadcrumb" }).getByRole("link", { name: ALPHA })).toHaveAttribute( + "href", + urls.projectHref(ALPHA), + ); + await picker.getByRole("link", { name: "wide-short" }).click(); + await expect(page).toHaveURL(new RegExp(`/projects/${ALPHA}/wide-short$`)); + await expect(page.locator("[data-song-cut-picker=wide-short]")).toBeVisible(); +}); + +test("keys: 1–5 open the tabs, n runs the Next card's action", async ({ page }) => { + await page.goto(urls.projectHref(ALPHA)); + await keysReady(page); + await page.keyboard.press("2"); + await expect(page).toHaveURL(/\?tab=cuts$/); + await keysReady(page); + await page.keyboard.press("5"); + await expect(page).toHaveURL(/\?tab=notes$/); + await expect(tab(page, "notes")).toHaveAttribute("aria-current", "page"); + await keysReady(page); + await page.keyboard.press("1"); + await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page"); + + await keysReady(page); + const action = page.locator("[data-next-action] > a:visible"); + if ((await action.count()) > 0) { + const href = await action.getAttribute("href"); + await page.keyboard.press("n"); + await expect(page).toHaveURL(new RegExp(`${href!.replace(/[?]/g, "\\?")}$`)); + } +}); + +test("marked done, every stage is done; the lifecycle chip says so", async ({ page, request }) => { + try { + expect((await request.post("/api/pieces/lifecycle", { data: { piece: PIECE, state: "done" } })).ok()).toBe(true); + await page.goto(urls.projectHref(ALPHA)); + await expect(page.locator("[data-lifecycle-chip]")).toHaveAttribute("data-lifecycle-chip", "done"); + for (let i = 0; i < 3; i += 1) await expect(steps(page).nth(i)).toHaveAttribute("data-step", "done"); + // The suggestion is spent once the piece is marked done. + await expect(page.locator("[data-song-looks-done]")).toHaveCount(0); + await expect(page.locator("[data-next-kind=lifecycle]")).toContainText("Marked done"); + } finally { + await request.post("/api/pieces/lifecycle", { data: { piece: PIECE, state: "active" } }); + } +}); + +test("fits 1366×768: the head, the five tabs and the Next card's action without a horizontal scroll", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 768 }); + for (const href of [urls.projectHref(ALPHA), urls.projectHref(ALPHA, { tab: "cuts" }), urls.projectHref(ALPHA, { tab: "spec" }), "/projects/alpha/wide"]) { + await page.goto(href); + await expect(tab(page, "notes")).toBeInViewport(); + const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); + expect(overflow, href).toBeLessThanOrEqual(0); + } + await page.goto(urls.projectHref(ALPHA)); + await expect(page.locator("[data-next-action] > :is(a, button):visible")).toBeInViewport(); +}); diff --git a/umtool/e2e/urls.ts b/umtool/e2e/urls.ts @@ -9,6 +9,7 @@ // value here too, so a URL change is one edit in lib/hrefs.ts. import { projectHref } from "../lib/hrefs"; import { tabOfSection } from "../lib/pieces/tabs.mjs"; +import { songTabOfSection } from "../lib/pieces/song-tabs.mjs"; export * from "../lib/hrefs"; export { REDIRECTS } from "../redirects.mjs"; @@ -22,3 +23,12 @@ export { REDIRECTS } from "../redirects.mjs"; export function section(project: string, name: string, q: { all?: boolean; note?: string } = {}): string { return projectHref(project, { tab: tabOfSection(name), ...q }); } + +/** + * A song piece's tab that holds `name` (lib/pieces/song-tabs.mjs + * SONG_SECTION_TAB): `songSection("alpha", "cuts")` is `/projects/alpha?tab=cuts`. + * The song counterpart of `section` -- a song's sections are its own (P4a-3). + */ +export function songSection(song: string, name: string, q: { note?: string } = {}): string { + return projectHref(song, { tab: songTabOfSection(name), ...q }); +}