Archilyzer · Source

archilyzer

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

commit c10c03f6a582faf85cda7d3c1d13ccf5532221a6
parent c01f9886b2c9f00e90d7f409a79e189b9c82c110
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 03:42:15 -0500

umtool e2e: every schedule write in the recurring-report specs is read once answered -- clickAnswered (and the keyboard's Enter on Delete schedule) wait for the POST /api/schedules each Plan, Start, Tick now, Pause, Resume, Save cadence, Delete and Confirm sends, which runs the stub's tsx child (3.4 s idle); c01f9886 covered three of them, and whole run 3 failed at the fourth (Tick now) and alone under load at two more (a living report's Plan, the keys test's delete plan). recurring + triage-first + post-narration alone: 26/26 at load 18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Diffstat:
Mumtool/e2e/recurring.spec.ts | 53+++++++++++++++++++++++++++--------------------------
Mumtool/e2e/triage-first.spec.ts | 20+++++++++++---------
2 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/umtool/e2e/recurring.spec.ts b/umtool/e2e/recurring.spec.ts @@ -1,4 +1,4 @@ -import { test, expect, type APIRequestContext, type Page } from "@playwright/test"; +import { test, expect, type APIRequestContext, type Locator, type Page } from "@playwright/test"; import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from "node:fs"; import path from "node:path"; @@ -6,10 +6,14 @@ import { fileURLToPath } from "node:url"; import * as urls from "./urls"; import { WARM_TIMEOUT, warm } from "./warm"; -/** A schedule write's answer (POST /api/schedules…): each one runs the editor stub's real action in a tsx child - * (editor-stub.mjs, spawnSync; about 3.4 s on an idle machine), longer than an expect's 5 s under load. */ -const scheduleAnswered = (page: Page) => - page.waitForResponse((r) => new URL(r.url()).pathname.startsWith("/api/schedules") && r.request().method() !== "GET", { timeout: 60_000 }); +/** A schedule write's click and its answer (POST /api/schedules): each runs the editor stub's real report-schedule + * action in a tsx child (editor-stub.mjs, spawnSync -- about 3.4 s on an idle machine, measured), longer than an + * expect's 5 s under load. The page is read once the answer is in. */ +const clickAnswered = async (page: Page, button: Locator) => { + const answered = page.waitForResponse((r) => new URL(r.url()).pathname.startsWith("/api/schedules") && r.request().method() !== "GET", { timeout: 60_000 }); + await button.click(); + await answered; +}; // --------------------------------------------------------------------------- // RECURRING REPORTS (plans/umtool-redesign.md, R5) over the editor stub, which @@ -104,9 +108,7 @@ test("Create → A recurring report: a series, planned (first tick, model, cap), await expect(form.getByRole("combobox", { name: "cadence" })).toHaveValue("weekly"); await expect(form.getByRole("combobox", { name: "day of the week" })).toHaveValue("1"); await shoot(page, "create-recurring"); - const planned = scheduleAnswered(page); - await form.getByRole("button", { name: "Plan the schedule" }).click(); - await planned; + await clickAnswered(page, form.getByRole("button", { name: "Plan the schedule" })); const plan = form.getByRole("region", { name: "plan recurring report" }); await expect(plan).toContainText("Series r5-cohost · weekly · Mon 06:00 · first tick Mon 06:00"); await expect(plan.locator("[data-plan-first-tick]")).toHaveAttribute("data-plan-first-tick", /T\d\d:00:00\.000Z$/); @@ -130,7 +132,7 @@ test("the series page: Tick now makes an edition over whole days; again at once, // Monday 2026-10-19, noon UTC (the same date on the stub's clock, whatever its zone). await clock(request, { now: "2026-10-19T12:00:00.000Z" }); await page.goto(urls.seriesHref("r5-cohost")); - await page.getByRole("button", { name: "Tick now" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Tick now" })); await expect(page.locator("[data-schedule-said]")).toContainText(/Tick queued — job stub-tick-\d+/); const done = page.locator("[data-edition='1']"); await expect(done).toHaveAttribute("data-edition-status", "done"); @@ -143,7 +145,7 @@ test("the series page: Tick now makes an edition over whole days; again at once, await expect(page.locator("[data-series-next]")).toHaveText(/^(Nothing to cover yet — the next edition starts 2026-10-19|next, Mon 06:00: 2026-10-19 … \d{4}-\d{2}-\d{2})$/); // At once again: no day is read twice -- no edition, $0, said plainly, no card. - await page.getByRole("button", { name: "Tick now" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Tick now" })); const ticks = page.getByRole("table", { name: "ticks" }); await expect(ticks.locator("tbody tr")).toHaveCount(2); await expect(ticks.locator("tbody tr").first()).toContainText("Nothing to cover yet — the next edition starts 2026-10-19"); @@ -151,7 +153,7 @@ test("the series page: Tick now makes an edition over whole days; again at once, // A week on, nothing in the window matches: a quiet edition, dimmed, no link. await clock(request, { now: "2026-10-26T12:00:00.000Z", quiet: true }); - await page.getByRole("button", { name: "Tick now" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Tick now" })); const quiet = page.locator("[data-edition='2']"); await expect(quiet).toHaveAttribute("data-edition-status", "quiet"); await expect(quiet).toHaveClass(/opacity-55/); @@ -167,19 +169,15 @@ test("the series page: Tick now makes an edition over whole days; again at once, await expect(page.locator("[data-series-spent]")).toHaveAttribute("data-series-spent", "0.37"); await shoot(page, "series-page"); - let answered = scheduleAnswered(page); - await page.getByRole("button", { name: "Pause schedule" }).click(); - await answered; + await clickAnswered(page, page.getByRole("button", { name: "Pause schedule" })); await expect(page.locator("[data-schedule-chip]")).toHaveText(/weekly · paused/); - answered = scheduleAnswered(page); - await page.getByRole("button", { name: "Resume schedule" }).click(); - await answered; + await clickAnswered(page, page.getByRole("button", { name: "Resume schedule" })); await expect(page.locator("[data-schedule-chip]")).toHaveText(/weekly · next Mon 06:00/); await page.getByRole("button", { name: "Edit cadence" }).click(); const edit = page.getByRole("form", { name: "edit cadence" }); await edit.getByRole("combobox", { name: "cadence" }).selectOption("daily"); await edit.locator('input[aria-label="at"]').fill("07:30"); - await edit.getByRole("button", { name: "Save cadence" }).click(); + await clickAnswered(page, edit.getByRole("button", { name: "Save cadence" })); await expect(page.locator("[data-schedule-chip]")).toHaveText(/daily · next \w{3} 07:30/); expect(series("r5-cohost").cadence).toEqual({ kind: "daily", at: "07:30" }); expect(stubAsked("report-schedule").map((r) => r.action)).toEqual(expect.arrayContaining(["tick-now", "pause", "resume", "update"])); @@ -202,7 +200,10 @@ test("keys: the head's controls in Tab order; Edit cadence opens on its first fi await expect(edit).toHaveCount(0); await expect(page.getByRole("button", { name: "Edit cadence" })).toBeFocused(); await page.keyboard.press("Tab"); + // Enter on Delete schedule asks for the plan (a schedule write's round-trip, clickAnswered's): read once answered. + const planned = page.waitForResponse((r) => new URL(r.url()).pathname.startsWith("/api/schedules") && r.request().method() !== "GET", { timeout: 60_000 }); await page.keyboard.press("Enter"); + await planned; const plan = page.getByRole("region", { name: "delete schedule r5-cohost" }); await expect(plan.getByRole("button", { name: "Confirm delete" })).toBeFocused(); await page.keyboard.press("Escape"); @@ -263,13 +264,13 @@ test("a living report: Create makes it; its article carries the cadence chip wit await form.getByRole("textbox", { name: "topic" }).fill("R5 living"); await form.getByRole("textbox", { name: "find a channel" }).fill("site"); await form.getByRole("button", { name: /Site Channel/ }).click(); - await form.getByRole("button", { name: "Plan the schedule" }).click(); + await clickAnswered(page, form.getByRole("button", { name: "Plan the schedule" })); await expect(form.getByRole("region", { name: "plan recurring report" })).toContainText("a new article, r5-living: its first tick is its first sweep"); - await form.getByRole("button", { name: "Start the schedule" }).click(); + await clickAnswered(page, form.getByRole("button", { name: "Start the schedule" })); await page.waitForURL(/\/articles\/r5-living$/, { timeout: 20_000 }); const head = page.locator("[data-piece-schedule='r5-living']"); await expect(head.locator("[data-schedule-chip]")).toHaveText(/weekly · next Mon 06:00/); - await head.getByRole("button", { name: "Tick now" }).click(); + await clickAnswered(page, head.getByRole("button", { name: "Tick now" })); await expect(head.locator("[data-schedule-said]")).toContainText(/Tick queued/); // The first tick is the article's first sweep: an iteration, ready for review. await expect(page.locator("[data-testid='piece-tab-iterations']")).toContainText("1"); @@ -279,12 +280,12 @@ test("a living report: Create makes it; its article carries the cadence chip wit await page.goto("/articles/r5-living"); await page.getByRole("button", { name: "More" }).click(); - await page.getByRole("button", { name: "Delete schedule" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Delete schedule" })); const plan = page.getByRole("region", { name: "delete schedule r5-living" }); await expect(plan).toContainText("the schedule of r5-living"); await expect(plan.getByRole("list", { name: "what is kept" })).toContainText("the article r5-living and its iterations"); await expect(plan.getByRole("button", { name: "Confirm delete" })).toBeFocused(); - await plan.getByRole("button", { name: "Confirm delete" }).click(); + await clickAnswered(page, plan.getByRole("button", { name: "Confirm delete" })); await expect(page.locator("[data-piece-schedule]")).toHaveCount(0); expect(existsSync(path.join(ARTICLES, "r5-living", "schedule.json"))).toBe(false); expect(existsSync(path.join(ARTICLES, "r5-living", "iterations", "1", "iteration.json"))).toBe(true); @@ -292,7 +293,7 @@ test("a living report: Create makes it; its article carries the cadence chip wit test("delete a series: the plan says the editions stay as articles; Keep it writes nothing; Confirm delete goes to the recurring list", async ({ page }) => { await page.goto(urls.seriesHref("r5-cohost")); - await page.getByRole("button", { name: "Delete schedule" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Delete schedule" })); const plan = page.getByRole("region", { name: "delete schedule r5-cohost" }); await expect(plan).toContainText("the series r5-cohost"); await expect(plan.getByRole("list", { name: "what is kept" })).toContainText("1 edition article, as articles: r5-cohost-"); @@ -300,8 +301,8 @@ test("delete a series: the plan says the editions stay as articles; Keep it writ await expect(plan).toHaveCount(0); await expect(page.getByRole("button", { name: "Delete schedule" })).toBeFocused(); expect(existsSync(path.join(ARTICLES, ".series", "r5-cohost", "series.json"))).toBe(true); - await page.getByRole("button", { name: "Delete schedule" }).click(); - await page.getByRole("region", { name: "delete schedule r5-cohost" }).getByRole("button", { name: "Confirm delete" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Delete schedule" })); + await clickAnswered(page, page.getByRole("region", { name: "delete schedule r5-cohost" }).getByRole("button", { name: "Confirm delete" })); await page.waitForURL(/\/work\?recurring=1$/, { timeout: 20_000 }); expect(existsSync(path.join(ARTICLES, ".series", "r5-cohost"))).toBe(false); // The edition is an article in its own right now. diff --git a/umtool/e2e/triage-first.spec.ts b/umtool/e2e/triage-first.spec.ts @@ -1,14 +1,18 @@ -import { test, expect, type Page } from "@playwright/test"; +import { test, expect, type Locator, type Page } from "@playwright/test"; import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import * as urls from "./urls"; import { WARM_TIMEOUT, warm } from "./warm"; -/** A schedule write's answer (POST /api/schedules…): each one runs the editor stub's real action in a tsx child - * (editor-stub.mjs, spawnSync; about 3.4 s on an idle machine), longer than an expect's 5 s under load. */ -const scheduleAnswered = (page: Page) => - page.waitForResponse((r) => new URL(r.url()).pathname.startsWith("/api/schedules") && r.request().method() !== "GET", { timeout: 60_000 }); +/** A schedule write's click and its answer (POST /api/schedules): each runs the editor stub's real report-schedule + * action in a tsx child (editor-stub.mjs, spawnSync -- about 3.4 s on an idle machine, measured), longer than an + * expect's 5 s under load. The page is read once the answer is in. */ +const clickAnswered = async (page: Page, button: Locator) => { + const answered = page.waitForResponse((r) => new URL(r.url()).pathname.startsWith("/api/schedules") && r.request().method() !== "GET", { timeout: 60_000 }); + await button.click(); + await answered; +}; // --------------------------------------------------------------------------- // TRIAGE FIRST (plans/umtool-redesign.md, R6) over the editor stub, which runs @@ -101,9 +105,7 @@ test("Create → A recurring report → Watch: its terms, topics and threshold, await expect(form.getByRole("textbox", { name: "strong flags" })).toHaveValue("1"); await expect(form.getByRole("textbox", { name: "flags of any strength" })).toHaveValue("3"); await shoot(page, "create-watch"); - const planned = scheduleAnswered(page); - await form.getByRole("button", { name: "Plan the schedule" }).click(); - await planned; + await clickAnswered(page, form.getByRole("button", { name: "Plan the schedule" })); const plan = form.getByRole("region", { name: "plan recurring report" }); await expect(plan).toContainText("Watch r6-watch · weekly · Mon 06:00"); await expect(plan.locator("[data-plan-triage]")).toContainText(/triage first on \S+ \(\$0\): escalates on 1 strong or 3 weak · at most \d+ escalations? a day; no article until one does/); @@ -167,7 +169,7 @@ test("R6.1: a partial triage is never quiet — the tick is partial (Your call: test("an escalating tick: the flagged ids swept as r6-watch-<date>; the tiers on the triage page (each flag and dismissal with its reason) and on the run page", async ({ page }) => { test.setTimeout(90_000); await page.goto(urls.seriesHref("r6-watch")); - await page.getByRole("button", { name: "Tick now" }).click(); + await clickAnswered(page, page.getByRole("button", { name: "Tick now" })); await expect(page.locator("[data-found]")).toHaveCount(1, { timeout: 30_000 }); const t = series("r6-watch").ticks.at(-1); expect(t).toMatchObject({ status: "done", iteration: 1, usd: 0.37, triage: { k: 1, flagged: 2, escalated: true, ids: ["sv1", "sv2"], usd: { tier1: 0, tier2: 0.37 } } });