Archilyzer · Source

archilyzer

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

commit 01706cdb62466ee0c09c73c51b66e15f3e609b28
parent 65ce25705b2b22b735f51c735cebd530e409514c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 15 Oct 2026 19:10:35 -0400

common: ttsServer's timed-out/cancelled start test waits on the stop, not on a log line a still-booting fake never writes — a 1.5 s start window and cancel, and "stopped" = the SIGTERM logged or the started pid gone (it failed 2 of 3 under load)

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

Diffstat:
Mcommon/controller/ttsServer.test.ts | 27++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/common/controller/ttsServer.test.ts b/common/controller/ttsServer.test.ts @@ -147,16 +147,33 @@ test("a server that dies before it answers fails with its last words", async () assert.equal(holder.running("orpheus"), false); }); +// Stopped: the fake logged its SIGTERM, or the process it logged as started is +// gone. (A fake still booting node when the SIGTERM lands dies before its handler +// exists and logs nothing — on a loaded machine the stop is real, the line is not.) +async function stopped(file: string): Promise<boolean> { + const lines = await events(file); + if (lines.some((l) => l.startsWith("term"))) return true; + const pid = Number(lines.find((l) => l.startsWith("started"))?.split(" ")[1]); + if (!pid) return false; + try { + process.kill(pid, 0); + return false; + } catch { + return true; + } +} + test("a start that times out, or is cancelled, stops the server", async () => { const holder = new TtsServerHolder({ gate: null, pollMs: 25 }); - const slow = await cmd({ DELAY_MS: "60000" }, { startTimeoutMs: 300 }); - await assert.rejects(holder.acquire("orpheus", slow.c, { onLog: () => {} }), /did not answer .*\/health within 0s/); - await until(async () => (await events(slow.events)).some((l) => l.startsWith("term"))); + // 1.5 s: room for the fake's node to boot and listen first, even under load. + const slow = await cmd({ DELAY_MS: "60000" }, { startTimeoutMs: 1500 }); + await assert.rejects(holder.acquire("orpheus", slow.c, { onLog: () => {} }), /did not answer .*\/health within \d+s/); + await until(() => stopped(slow.events)); const ac = new AbortController(); const late = await cmd({ DELAY_MS: "60000" }); - setTimeout(() => ac.abort(), 200); + setTimeout(() => ac.abort(), 1500); await assert.rejects(holder.acquire("orpheus", late.c, { onLog: () => {}, signal: ac.signal }), /start was cancelled/); - await until(async () => (await events(late.events)).some((l) => l.startsWith("term"))); + await until(() => stopped(late.events)); assert.equal(holder.running("orpheus"), false); });