Archilyzer · Source

archilyzer

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

commit de1ad8f4b02b95d3b92dec9583be70ecb006ff59
parent 836684076800157eb70eeeff308cd6edd9c4ab90
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 10 Nov 2026 16:00:41 -0500

umtool: a ⌘K run that only reads the draft keeps the workspace's Redo -- an announce ends the Redo only when the draft's token moved (L8b re-review 1)

Since every done run that names a project is announced, a `show` or `check` after an Undo cleared the Redo
and its "Undone" though the server would still redo. The listener now reads the timeline again and clears
canRedo / the word only when the token differs from the one held at the first announce. (A write that moves
only takes/draft.json keeps the button; the server's redo refuses it then, and says so.) e2e: Undo, ⌘K show
-- Redo still enabled and redoes; Undo, a card from a block's menu -- Redo gone.

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

Diffstat:
Mumtool/components/projects/workspace/Workspace.tsx | 16+++++++++++-----
Mumtool/e2e/block-menus.spec.ts | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/umtool/components/projects/workspace/Workspace.tsx b/umtool/components/projects/workspace/Workspace.tsx @@ -169,18 +169,24 @@ export default function Workspace({ const j = await write("redo"); if (j) setUndo((u) => ({ busy: false, said: `Redone: ${String(j.op ?? "")}`, error: false, canRedo: u.canRedo })); }, [write]); - // A write elsewhere on the page (an inspector panel, the bench, Add a clip): the draft read again, and a - // Redo is gone (an edit since the undo ends it). The workspace's own writes (above) do not announce: they - // read the draft again themselves, and remount the inspector (`epoch`). + // A write elsewhere on the page (an inspector panel, the bench, Add a clip, a ⌘K run): the draft read again, + // and a Redo is gone -- but only when the draft DID change (its token moved): a run that only read it (⌘K + // `show`, `check`) keeps the Redo and its word. The workspace's own writes (above) do not announce: they read + // the draft again themselves, and remount the inspector (`epoch`). useEffect(() => { let t: ReturnType<typeof setTimeout> | null = null; + let held: string | null = null; const on = (e: Event) => { if ((e as CustomEvent).detail?.project !== project) return; - setUndo((u) => ({ ...u, canRedo: false, said: null })); if (t) clearTimeout(t); + else held = tl.current.token; // The token first (the next Undo is asked on it), then the view. t = setTimeout(() => { - void loadTimeline().then(() => reloadView()); + t = null; + void loadTimeline().then((now) => { + if (now.token !== held) setUndo((u) => ({ ...u, canRedo: false, said: null })); + return reloadView(); + }); }, 60); }; window.addEventListener(MANIFEST_CHANGED, on); diff --git a/umtool/e2e/block-menus.spec.ts b/umtool/e2e/block-menus.spec.ts @@ -342,3 +342,59 @@ test("what is typed in a block's form survives the palette's page context arrivi await page.keyboard.press("Escape"); await page.unroute(/\/api\/cli\?path=/); }); + +test("a ⌘K run that only reads the draft keeps the workspace's Redo; one that writes it ends the Redo", async ({ page }) => { + const original = manifestText(); + await open(page); + const redo = page.locator("[data-ws-redo]"); + const said = page.locator("[data-ws-undo-said]"); + + // An edit, undone: the Redo is there. + await block(page, "p-5").click({ button: "right" }); + await menuOf(page, "p-5").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(said).toContainText("Moved p-5"); + await page.locator("[data-ws-undo]").click(); + await expect.poll(manifestText, { timeout: 15_000 }).toBe(original); + await expect(said).toContainText("Undone"); + await expect(redo).toBeEnabled(); + + // ⌘K `show` (it reads the project): its end is announced, the workspace reads the draft again -- unchanged -- + // and the Redo stays, with its word. + await page.keyboard.press("Control+k"); + await expect(palette(page)).toBeVisible(); + await page.keyboard.type(">show"); + await expect(palette(page).locator("[role=option][aria-selected=true]")).toHaveAttribute("data-jump-item", "cmd:show", { timeout: 30_000 }); + await page.keyboard.press("Enter"); + const show = palette(page).locator('[data-cli-form="show"]'); + await expect(show.locator('[data-cli-arg="project"] input')).toHaveValue(P); + const reread = page.waitForResponse((r) => r.url().includes("/api/report/timeline?project=") && r.request().method() === "GET", { timeout: 60_000 }); + await show.locator("[data-cli-run]").click(); + await expect(show.locator("[data-cli-state]")).toHaveAttribute("data-cli-state", "done", { timeout: 90_000 }); + await reread; + await page.keyboard.press("Escape"); + await expect(palette(page)).toBeHidden(); + await expect(redo).toBeEnabled(); + await expect(said).toContainText("Undone"); + // …and it still works. + await redo.click(); + await expect.poll(order, { timeout: 15_000 }).toBe("c01 c02 k01 p-5 c03 c04"); + await expect(said).toContainText("Redone"); + await page.locator("[data-ws-undo]").click(); + await expect.poll(manifestText, { timeout: 15_000 }).toBe(original); + await expect(redo).toBeEnabled(); + + // A run that writes the draft (a card from c01's menu): the Redo is gone. + await block(page, "c01").click({ button: "right" }); + await menuOf(page, "c01").locator('[data-ws-menu-verb="timeline teaser-insert"]').click(); + const form = palette(page).locator('[data-cli-form="timeline teaser-insert"]'); + await form.locator('[data-cli-arg="--line"] textarea').fill("Ends the redo"); + await form.locator("[data-cli-run]").click(); + await expect(form.locator("[data-cli-state]")).toHaveAttribute("data-cli-state", "done", { timeout: 90_000 }); + await page.keyboard.press("Escape"); + await expect(palette(page)).toBeHidden(); + await expect(redo).toBeDisabled({ timeout: 15_000 }); + await expect(page.locator("[data-ws-strip] [data-ws-block]")).toHaveCount(7); + await page.locator("[data-ws-undo]").click(); + await expect.poll(manifestText, { timeout: 15_000 }).toBe(original); +});