Skip to content

test: start-wiring's real-child poll is a 2 s budget, and flakes under full-suite load #369

Description

@edgehero

Found by the gate on #368 (issues #348/#352), out of scope for that PR and filed rather than fixed there.

worker/test/start-wiring.test.mjs:1923, "a real err.reason token rides the hook's argv end to end, through a REAL
script (review finding)", polls for a genuinely spawned sh child to append a file:

for (let i = 0; i < 100 && !existsSync(out); i++) await new Promise((r) => setTimeout(r, 20));
assert.ok(existsSync(out), "the hook really spawned");

That is a 2 s budget. Under the full parallel suite it can be missed: an executing reviewer saw it fail once in two
full CI-posture runs on an otherwise clean tree, and pass 3/3 in isolation (91/91 for the file). The assertion that
fails is the hook really spawned, which reads like a real defect in the failure hook and is not one.

This matters more than an ordinary flake because the suite runs in a REQUIRED check (contract-tests runs it three
times per job: plain, under test-count-check.mjs, and on a clock shifted 399 days). A one-in-N failure there is a
red build on a tree nobody touched, which is the shape issue #284 already cost this project a day of merges to.

Suggested fix, and it costs nothing on the happy path because the loop exits on first existence: raise the bound
(for example i < 500, a 10 s ceiling). Worth checking whether any sibling in the file polls a real child on the
same 2 s budget and raising those together rather than one at a time.

Not a product defect: nothing about the hook, its argv or its env threading is in question, and the test proves
what it says it proves when it is given time to.

Activity

  1. edgehero commented on Sep 21, 2026

    @edgehero
    OwnerAuthor

    A second instance of the same class, seen while gating #371 (which touches no receiver file).

    receiver/test/start.test.mjs:433, "the triggers watch ARMS under test, and a shut-down watch writes NOTHING
    (issue #301)", failed once in two consecutive full CI-posture runs and passed 3/3 in isolation (20/20 for the
    file). The assertion is line 473:

    a live watch reloads, or this test is asserting silence from a watch that never worked

    Worth noting because this one is already the mitigated version: it POLLS on a 5 s deadline rather than
    sleeping, and its own comment says why ("a fixed wait is a fuse on a loaded runner"). It still missed. So the
    variable is fs.watch delivery latency plus the 150 ms debounce under a fully loaded runner, and 5 s is not
    always enough on a machine running the whole suite in parallel.

    Same shape as the start-wiring.test.mjs poll above, same consequence: a red build on a tree nobody touched,
    inside a required check. Filed here rather than as its own issue because the fix is one decision, not two:
    what deadline do real-time polls in this suite get when the whole suite is running?

    Both instances pass in isolation, so neither is evidence of a product defect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions