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
This commit is contained in:
2026-09-17 22:39:48 +02:00
parent d3a6dc9784
commit 428f13bfae
@@ -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;
}