Archilyzer · Source

archilyzer

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

commit 21c1d2544efefaf11bc79459971b8ad234ede1b0
parent 6854b2f64ee528bc8a43cbfcb845c093dabade93
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 05:07:41 -0400

umtool: running.spec leaves the stub's own drafts out of its job list (a slow one an earlier spec left running was counted)

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

Diffstat:
Mumtool/e2e/fixtures/editor-stub.mjs | 11+++++++----
Mumtool/e2e/running.spec.ts | 8+++++---
2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs @@ -153,8 +153,10 @@ const draftJobs = new Map(); // mode "unreachable" the socket is dropped: no answer at all // A spec's job is OpsJobView-shaped ({id, kind, status, queuedAt, startedAt, // queue, progress, detail, channelSlug}); `log` (lines) is what its -// `GET /api/ops/job/<id>?tail=N` answers. `{}` resets to "ok" with none. -const opsJobs = { mode: "ok", jobs: [] }; +// `GET /api/ops/job/<id>?tail=N` answers. `live: false` leaves the stub's own +// drafts out (a "slow" one another spec left running would be counted). `{}` +// resets to "ok", none, live. +const opsJobs = { mode: "ok", jobs: [], live: true }; const itDir = (article, n) => path.join(ARTICLES, article, "iterations", String(n)); const readIt = (article, n) => JSON.parse(readFileSync(path.join(itDir(article, n), "iteration.json"), "utf8")); @@ -747,7 +749,7 @@ function generationRoute(req, res, url, auth) { if (opsJobs.mode === "editor-token") return json(res, 503, { ok: false, error: "worker endpoint disabled (set WORKER_TOKEN to enable)" }); const active = url.searchParams.get("active") === "1"; const live = [...draftJobs.values()] - .filter((j) => j.status === "queued" || j.status === "running") + .filter((j) => opsJobs.live && (j.status === "queued" || j.status === "running")) .map((j) => ({ id: j.id, kind: j.kind ?? "report-draft", @@ -801,7 +803,8 @@ const server = http.createServer((req, res) => { if (!["ok", "editor-token", "unreachable"].includes(mode)) return json(res, 400, { error: `mode "${mode}" is not one of ok, editor-token, unreachable` }); opsJobs.mode = mode; opsJobs.jobs = Array.isArray(body?.jobs) ? body.jobs : []; - return json(res, 200, { ok: true, mode, jobs: opsJobs.jobs.length }); + opsJobs.live = body?.live !== false; + return json(res, 200, { ok: true, mode, jobs: opsJobs.jobs.length, live: opsJobs.live }); }); } diff --git a/umtool/e2e/running.spec.ts b/umtool/e2e/running.spec.ts @@ -25,8 +25,10 @@ const HERE = path.dirname(fileURLToPath(import.meta.url)); const FIXTURE = path.join(HERE, "..", ".e2e-song"); const STUB = `http://127.0.0.1:${portFor("EDITOR_STUB_PORT")}`; -async function editorJobs(request: APIRequestContext, mode: "ok" | "editor-token" | "unreachable", jobs: Record<string, unknown>[] = []) { - const r = await request.post(`${STUB}/__stub/ops-jobs`, { data: { mode, jobs } }); +// `live: false`: the stub's own drafts stay out of the list (a "slow" one an +// earlier spec left running would be counted). +async function editorJobs(request: APIRequestContext, mode: "ok" | "editor-token" | "unreachable", jobs: Record<string, unknown>[] = [], live = false) { + const r = await request.post(`${STUB}/__stub/ops-jobs`, { data: { mode, jobs, live } }); expect(r.ok(), await r.text()).toBeTruthy(); // Ask again now, so the page's first read is not the 2 s memo of the last test. const fresh = await request.get("/api/running?fresh=1"); @@ -36,7 +38,7 @@ async function editorJobs(request: APIRequestContext, mode: "ok" | "editor-token const running = (page: Page) => page.locator("[data-app-rail] [data-rail-section=running]"); test.afterEach(async ({ request }) => { - await editorJobs(request, "ok", []); + await editorJobs(request, "ok", [], true); }); const NOW = Date.now();