A readiness wait is a deadline, not an attempt count (#1242) #1243

Merged
jaylouisw merged 1 commit from fix/readiness-deadline into main 2026-11-09 17:52:31 +00:00
Owner

A readiness wait is a deadline, not an attempt count

Fixes #1242.

test/server-immutable-json.test.js went red in a full run with server did not start, and passed on its
own. The cause was the wait, not the suite:

let left = 60;   // 60 x 100 ms = six seconds

Six seconds is enough for server/index.js to load and serialise a 4.4 MB catalogue on an idle machine and
not enough when the runner is executing other suites. Worse, the failure said nothing: the child's output
was piped and discarded, so "the server crashed" and "the server is slow" produced the same one-line error.

Now

  • a wall-clock deadline — 60 s in the suite, overridable per call;
  • on failure the message names the deadline and the underlying error code, and carries the child's last
    twelve lines of output.

Evidence

Three checks added to the same file (21 → 25):

  • a server that takes three seconds to bind is still awaited — the old attempt count would have been
    fine here, so this is the margin check;
  • a port that never opens fails with the deadline in the message, rather than hanging;
  • and that message carries the diagnosis (child said: boom).

Both are real children on real ports, not mocks: the slow one is a node -e that binds after a timeout.

Suite: 135 suites, 5,870 assertions, 0 failed.

A readiness wait is a deadline, not an attempt count Fixes #1242. `test/server-immutable-json.test.js` went red in a full run with `server did not start`, and passed on its own. The cause was the wait, not the suite: ```js let left = 60; // 60 x 100 ms = six seconds ``` Six seconds is enough for `server/index.js` to load and serialise a 4.4 MB catalogue on an idle machine and not enough when the runner is executing other suites. Worse, the failure said nothing: the child's output was piped and discarded, so "the server crashed" and "the server is slow" produced the same one-line error. ## Now * **a wall-clock deadline** — 60 s in the suite, overridable per call; * on failure the message names the deadline and the underlying error code, and carries the child's last twelve lines of output. ## Evidence Three checks added to the same file (21 → 25): * a server that takes **three seconds** to bind is still awaited — the old attempt count would have been fine here, so this is the margin check; * a port that never opens **fails with the deadline in the message**, rather than hanging; * and that message **carries the diagnosis** (`child said: boom`). Both are real children on real ports, not mocks: the slow one is a `node -e` that binds after a timeout. Suite: 135 suites, 5,870 assertions, 0 failed.
A readiness wait is a deadline, not an attempt count (#1242)
All checks were successful
CI / Classify the change (pull_request) Successful in 10s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Test (Node 20) (pull_request) Successful in 1m44s
CI / Test (Node 18) (pull_request) Successful in 1m48s
CI / Server smoke test (pull_request) Successful in 33s
CI / Docker build (pull_request) Successful in 40s
CI / Test (Node 22) (pull_request) Successful in 1m39s
18bb3eb0fc
The immutable-JSON suite went red under load with 'server did not start', which was
sixty attempts a hundred milliseconds apart: six seconds, on a machine already running
other suites, for a child that loads and serialises a 4.4 MB catalogue before it listens.
It passed on its own and failed in the full run, and it said nothing either way - the
child's output went to a discarded stream, so a crash and a slow start looked identical.

Now: a wall-clock deadline (a minute in the suite), and on failure the message names the
deadline and carries the child's last lines. Three checks added, including a server that
takes three seconds to bind (still awaited) and a port that never opens (fails with the
deadline and the diagnosis).
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-09 17:52:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1243
No description provided.