test: a server start waits on a deadline, not a try count, in 13 suites (#1714) #1715

Merged
jaylouisw merged 1 commit from fix/1116-1905 into main 2026-11-16 19:39:24 +00:00
Owner

Fixes #1714.

server/index.js needs 2757-3084 ms to answer /api/version on an idle host, and 6976-7410 ms when ten start at once - which is exactly what PF_TEST_CONCURRENCY=10 (f6fd08ba, today) asks of the suite. Thirteen suites decided the server was broken by counting attempts:

pattern cap suites
for (i < 60) { try ... break } catch { sleep 100 } 6 s, then falls through silently link-instant, ping-count, ping-instant, ping-surface
waitReady: if (--left <= 0) reject(...) 6 s server-compression, server-static-cache
inline if (i > 150) throw new Error("server did not start") 15 s clock, api-change-clock, console-over-http, counter-payload, layout-roundtrip, link-roundtrip, runtime-agreement

All thirteen pass serially; the four silent ones failed as ECONNREFUSED 127.0.0.1:6904 on the next request, which reads like a missing endpoint rather than a server that was not up yet.

Reproduced before, green after

PF_TEST_CONCURRENCY=10 node scripts/run-tests.js:

  • before, 53daa3a4: 285 suite(s) in 202.7 s - 10155 assertions passed, 3 failed (board-id-is-a-name, server-compression, server-static-cache), then a second run with 6 failed (the four silent ones plus the two waitReady ones)
  • after: 285 suite(s) - 10262 assertions passed, 0 failed - twice, consecutively (209.2 s, 202.2 s)

The same defect is what made today's legs red on main: Test (Node 20) at 18:54 on 53daa3a4, a docs-only diff, with Node 18 and 22 green on the same sha; all three legs at 11:23 on d8164131; Test (Node 18) at 16:11 on 394e1389.

What changed

The pattern #1242 established in test/server-immutable-json.test.js: a wall-clock deadline (60 s) instead of an attempt count, failing with server did not start within 60000 ms (last error: ECONNREFUSED). Same pass condition, same coverage - a slow start passes, a server that never comes up still fails, and the message says what the last attempt saw.

The two waitReady files take an optional deadlineMs and gain one assertion each: a closed port must fail at a 400 ms deadline it is given, so the counting behaviour cannot come back unnoticed (compression 19 -> 20 assertions, static-cache 21 -> 22).

Gates

  • node scripts/syntax-check.js -> Syntax-checked 356 files: all OK
  • node scripts/audit-port-types.js -> No port contradicts its declared type
  • node scripts/check-control-bytes.js -> No control bytes in source
  • full suite at PF_TEST_CONCURRENCY=10, twice -> 285 suites / 10262 assertions / 0 failed
Fixes #1714. `server/index.js` needs 2757-3084 ms to answer `/api/version` on an idle host, and 6976-7410 ms when ten start at once - which is exactly what `PF_TEST_CONCURRENCY=10` (f6fd08ba, today) asks of the suite. Thirteen suites decided the server was broken by counting attempts: | pattern | cap | suites | |---|---|---| | `for (i < 60) { try ... break } catch { sleep 100 }` | 6 s, **then falls through silently** | link-instant, ping-count, ping-instant, ping-surface | | `waitReady`: `if (--left <= 0) reject(...)` | 6 s | server-compression, server-static-cache | | inline `if (i > 150) throw new Error("server did not start")` | 15 s | clock, api-change-clock, console-over-http, counter-payload, layout-roundtrip, link-roundtrip, runtime-agreement | All thirteen pass serially; the four silent ones failed as `ECONNREFUSED 127.0.0.1:6904` on the *next* request, which reads like a missing endpoint rather than a server that was not up yet. ## Reproduced before, green after `PF_TEST_CONCURRENCY=10 node scripts/run-tests.js`: - **before**, `53daa3a4`: `285 suite(s) in 202.7 s - 10155 assertions passed, 3 failed` (board-id-is-a-name, server-compression, server-static-cache), then a second run with **6** failed (the four silent ones plus the two `waitReady` ones) - **after**: `285 suite(s) - 10262 assertions passed, 0 failed` - twice, consecutively (209.2 s, 202.2 s) The same defect is what made today's legs red on `main`: `Test (Node 20)` at 18:54 on `53daa3a4`, a docs-only diff, with Node 18 and 22 green on the same sha; all three legs at 11:23 on `d8164131`; `Test (Node 18)` at 16:11 on `394e1389`. ## What changed The pattern #1242 established in `test/server-immutable-json.test.js`: a wall-clock **deadline** (60 s) instead of an attempt count, failing with `server did not start within 60000 ms (last error: ECONNREFUSED)`. Same pass condition, same coverage - a slow start passes, a server that never comes up still fails, and the message says what the last attempt saw. The two `waitReady` files take an optional `deadlineMs` and gain one assertion each: a closed port must fail at a 400 ms deadline it is given, so the counting behaviour cannot come back unnoticed (compression 19 -> 20 assertions, static-cache 21 -> 22). ## Gates - `node scripts/syntax-check.js` -> Syntax-checked 356 files: all OK - `node scripts/audit-port-types.js` -> No port contradicts its declared type - `node scripts/check-control-bytes.js` -> No control bytes in source - full suite at `PF_TEST_CONCURRENCY=10`, twice -> 285 suites / 10262 assertions / 0 failed
test: a server start waits on a deadline, not a try count (#1714)
All checks were successful
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 21s
CI / Server smoke test (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 50s
CI / Test (Node 18) (pull_request) Successful in 55s
CI / Test (Node 22) (pull_request) Successful in 55s
CI / Docker build (pull_request) Successful in 31s
41c332df4c
`server/index.js` answers `/api/version` in 2757-3084 ms on an idle host and in
6976-7410 ms when ten start at once, which is what `PF_TEST_CONCURRENCY=10` does
since f6fd08ba. Thirteen suites decided the server was broken by counting
attempts instead: four gave up after 6 s *and fell through*, so the failure
surfaced as `ECONNREFUSED` on the next request; two rejected at 6 s; seven threw
`server did not start` at 15 s. All of them pass serially and go red under load,
which is the shape of every red leg on main today.

Each now uses the wall-clock deadline #1242 established in
server-immutable-json.test.js - 60 s, failing with `server did not start within
60000 ms (last error: <code>)` - so a slow start passes, a server that never
comes up still fails, and it says what the last attempt saw. Same pass
condition, same coverage. The two `waitReady` files also assert that a closed
port fails at a 400 ms deadline it is given, so the counting behaviour cannot
come back unnoticed.

PF_TEST_CONCURRENCY=10 node scripts/run-tests.js
  before: 285 suites, 10155 assertions, 3 failed (then 6 failed on the next run)
  after:  285 suites, 10262 assertions, 0 failed - twice, consecutively

node scripts/syntax-check.js -> 356 files, all OK
node scripts/audit-port-types.js -> no port contradicts its declared type
node scripts/check-control-bytes.js -> no control bytes
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 19:39:06 +00:00
jaylouisw force-pushed fix/1116-1905 from 41c332df4c
All checks were successful
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 21s
CI / Server smoke test (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 50s
CI / Test (Node 18) (pull_request) Successful in 55s
CI / Test (Node 22) (pull_request) Successful in 55s
CI / Docker build (pull_request) Successful in 31s
to 0199c730f7
All checks were successful
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 15s
CI / Test (Node 18) (pull_request) Has been skipped
CI / Test (Node 20) (pull_request) Has been skipped
CI / Test (Node 22) (pull_request) Has been skipped
CI / Server smoke test (pull_request) Has been skipped
CI / Docker build (pull_request) Has been skipped
2026-11-16 19:39:09 +00:00
Compare
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!1715
No description provided.