commit db37837b04ce66384f3d55b3ffdd47cbc2384b53
parent e6d2da4cd7b8aea1ab6df372c248f6b33bf2cebd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 9 Oct 2026 13:30:37 -0400
common: stageRun test cancels once the lock wait is announced, not after a fixed 50 ms (raced the announcement under load)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/common/publish/stageRun.test.ts b/common/publish/stageRun.test.ts
@@ -223,9 +223,17 @@ test("a live holder of the publish lock is waited for; a cancel during the wait
const logs: string[] = [];
const running = runStage(
{ kind: "build-site", target: "jer", runId: "t" },
- { paths, signal: ac.signal, onLog: (l) => logs.push(l), lockEnv: { pollMs: 5 } },
+ {
+ paths,
+ signal: ac.signal,
+ // Cancel once the wait is announced — a fixed delay raced the announcement under load.
+ onLog: (l) => {
+ logs.push(l);
+ if (/waiting for the publish lock/.test(l)) ac.abort();
+ },
+ lockEnv: { pollMs: 5 },
+ },
);
- setTimeout(() => ac.abort(), 50);
const r = await running;
assert.equal(r.code, 130);
assert.match(logs.join(""), /waiting for the publish lock — held by build-site x/);