A test or mutation run can wedge past --test-timeout when a loop awaits a spawnSync #57

Open
opened 2026-11-22 21:33:28 +00:00 by vesta · 0 comments
Member

Purpose (method): a test or mutation run that loops over an adapter call can hang for hours while --test-timeout and --test-force-exit both promise it cannot.

Refs macula-io/martha#48 (found while running its mutants), and prove_the_core/a_test_run_ends, which already fails a test file that leaves something running.

What happened

A mutant made the alias resolver's bounded loop unbounded. The loop awaits a promise whose body is a synchronous spawnSync (the host's process runner), so every iteration yields only a microtask: the event loop's timers never run, --test-timeout=60000 never fires, and the run sat for 2h19m until it was killed by hand. --test-force-exit did not help either, because the runner never reached its end.

Why it matters

Both nets the repository trusts are timers: the node test runner's --test-timeout and the job's timeout-minutes. A wedged test on a forge runner therefore burns the whole job limit and reports a red that names no case — and a local mutation run keeps a mutated file on disk until someone looks, which is exactly the state the mutation rules forbid.

What a fix can look like

  • The mutation runners report a per-case wall-clock kill: a case that produced no output for N minutes is killed, not counted as a kill, and the file is restored from HEAD (the ad hoc runner for #48 now does this).
  • A mechanical guard in the test harness: prove_the_core/a_test_run_ends already inspects a test file that leaves something running; the same place could bound a run's wall clock and fail by name when it is exceeded, so the next wedge is a named failure rather than a hung job.

Neither is a new check on production behaviour; the owner's yes is only needed for the second (DECIDED 2026-11-19 "No new checks without your yes").

Purpose (method): a test or mutation run that loops over an adapter call can hang for hours while `--test-timeout` and `--test-force-exit` both promise it cannot. Refs macula-io/martha#48 (found while running its mutants), and prove_the_core/a_test_run_ends, which already fails a test file that leaves something running. ## What happened A mutant made the alias resolver's bounded loop unbounded. The loop awaits a promise whose body is a synchronous `spawnSync` (the host's process runner), so every iteration yields only a microtask: the event loop's timers never run, `--test-timeout=60000` never fires, and the run sat for 2h19m until it was killed by hand. `--test-force-exit` did not help either, because the runner never reached its end. ## Why it matters Both nets the repository trusts are timers: the node test runner's `--test-timeout` and the job's `timeout-minutes`. A wedged test on a forge runner therefore burns the whole job limit and reports a red that names no case — and a local mutation run keeps a mutated file on disk until someone looks, which is exactly the state the mutation rules forbid. ## What a fix can look like - The mutation runners report a per-case wall-clock kill: a case that produced no output for N minutes is killed, not counted as a kill, and the file is restored from HEAD (the ad hoc runner for #48 now does this). - A mechanical guard in the test harness: prove_the_core/a_test_run_ends already inspects a test file that leaves something running; the same place could bound a run's wall clock and fail by name when it is exceeded, so the next wedge is a named failure rather than a hung job. Neither is a new check on production behaviour; the owner's yes is only needed for the second (DECIDED 2026-11-19 "No new checks without your yes").
Sign in to join this conversation.
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#57
No description provided.