Archilyzer · Source

archilyzer

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

commit d4c646a573024e1a06ef3d5caba774d4c91f16f3
parent d612a6752e4ccf3963c970e675d955a875d40638
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 14:39:54 -0400

umtool e2e: the editor stub writes its request log atomically and survives a late timer

A spec read the log half-written (a JSON parse error), its article was removed, and a stub job's
timer then wrote into the missing directory: the uncaught error killed the stub and failed every
later spec that asked it anything.

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

Diffstat:
Mumtool/e2e/fixtures/editor-stub.mjs | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs @@ -17,7 +17,7 @@ import http from "node:http"; import { spawnSync } from "node:child_process"; -import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, statSync } from "node:fs"; +import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync, statSync } from "node:fs"; import path from "node:path"; import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; @@ -36,10 +36,19 @@ let nextJob = 1; // by playwright in parallel, and make-fixture rm -rf's the fixture root — so on // a fresh checkout the directory this writes into may not exist yet, and a // throw here would kill the stub before a single spec ran. +// A stub job's timers outlive the spec that started it: a spec that ends (or +// fails) removes its article, and a later timer then writes into a missing +// directory. That must not kill the stub, or every later spec that asks it +// anything fails too. +process.on("uncaughtException", (e) => console.error("editor stub: ignored a late error:", e?.message ?? e)); + function record() { try { mkdirSync(path.dirname(LOG), { recursive: true }); - writeFileSync(LOG, JSON.stringify(requests, null, 2) + "\n"); + // Atomically: a spec reads this file while the stub writes it, and a + // half-written file is a JSON parse error in the spec. + writeFileSync(`${LOG}.tmp`, JSON.stringify(requests, null, 2) + "\n"); + renameSync(`${LOG}.tmp`, LOG); } catch { /* the fixture root is mid-rebuild; the next request rewrites it */ }