martha#263: the test waits for the stand-in's own command line before it asserts #285

Manually merged
terra merged 1 commit from ceres/263-exec-race into main 2026-11-27 02:32:25 +00:00
Member

What it does

a_launcher_ends_with_its_run.node-test.ts now waits, bounded, for the stand-in's own command line before it asserts.

spawn() returns before the child's execve, and until that execve /proc/<pid>/cmdline still holds the command line the child inherited — the test runner's own, which names no such home. theShellThatWaitsOnUs read once in that window and rightly answered undefined: a pid whose line does not name the home is not the shell that waits on the launcher, and ending it is the harm #205 exists for. On a quiet box the window is a millisecond; under the suite's own load it was the 190 ms between a 7 ms and a 198 ms run.

The wait asks the kernel every 10 ms, gives the child 5 s to become the process it was spawned as, and fails by name — the pid and what the kernel read — when it never does, so the case cannot pass by timing out silently.

The reader is unchanged: theShellThatWaitsOnUs still reads once, and #205's mutant still reds this case.

Evidence

  • Red first, deterministically: the real case with its one wait removed, over a stand-in whose exec is delayed 300 ms in a shell, reds undefined !== <pid>; with the wait, the same stand-in greens in 314 ms. Both were scratch copies of this file, not committed.
  • The fixed file through run_the_tests_in_a_namespace_of_their_own.sh: green, 6.5 ms; with removals_without_a_retry.node-test.ts, 13/13.
  • #205's mutant (the absolute-home guard dropped): reds by name, on "".
  • npm run verify green end to end; .github/workflows diff vs 61ec8da0: 0 bytes.
  • No runs on the pushed tip (head_sha=16f40503 → total_count 0), as #258 intends.

Refs #263, #205

## What it does `a_launcher_ends_with_its_run.node-test.ts` now waits, bounded, for the stand-in's own command line before it asserts. `spawn()` returns before the child's `execve`, and until that execve `/proc/<pid>/cmdline` still holds the command line the child inherited — the test runner's own, which names no such home. `theShellThatWaitsOnUs` read once in that window and rightly answered `undefined`: a pid whose line does not name the home is not the shell that waits on the launcher, and ending it is the harm #205 exists for. On a quiet box the window is a millisecond; under the suite's own load it was the 190 ms between a 7 ms and a 198 ms run. The wait asks the kernel every 10 ms, gives the child 5 s to become the process it was spawned as, and fails by name — the pid and what the kernel read — when it never does, so the case cannot pass by timing out silently. The reader is unchanged: `theShellThatWaitsOnUs` still reads once, and #205's mutant still reds this case. ## Evidence - Red first, deterministically: the real case with its one wait removed, over a stand-in whose exec is delayed 300 ms in a shell, reds `undefined !== <pid>`; with the wait, the same stand-in greens in 314 ms. Both were scratch copies of this file, not committed. - The fixed file through `run_the_tests_in_a_namespace_of_their_own.sh`: green, 6.5 ms; with `removals_without_a_retry.node-test.ts`, 13/13. - #205's mutant (the absolute-home guard dropped): reds by name, on `""`. - `npm run verify` green end to end; `.github/workflows` diff vs `61ec8da0`: 0 bytes. - No runs on the pushed tip (`head_sha=16f40503` → `total_count 0`), as #258 intends. Refs #263, #205
A spawned child shows its parent's command line until its execve, so the
immediate assert was a race the test itself had: 190 ms under a loaded
suite, and the reader rightly answered undefined. The wait is bounded and
fails by name when the child never becomes that process.
terra manually merged commit 530950313a into main 2026-11-27 02:32:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
martha-ai/martha!285
No description provided.