commit 0d2aa04550b23356e3f1dddfd99827086292d7d3
parent f890fff8a03bdf5e1cd27f2cb1d26fa6fc29eadd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 13:57:20 -0500
umtool e2e: block-menus.spec -- a clip's menu lists the clip's verbs and no post's, teaser-insert's form is filled in after the block, Copy as CLI, Run, Undo restores; a post's and a chapter card's menus, Move right / Remove / ⋯ each undone; the keyboard path (Shift+F10, arrows, Enter, a letter, Esc, Tab, the context-menu key) (redesign L8b)
Two fixes the spec found: a form a block filled in is no longer remounted when the palette's page context
arrives (it dropped what was typed meanwhile); and the workspace leaves its keys to a modal open over it --
with the focus fallen to the body (the form's Run disabled while it runs), its Escape was preventDefault-ed and
the palette would not close. The menu is at most 600 px tall: flipped up from the strip, it ends above the
block. block-menus-fixture: the workspace fixture's cut, its own copy (the spec writes).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 247 insertions(+), 3 deletions(-)
diff --git a/umtool/components/projects/workspace/BlockMenu.tsx b/umtool/components/projects/workspace/BlockMenu.tsx
@@ -241,7 +241,7 @@ export default function BlockMenu({
onKeyDown={onKey}
onContextMenu={(e) => e.preventDefault()}
style={pos ? { left: pos.left, top: pos.top } : { left: -9999, top: 0 }}
- className="fixed z-50 max-h-[calc(100dvh-16px)] w-[min(380px,calc(100vw-16px))] overflow-y-auto rounded-[3px] border border-seam-2 bg-panel py-1 text-[12.5px] text-text shadow-2xl"
+ className="fixed z-50 max-h-[min(600px,calc(100dvh-16px))] w-[min(380px,calc(100vw-16px))] overflow-y-auto rounded-[3px] border border-seam-2 bg-panel py-1 text-[12.5px] text-text shadow-2xl"
>
{groups.map((g, gi) => (
<div key={g.key} role="group" aria-labelledby={`ws-menu-${g.key}`} data-ws-menu-group={g.key}>
diff --git a/umtool/components/projects/workspace/Workspace.tsx b/umtool/components/projects/workspace/Workspace.tsx
@@ -303,7 +303,10 @@ export default function Workspace({
setHelp(false);
return;
}
- if (tgt?.closest("input, textarea, select, [contenteditable=true], [data-ws-own-keys], [role=dialog]")) return;
+ if (tgt?.closest("input, textarea, select, [contenteditable=true], [data-ws-own-keys], [role=dialog], dialog")) return;
+ // A modal open over the workspace (⌘K, a form a block's menu opened) has the keys, wherever the focus fell: an
+ // Escape taken here would be preventDefault-ed, and the dialog would not close.
+ if (document.querySelector("dialog:modal")) return;
const k = ev.key;
const mod = ev.metaKey || ev.ctrlKey;
if (mod && !ev.altKey && (k === "z" || k === "Z")) {
diff --git a/umtool/components/shell/JumpPalette.tsx b/umtool/components/shell/JumpPalette.tsx
@@ -299,7 +299,9 @@ export default function JumpPalette() {
{open && form && (
<div className="flex h-[76vh] max-h-[76vh] flex-col">
<CommandForm
- key={`${form.verb}|${resume?.id ?? ""}|${ctx.project ?? ""}|${ctx.clip ?? ""}|${ctx.post ?? ""}|${ctx.take ?? ""}`}
+ // Remounted when the page's context arrives -- unless a block filled it in: the block is its context, and
+ // a remount then would drop what was typed meanwhile.
+ key={prefill && !resume ? `${form.verb}|block` : `${form.verb}|${resume?.id ?? ""}|${ctx.project ?? ""}|${ctx.clip ?? ""}|${ctx.post ?? ""}|${ctx.take ?? ""}`}
row={form}
ctx={ctx}
resume={resume}
diff --git a/umtool/e2e/block-menus.spec.ts b/umtool/e2e/block-menus.spec.ts
@@ -0,0 +1,221 @@
+import { test, expect, type Page } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// A BLOCK'S MENU (umtool redesign L8b; components/projects/workspace/BlockMenu.tsx): right-click a block of the
+// workspace's strip (or its ⋯, or Shift+F10 on it) and its menu lists the strip's own writers, then the registry
+// verbs whose row names that block's kind (lib/cli/verbs.mjs `blocks`) -- a clip's menu no post verb, a post's no
+// clip verb. A verb opens THE ⌘K form (shell/CommandForm), filled in from the block by the row's `fromBlock`;
+// Run is POST /api/cli as ⌘K's, the draft changes, and the workspace's Undo takes it back.
+//
+// block-menus-fixture (WRITES; make-fixture.mjs): the workspace fixture's cut, its own copy --
+// c01 c02 p-5 k01 c03 c04 (p-5 a post item, k01 a chapter card). Each test leaves the draft as it found it.
+// E2E_BLOCK_MENUS_SHOTS=<dir>: screenshots there (1366×768).
+// ---------------------------------------------------------------------------
+
+test.describe.configure({ mode: "serial" });
+
+const P = "reports/block-menus-fixture";
+const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".e2e-song", "reports", "block-menus-fixture");
+const SHOTS = process.env.E2E_BLOCK_MENUS_SHOTS ?? "";
+const manifestText = () => readFileSync(path.join(DIR, "video.manifest.json"), "utf8");
+const manifest = () => JSON.parse(manifestText()) as { timeline: { id: string; type: string; lines?: unknown[] }[] };
+const order = () => manifest().timeline.map((e) => e.id).join(" ");
+const ORIGINAL = "c01 c02 p-5 k01 c03 c04";
+const block = (page: Page, id: string) => page.locator(`[data-ws-block="${id}"]`);
+const menuOf = (page: Page, id: string) => page.locator(`[role="menu"][data-ws-menu="${id}"]`);
+const palette = (page: Page) => page.locator("dialog[data-jump]");
+const shot = async (page: Page, name: string) => {
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, `${name}.png`) });
+};
+
+async function open(page: Page) {
+ await page.goto(urls.workspaceHref(P));
+ await expect(page.locator(`[data-workspace="${P}"]`)).toBeVisible();
+ await expect(page.locator("[data-ws-strip] [data-ws-block]")).toHaveCount(6);
+ // The palette listens (the form opens in it) and the workspace has read the draft's token (its Undo asks on it).
+ await expect(page.locator("dialog[data-jump][data-ready]")).toBeAttached({ timeout: 60_000 });
+ await expect(page.locator("[data-workspace]")).toHaveAttribute("data-ws-token", /./);
+}
+
+test.beforeEach(async ({ page }) => {
+ test.setTimeout(150_000);
+ await page.setViewportSize({ width: 1366, height: 768 });
+});
+
+test("a clip's menu: the clip's verbs, no post's; teaser-insert's form is filled in after this block; Copy as CLI; Run; Undo restores", async ({ page, context }) => {
+ await context.grantPermissions(["clipboard-read", "clipboard-write"]);
+ const original = manifestText();
+ expect(order()).toBe(ORIGINAL);
+ await open(page);
+
+ await block(page, "c01").click({ button: "right" });
+ const menu = menuOf(page, "c01");
+ await expect(menu).toBeVisible();
+ await expect(menu).toHaveAttribute("aria-label", "Clip c01");
+ // The direct items: no form needed. c01 is first: Move left has nowhere to go.
+ for (const a of ["edit", "play", "move-left", "move-right", "remove"]) await expect(menu.locator(`[data-ws-menu-action="${a}"]`)).toBeVisible();
+ await expect(menu.locator('[data-ws-menu-action="move-left"]')).toHaveAttribute("aria-disabled", "true");
+ await expect(menu.locator('[data-ws-menu-link="bench"]')).toHaveAttribute("href", urls.clipBenchHref(P, "c01"));
+ // `ingredient` is navigation: its life-cycle page, a link (not a run).
+ await expect(menu.locator('[data-ws-menu-link="nav:ingredient"]')).toHaveAttribute("href", urls.ingredientHref("testchan", "vid1"));
+ await expect(menu.locator('[data-ws-menu-verb="ingredient"]')).toHaveCount(0);
+ // The registry's clip verbs, and not a post's.
+ for (const v of ["window", "set", "still", "quote-check", "links", "timeline move", "timeline remove", "timeline teaser-insert", "timeline split"]) {
+ await expect(menu.locator(`[data-ws-menu-verb="${v}"]`)).toHaveCount(1);
+ }
+ await expect(menu.locator('[data-ws-menu-verb^="posts "]')).toHaveCount(0);
+ await expect(menu.locator('[data-ws-menu-verb="timeline teaser"]')).toHaveCount(0);
+ // It fits the window, and the first item has the focus.
+ const box = await menu.boundingBox();
+ expect(box!.y).toBeGreaterThanOrEqual(0);
+ expect(box!.y + box!.height).toBeLessThanOrEqual(768);
+ await expect(menu.locator('[data-ws-menu-action="edit"]')).toBeFocused();
+ await shot(page, "block-menu-clip");
+
+ // teaser-insert: THE ⌘K form, filled in from the block -- the project, and after this block.
+ await menu.locator('[data-ws-menu-verb="timeline teaser-insert"]').click();
+ await expect(menu).toHaveCount(0);
+ const form = palette(page).locator('[data-cli-form="timeline teaser-insert"]');
+ await expect(form).toBeVisible();
+ await expect(form.locator('[data-cli-arg="project"] input')).toHaveValue(P);
+ await expect(form.locator('[data-cli-arg="--after"] input')).toHaveValue("c01");
+ await form.locator('[data-cli-arg="--line"] textarea').fill("From the menu");
+ const line = `node umtool/bin/umtool.mjs timeline ${P} teaser-insert --after c01 --line 'From the menu'`;
+ await expect(form.locator("[data-cli-line]")).toHaveText(line);
+ await form.locator("[data-cli-copy]").click();
+ await expect(form.locator("[data-cli-copy]")).toHaveText("Copied");
+ expect(await page.evaluate(() => navigator.clipboard.readText())).toBe(line);
+ const pbox = await palette(page).boundingBox();
+ expect(pbox!.y + pbox!.height, "the form fits 1366×768").toBeLessThanOrEqual(768);
+ await shot(page, "block-menu-form");
+
+ // Run: POST /api/cli, as ⌘K's; the draft has the card after c01.
+ await form.locator("[data-cli-run]").click();
+ await expect(form.locator("[data-cli-state]")).toHaveAttribute("data-cli-state", "done", { timeout: 90_000 });
+ const tl = manifest().timeline;
+ expect(tl[0].id).toBe("c01");
+ expect(tl[1].type).toBe("teaser");
+ const card = tl[1].id;
+ expect(order()).toBe(`c01 ${card} c02 p-5 k01 c03 c04`);
+ // The run announced the write: the strip under the palette has the card already.
+ await expect(block(page, card)).toBeVisible({ timeout: 15_000 });
+ // Esc: the palette closes and the focus is back on the block the menu was for.
+ await page.keyboard.press("Escape");
+ await expect(palette(page)).toBeHidden();
+ await expect(block(page, "c01")).toBeFocused();
+
+ // One Undo restores the draft byte for byte.
+ await page.locator("[data-ws-undo]").click();
+ await expect.poll(manifestText, { timeout: 15_000 }).toBe(original);
+ await expect(block(page, card)).toHaveCount(0);
+});
+
+test("a post's menu and a chapter card's: their verbs; Move right, Remove and ⋯ from the menu, each undone", async ({ page }) => {
+ const original = manifestText();
+ expect(order()).toBe(ORIGINAL);
+ await open(page);
+
+ await block(page, "p-5").click({ button: "right" });
+ const post = menuOf(page, "p-5");
+ await expect(post).toBeVisible();
+ await expect(post).toHaveAttribute("aria-label", "Post item p-5");
+ for (const v of ["posts set-item", "posts narrate", "posts fx", "timeline teaser-insert", "timeline move"]) await expect(post.locator(`[data-ws-menu-verb="${v}"]`)).toHaveCount(1);
+ for (const v of ["window", "set", "still", "quote-check", "timeline split"]) await expect(post.locator(`[data-ws-menu-verb="${v}"]`)).toHaveCount(0);
+ await expect(post.locator('[data-ws-menu-link="bench"]')).toHaveAttribute("href", urls.postBenchHref(P, "p-5"));
+ await shot(page, "block-menu-post");
+
+ // Move right: the strip's writer (the timeline's move), one undo point.
+ await post.locator('[data-ws-menu-action="move-right"]').click();
+ await expect.poll(order, { timeout: 15_000 }).toBe("c01 c02 k01 p-5 c03 c04");
+ await expect(page.locator("[data-ws-undo-said]")).toContainText("Moved p-5");
+ await page.locator("[data-ws-undo]").click();
+ await expect.poll(manifestText, { timeout: 15_000 }).toBe(original);
+
+ // The chapter card, from its ⋯: the cut's verbs, no clip's or post's; Remove, then Undo.
+ await block(page, "k01").hover();
+ await page.locator('[data-ws-block-more="k01"]').click();
+ const card = menuOf(page, "k01");
+ await expect(card).toBeVisible();
+ await expect(card).toHaveAttribute("aria-label", "Chapter card k01");
+ await expect(card.locator('[data-ws-menu-verb="timeline teaser-insert"]')).toHaveCount(1);
+ await expect(card.locator('[data-ws-menu-verb="window"], [data-ws-menu-verb^="posts "]')).toHaveCount(0);
+ await expect(card.locator('[data-ws-menu-action="edit"]')).toHaveCount(0);
+ await card.locator('[data-ws-menu-action="remove"]').click();
+ await expect.poll(order, { timeout: 15_000 }).toBe("c01 c02 p-5 c03 c04");
+ await expect(page.locator("[data-ws-undo-said]")).toContainText("Removed k01");
+ await expect(block(page, "k01")).toHaveCount(0);
+ await page.locator("[data-ws-undo]").click();
+ await expect.poll(manifestText, { timeout: 15_000 }).toBe(original);
+ await expect(block(page, "k01")).toBeVisible();
+
+ // A press outside closes a menu and writes nothing.
+ await block(page, "c03").click({ button: "right" });
+ await expect(menuOf(page, "c03")).toBeVisible();
+ await page.locator("[data-ws-clock]").click();
+ await expect(menuOf(page, "c03")).toHaveCount(0);
+ expect(manifestText()).toBe(original);
+});
+
+test("keyboard only: Shift+F10 opens it, the arrows move, Enter chooses, Esc closes; the focus goes back to the block", async ({ page }) => {
+ const original = manifestText();
+ await open(page);
+ await block(page, "c02").focus();
+
+ await page.keyboard.press("Shift+F10");
+ const menu = menuOf(page, "c02");
+ await expect(menu).toBeVisible();
+ const action = (a: string) => menu.locator(`[data-ws-menu-action="${a}"]`);
+ await expect(action("edit")).toBeFocused();
+ await page.keyboard.press("ArrowDown");
+ await expect(action("play")).toBeFocused();
+ await page.keyboard.press("ArrowUp");
+ await expect(action("edit")).toBeFocused();
+ // Up from the first wraps to the last; Home goes back.
+ await page.keyboard.press("ArrowUp");
+ await expect(menu.locator('[role="menuitem"]').last()).toBeFocused();
+ await page.keyboard.press("Home");
+ await expect(action("edit")).toBeFocused();
+ await page.keyboard.press("Escape");
+ await expect(menu).toHaveCount(0);
+ await expect(block(page, "c02")).toBeFocused();
+
+ // Play from here: ↓ Enter -- the block selected, the viewer playing it.
+ await page.keyboard.press("Shift+F10");
+ await expect(action("play")).toBeVisible();
+ await page.keyboard.press("ArrowDown");
+ await expect(action("play")).toBeFocused();
+ await page.keyboard.press("Enter");
+ await expect(menu).toHaveCount(0);
+ await expect(block(page, "c02")).toHaveAttribute("aria-selected", "true");
+ await expect(page.locator("[data-ws-viewer]")).toHaveAttribute("data-play-item", "c02", { timeout: 20_000 });
+ await expect(block(page, "c02")).toBeFocused();
+ await page.keyboard.press("Space");
+ await expect(page.locator("[data-ws-viewer]")).toHaveAttribute("data-play-state", "paused");
+
+ // A letter jumps to the item it starts: w is `window`; Enter opens its form, the clip filled in; Esc returns.
+ await page.keyboard.press("Shift+F10");
+ await expect(menu).toBeVisible();
+ await page.keyboard.press("w");
+ await expect(menu.locator('[data-ws-menu-verb="window"]')).toBeFocused();
+ await page.keyboard.press("Enter");
+ const form = palette(page).locator('[data-cli-form="window"]');
+ await expect(form).toBeVisible();
+ await expect(form.locator('[data-cli-arg="project"] input')).toHaveValue(P);
+ await expect(form.locator('[data-cli-arg="clip"] input')).toHaveValue("c02");
+ await expect(form.locator("[data-cli-line]")).toHaveText(`node umtool/bin/umtool.mjs window ${P} c02`);
+ await shot(page, "block-menu-keyboard-form");
+ await page.keyboard.press("Escape");
+ await expect(palette(page)).toBeHidden();
+ await expect(block(page, "c02")).toBeFocused();
+
+ // The context-menu key opens it too; Tab closes it.
+ await page.keyboard.press("ContextMenu");
+ await expect(menu).toBeVisible();
+ await page.keyboard.press("Tab");
+ await expect(menu).toHaveCount(0);
+ expect(manifestText()).toBe(original);
+});
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -2181,6 +2181,24 @@ makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out
writeFileSync(wsFile, JSON.stringify(wsM, null, 2) + "\n");
}
+// A BLOCK'S MENU (block-menus.spec.ts, umtool redesign L8b, WRITES): the workspace fixture's cut, its own copy --
+// c01 c02 p-5 k01 c03 c04 (k01 a chapter card) -- the spec inserts a card from c01's menu, moves and removes
+// blocks, and undoes each.
+{
+ const { dir: bmDir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"),
+ name: "block-menus-fixture", title: "The Block Menus Fixture", video: "vid1",
+ });
+ const bmFile = path.join(bmDir, "video.manifest.json");
+ const bmM = JSON.parse(readFileSync(bmFile, "utf8"));
+ bmM.render.chrome.factcheck.verdicts.CORROBORATED.tallyLabel = "Seized";
+ bmM.timeline.splice(2, 0, {
+ type: "post", id: "p-5", post: "postchan-x/5", platform: "x", author: "Post Subject", handle: "postsubject",
+ date: "2026-10-30T12:00:00.000Z", text: "The scale said 291 this morning. I said the scale was broken.", url: "https://x.com/postsubject/status/5", subjects: ["postsubject"],
+ });
+ writeFileSync(bmFile, JSON.stringify(bmM, null, 2) + "\n");
+}
+
// The inspector panels (inspector-*.spec.ts, umtool redesign L6, WRITE): one project per panel
// (inspector-fixture.mjs), each with a take the specs check is never written.
await makeInspectorFixtures({ reports, channels: CHANNELS, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });