From 48f8fe6168f79b7126b9684b513ef3c6137fcafb Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 17 Sep 2026 22:39:48 +0200 Subject: [PATCH] The settle check records settling instead of inferring it from the clock The review found a race: a container that settled in the window's last seconds could be re-inspected past the deadline and failed as 'never stopped restarting'. A boolean now says what happened. https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx --- test/integration/assigned-two-node-db.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/assigned-two-node-db.test.ts b/test/integration/assigned-two-node-db.test.ts index e826863..b3b0ffd 100644 --- a/test/integration/assigned-two-node-db.test.ts +++ b/test/integration/assigned-two-node-db.test.ts @@ -500,14 +500,14 @@ test("consumers on a joined node get their databases from the one foundation sto const stable = expected.filter((n) => n !== "letta"); for (const name of stable) { const deadline = Date.now() + 300_000; - let prev = -1, stableSince = 0, last = "?"; + let prev = -1, stableSince = 0, last = "?", settled = false; while (Date.now() < deadline) { const [running, count] = (await must(NODE, `docker inspect -f '{{.State.Running}} {{.RestartCount}}' ${name}`)).trim().split(" "); last = `running=${running} restarts=${count}`; const n = Number(count); if (running === "true" && n === prev) { if (stableSince === 0) stableSince = Date.now(); - if (Date.now() - stableSince >= 30_000) break; // up and unchanged for 30s — settled + if (Date.now() - stableSince >= 30_000) { settled = true; break; } // up and unchanged 30s } else { prev = n; stableSince = 0; } @@ -516,7 +516,7 @@ test("consumers on a joined node get their databases from the one foundation sto const [running, count] = (await must(NODE, `docker inspect -f '{{.State.Running}} {{.RestartCount}}' ${name}`)).trim().split(" "); assert.equal(running, "true", `${name} is not running after the push (${last}):\n${(await on(NODE, `docker logs ${name} 2>&1 | tail -40`)).out}`); - if (Date.now() >= deadline) + if (!settled) assert.fail(`${name} never stopped restarting within 300s (last ${last}) — a crash-loop, not startup churn:\n${(await on(NODE, `docker logs ${name} 2>&1 | tail -40`)).out}`); void count; } -- 2.54.0