Repository navigation
Commit 03c6109
Recycle workers, kill hung files, tell OOMs apart, and add --bail, signals, --forceExit and --detectOpenHandles (B21a) (#31)
* fix(deps): hold Jest 30.5 and Vitest 5.0, and give oxc-walker the parser's AST types
The dependency update moved vitest and @vitest/{expect,mocker,spy} to 5.1.0. Every Vitest golden
records runnerVersion 5.0.5 and the dialect values claim Vitest 5.0 (NN2, S3), so
`record --check`, `self-test --candidate provino` and `record:mocking --check` failed. The
catalog holds 5.0.5 again, and `.always-up-to-date.json` holds both runner families (and the
packages pinned to what Jest 30.5 installs) so an update can't move the ground truth: moving it is
a re-record, planned for after 1.0.
oxc-parser moved to 0.157.0, but oxc-walker's optional peer `@oxc-project/types` resolved to
rolldown's 0.156.0, so `scope.ts` compared two near-identical AST unions and tsc stopped with
TS2321 (excessive stack depth). `@oxc-project/types` is now in the catalog beside oxc-parser and a
dev dependency of transform, so the walker and the parser share one copy.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(lint): title the logo SVGs, and mark the corpus's template-literal cases
Biome 2.6.5 fails an SVG without a <title> (lint/a11y/noSvgWithoutTitle), which the new logo and
mark had. The scoping corpus's two `${a}` cases are source text on purpose.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* docs: the runner diff's planted cases and oracle B count, and why Vitest is slow on the suites
The Commands row said `--plant scope|order` and 2,000 oracle-B files; it is
`scope|order|member` and every runnable fuzz file (8,130). The bench notes now say Vitest's time on
the synthetic suites is Node's per-file `exports` re-parse (nodejs/node#66485).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(harness): give the SIGTERM-ignoring child time to run its handler
"a child that ignores SIGTERM is killed after the grace period" sent SIGKILL 20 ms after SIGTERM.
Under load the child hadn't reached its next event-loop turn by then, so the handler never printed
`IGNORED` and the test failed with only `READY` in the output (seen once in a full `pnpm test`
while two other agents were running). The grace is now 1 s, which the child's handler beats by a
wide margin; the test still proves SIGKILL follows an ignored SIGTERM.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(harness): record --bail, --detectOpenHandles and --forceExit from Jest 30.5.2 (B21a)
Four black-box `run` fixtures recorded from the real runner, the ground truth T9.10 builds
against:
- cli/bail-one: `--bail` ends the run after the first file's failing test. Jest reports that
file, counts "1 of 3 total" suites, starts no other file and exits 1. In Jest 30.5.2 `--bail` is
a boolean flag: `--bail=1` parses as false and bails on nothing, so a count comes only from the
config.
- cli/bail-two: the config's `bail: 2` counts failed tests across files: two files fail, the third
never starts, exit 1.
- cli/detect-open-handles: a leaked setInterval is reported with its kind and the line of the test
file that created it (the fixture adds --forceExit, since Jest otherwise waits on the interval).
- cli/force-exit: Jest says it is force exiting, and names --detectOpenHandles, and exits with the
run's code.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* feat(types): the lifecycle's types: file deadline, terminated runs, open handles, bail (B21a)
Additive types for T9.5's rest and T9.10:
- PoolOptions.fileTimeoutMs and WorkerExit's timeout phase `file`: a worker killed for running
one file too long.
- RunEndReason gains `terminated` (SIGTERM, exit code 143), beside `interrupted` (SIGINT, 130).
- OpenHandle and RunSummary.openHandles: what `detectOpenHandles` found after the last file.
- RunRequest.bail ({ count }), forceExit and detectOpenHandles.
- The doc comments say what RecyclePolicy's memory limit measures (0 is every file), and that a run
that bails reports its killed files no further, the one exception to a `file:start` having a
`file:end`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* feat(dialect-jest): carry --bail, --forceExit and --detectOpenHandles in the run request (B21a)
The three flags stop being refused by name (T9.10 builds their backend): they become `request`
options, read into RunRequest.bail, .forceExit and .detectOpenHandles. `--bail` is a boolean flag
in Jest 30.5.2 (`--bail=2` parses as false, as `--no-bail`), so the request's count is 1 for
`--bail`/`-b` and absent otherwise; a larger count comes from the config's `bail`, which `provino
jest` reads from the merged global config. The refused flags go from 24 to 21.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* feat(orchestrator): recycle workers, kill hung files, tell an OOM from V8's last words; bail, signal reasons and open handles (B21a)
T9.5's rest:
- The pool replaces a worker after `maxFilesPerWorker` files, and after a file whose
`fileDone.memoryBytes` is over `memoryLimitBytes` (0 is every file, Infinity is off). The run's
default is max(512 MiB, 25% of the container's, or the machine's, memory / maxWorkers).
- `fileTimeoutMs` (off by default, a key of ours: Jest has none) kills the worker of a file that
runs past it and fails the file with `{ type: 'timeout', phase: 'file' }`.
- A forked worker that V8 aborted over its heap is `{ type: 'oom', limitMb }`: the transport keeps
the tail of the child's stderr and reads V8's fatal-error line once the stdio has closed. A
SIGABRT without that line stays a signal, likely OOM. `heapLimitMb` sets `--max-old-space-size`
for forks and `resourceLimits` for threads, which makes an OOM deterministic.
T9.10:
- `bail: { count }` ends the run once that many tests have failed. Checked after each file (Jest,
the policy's `bail.checkAfter`), by `FileRequest.onDone`, before the worker takes another file:
no other file starts, files still running are killed and, as Jest's, not reported. Checked after
each test (Vitest): no file starts, running files go on to their end (a running file cannot be
cancelled before T5.12). The run ends `failed`.
- An abort with the reason 'SIGTERM' ends the run `terminated` (exit 143), any other `interrupted`
(130). `forceSignal` kills every worker at once, even one stopping slowly (the second Ctrl+C).
- `detectOpenHandles` runs the files in band and reports, after the last worker has stopped, the
async resources still open and the stack that made them: Jest's `collectHandles` rebuilt on
`async_hooks`, with Jest's code frame.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(orchestrator): the 200-file pool chaos run, bail, signals, force and open handles (B21a)
- pool-chaos.test.ts (T9.5's check): 200 generated files over a real pool, 3 that crash the
worker, 1 that runs out of memory, 1 that hangs. Exactly those 5 fail, each with its cause (a
SIGSEGV, an `oom` with its limit, a file timeout), the other 195 pass, and nothing is left. The
coordinator runs in a child process of its own, in a process group of its own, and the sweep
afterwards is `ps -axo pid=,pgid=` where ps can run (this sandbox forbids it, CI does not: the
test refuses to skip it when CI is set) and a `kill(-pgid, 0)` probe that needs no ps. Under
threads a native fault ends the whole process (isolation.test.ts), so the three crashing files
leave by process.exit(3), the nearest crash a thread survives.
- sweep.ts and its tests: the sweep, with its parsing of both ps paddings checked.
- lifecycle.test.ts: bail by file and by test (what starts, what is killed, what is reported),
SIGINT 130, SIGTERM 143, a force signal against workers whose graceful stop never ends
(stuck-stop-worker.ts), and the open-handle report.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* feat(reporters): Jest's summary after a bail, and the open-handle report (B21a)
The default reporter's summary reads like Jest's `getSummary`: a count of zero is left out (`Test
Suites: 1 failed, 1 total`, not `1 failed, 0 passed`), and when fewer files ended than `run:start`
announced the suites' total is `1 of 3 total`, which a run that bailed shows. After the summary it
prints `RunSummary.openHandles` in Jest's form: the count, then each handle's kind, a code frame
around the line that made it, and the creating stack. The wording is Jest's for every dialect for
now; T9.7 decides what to match.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* feat(provino): SIGINT and SIGTERM in the bin, --bail, --forceExit, --detectOpenHandles and the recycling flags (B21a)
The bin handles the signals (library code never calls process.exit, nor installs a handler):
- The first SIGINT aborts the run (130), the first SIGTERM aborts it with the reason 'SIGTERM'
(143). A second signal of either kind kills every worker at once (the run's forceSignal), and
ends the process within 750 ms with the first signal's code, whatever is still pending.
- `--forceExit` ends the process once the run is over and what it printed is flushed: through an
onForceExit callback the bin answers, so nothing below it exits. `provino jest` prints Jest's
force-exit warning (recorded from Jest 30.5.2) unless --detectOpenHandles is on.
`provino run` takes --bail[=n] (a bare --bail is 1, --bail 2 is 2, 0 is off), --forceExit,
--detectOpenHandles, --workerMemoryLimit <bytes, with Jest's units>, --maxFilesPerWorker and
--fileTimeout. `provino jest` reads the merged global config: `bail` (a count comes from the
config: `--bail=2` is false in Jest 30.5.2), `detectOpenHandles` (in band), `forceExit`, and
`workerIdleMemoryLimit`, mapped the way jest-worker reads it (0 is every file, a number up to 1 is
a share of the memory, else bytes).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(provino): the lifecycle through the bin: exit codes, a second Ctrl+C, --bail, --detectOpenHandles, --forceExit (B21a)
lifecycle.test.ts runs the bin as a child process in a process group of its own, with a deadline,
and sweeps the group afterwards (`ps` where it can run, a `kill(-pgid, 0)` probe that needs no ps):
- exit codes 0, 1, 2 (a usage error under `provino run`; `provino jest` gives Jest's 1, D76), 130
(SIGINT while a file runs) and 143 (SIGTERM); `provino jest`'s seven Jest codes stay in
jest-exit-codes.test.ts.
- a second Ctrl+C with two workers in a synchronous busy loop: the bin is gone within 1 s.
- --bail and the config's bail: 2 against the cli/bail-* goldens from Jest 30.5.2: the exit code,
the files reported and no other, and the summary lines ("1 of 3 total") one for one. `--bail=2`
is false in Jest 30.5.2, and the same live Jest and Provino summary here.
- --detectOpenHandles against cli/detect-open-handles, and, on a `.js` project with two leaks,
against a live Jest 30.5.2 run: the whole block, the code frame and the column included. A
TypeScript file's column is the transformed code's until a stack is mapped through the
transform's source map (the line is Jest's).
- --forceExit against cli/force-exit, and a leaked interval in band that holds the process up
unless --forceExit ends it.
worker-recycle.test.ts holds `workerIdleMemoryLimit`'s mapping to a real jest-worker 30.5.1: it
restarts its child exactly where the pool would replace a worker.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(harness): the corpus no longer lists --forceExit and --detectOpenHandles as refused by provino jest (B21a)
T9.10 builds both flags, so `provino jest` stops refusing them, and the manifest's `provinoRefuses`
(which must name exactly what the parser refuses on a subject's argv, checked at parse time)
dropped 19 entries: styled-components-native's --forceExit and the nx subjects' --detectOpenHandles
and --forceExit. The manifest tests, and the provino and dialect-jest ones that used --bail, -b or
--forceExit as a refused flag, use flags that are still refused (--watch, -o, --shard). Whether
styled-components-native joins R6 is B19's and B22's (D41); `r6` stays false here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a chaos run that holds up on a busy machine; the bin ends with the signal's code (B21a)
The OOM file filled a 192 MB heap with many small objects, which took longer than the 2 s file
deadline when the whole suite ran at once. It allocates large arrays now, the deadline has room
(6 s), and the hang waits it out once. The bin exits 130 or 143 when the user's signal came, even
if the run had no file left to interrupt.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* docs: the run lifecycle in the Commands table and the package docs (B21a)
CLAUDE.md's Commands table: `provino run`'s new flags, the exit codes 130 and 143, Ctrl+C and the
second signal; `provino jest`'s refused list without --bail, --forceExit and --detectOpenHandles,
and what the three do; a row for the lifecycle checks and how the process-group sweep runs where
`ps` is blocked. The orchestrator, provino, dialect-jest, reporters and harness docs say what the
lifecycle is, where it lives and what is still missing (cancelling a running file is T5.12's).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(provino): a signal after the run ends the process with its code, not by the signal (B21a)
The bin removed its handlers when the run returned, so a second Ctrl+C that landed between that
and the process's natural end killed it by SIGINT: the same end, a different status (null/SIGINT
for 130), and a flaky second-Ctrl+C check under load. A signal after the run now exits at once
with 130 or 143, which also lets Ctrl+C end a process that a test's leaked handle keeps alive.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(orchestrator): recycling over real forks, the open-handle collector and the default memory limit (B21a)
- pool-chaos.test.ts: `maxFilesPerWorker: 3` gives 10 workers for 30 files, a 1-byte
`memoryLimitBytes` a worker per file, a huge one a single worker (the control), counted by the
pids the forked workers note. With the recycle check removed from the pool these fail, along
with the fake-transport tests of the same behaviour.
- open-handles.test.ts: `codeFrame` against babel's text (first and last line, wide numbers, a tab,
CRLF) and `collectOpenHandles` on real resources made by real modules: an interval is reported
with its kind, frame and code frame; a cleared one, an unref'd one and one made by Provino's own
file are not; the same stack is one entry.
- open-handles.ts: a frame in an ES module is written as a `file:` URL, which was left whole in
the printed stack; it is the path relative to the root now (found by the new tests).
- memory-limit.test.ts: `defaultWorkerMemoryLimit` is max(512 MiB, 25% of the memory / workers).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): the open-handle test calls an export that may be missing, as the strict index access has it (B21a)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a heap OOM stays `oom` when V8's native stack pushes its line out of the stderr tail (B21a)
The fork transport kept the last 8,192 characters of a child's stderr and
looked for V8's "Reached heap limit" line in that slice once the child was
dead. V8 prints that line and then about 8 KB of native stack (measured
8,240 to 8,496 bytes in all on Node 24.22.1), so the line could sit before
the slice, and a real OOM was reported as `{ type: 'signal', likelyOom: true }`.
A `StderrWatch` now looks at each chunk, joined to the end of the one before
so a line split across two chunks still matches, and keeps the answer as a
sticky flag. The exit is classified from the flag, not from a slice.
Tests: unit tests for the watch (a fatal error followed by more than 8 KB, in
one chunk or many; a split at every offset), and a fork that writes the fatal
error and then 12 KB of stderr before it aborts, which was `signal` and is `oom`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a thread that runs out of memory is `oom` even when no memory limit was set (B21a)
The threads transport made a thread's exit `oom` only when
`ERR_WORKER_OUT_OF_MEMORY` arrived and `memoryLimitMb` was set, so an OOM
under Node's default limit read as `{ type: 'exit', code: 1 }`, an ordinary
failure with no hint of what happened.
`ERR_WORKER_OUT_OF_MEMORY` is now `oom` either way. The limit is the one the
transport set, else the old-generation limit Node reports for the running
thread (read once the thread is online, since Node empties it when the thread
stops), else V8's default for this process, as a fork has.
Test: `threadExit` as a unit (an OOM with no limit is `oom` with V8's default;
it was `exit` code 1). A real thread running to the default limit would take
about 4 GB, so the online read is not covered by a run.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): read a thread's resource limits as the optional they are (B21a)
The previous commit read `worker.resourceLimits.maxOldGenerationSizeMb` when a
thread came online. Node's typings make `resourceLimits` optional, and
`tsc -b` refuses the unguarded read. It is `?.` now, so a thread that has
nothing to report leaves the limit at the configured one, or at V8's default.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a file that finishes as its deadline fires keeps its result, and a force signal gives up on a stuck inline worker (B21a)
Deadline race. The file deadline's timer set `slot.timedOut` and killed the
worker, but left the worker usable until its exit arrived. If the file's own
`fileDone` was already on the way and landed in the same loop turn, the pool
marked the worker idle and gave it the next file; the kill then rejected that
run, and because `timedOut` was still set it was reported as "past its
deadline": the wrong file blamed. The worker is now tracked as being stopped
from the moment the deadline fires (it takes no more files, and `close` waits
for it), and it is marked as killed by the pool so its exit is no news. The
file that finished keeps its real result; only the file that was running
when the timer fired can be a timeout.
Force signal. `forceSignal` promised that `close` would not wait out the
teardown timeout, but an inline worker is this process: a kill can only close
its link, and its exit is reported when its main has settled or the teardown
timeout has passed (10 s by default). For an inline worker the pool now stops
waiting once the force signal comes: the running file's `run` is `aborted` and
`close` returns. Code looping synchronously in the process can't be
interrupted at all; the TSDoc says so. Forks and threads are still waited for,
since a kill does end them.
Tests: over the pool's fake transports, a worker whose `fileDone` arrives as
it is killed (the next file was given to the dying worker and blamed with the
deadline; it now runs on a replacement and the first file is `done`), and an
inline worker no stop or kill ends (a force signal returned only after the
test's 10 s limit; it now returns at once), with the same worker as a fork
still waited for.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a signal that lands while the run winds down still makes the run interrupted (B21a)
`runProject` set `interrupted` only when a file's outcome was `aborted`. A
signal that came after every file had ended, while the pool was closing, the
results cache was being written or the open handles were being collected,
therefore left the summary `passed` or `failed`, and a direct caller got exit
code 0 after a SIGINT.
The final summary now also treats an aborted `signal` as the run being cut
short, with the reason taken from `signal.reason` as elsewhere (`terminated`
for SIGTERM, else `interrupted`). The files keep their own results: the
interruption cost them nothing.
Test: a results cache whose `write` aborts the signal (that window), for a
plain abort and for the SIGTERM reason. The summary was `passed`; it is
`interrupted` (exit 130) and `terminated` (143).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(reporters): a skipped file is not a suite that ran, so the suites line reads `1 of 2 total` as Jest's does (B21a)
The default reporter printed `N of M total` only when fewer files ended than
were queued, so a run with a skipped file read `1 skipped, 1 passed, 2 total`.
Jest's `getSummary` takes the suites that ran as failed plus passed (a skipped
suite is neither) and prints `N of M total` whenever that differs from the
number of suites. Real Jest 30.5.2, recorded here, says:
cli/skipped-file Test Suites: 1 skipped, 1 passed, 1 of 2 total
cli/skipped-file-alone Test Suites: 1 skipped, 0 of 1 total
Jest marks a suite skipped when every test in it is pending
(`result.skipped = testCount === result.numPendingTests`, jest-runner's
runTest.ts), and prints no line at all for it.
`summaryLines` now uses Jest's formula. The existing reporter test had
hand-written `1 skipped, 1 passed, 2 total`, a guess that the recording
contradicts; it is corrected to the recorded line and two more tests are
added (a lone skipped file, and a skipped file with a bail). `provino`'s
lifecycle test runs both fixtures through the bin and holds the summary lines
to the goldens line for line; before this change both failed on the suites
line.
Not changed, and reported: Provino marks a file `skip` when none of its tests
passed or failed, so a file of only `todo` tests, or of `skip` and `todo`, is
a `SKIP` file here (`2 skipped, 0 of 2 total`) where Jest has it as a passed
suite with a `PASS` line (`2 passed, 2 total`, observed with a scratch fixture
that is not committed); and Provino prints a `SKIP <path>` line where Jest
prints none.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(provino): --bail does not count a file that fails to load, as Jest's does not; recorded as cli/bail-on-load-error (B21a)
Open question from the review: does Jest 30.5's `--bail` count a suite that
failed to run (a test file that throws at import), and not only failed tests?
It does not. Read in `.refs/jest`:
- jest-core TestScheduler.ts `_bailIfNeeded` compares only
`aggregatedResults.numFailedTests >= this._globalConfig.bail` (lines 459-460),
and is called from `onResult` alone (line 177); `onFailure`, where a worker
error lands, never calls it.
- jest-test-result helpers.ts `addResult` adds `testResult.numFailingTests` to
`numFailedTests` (line 107). A `testExecError` only raises
`numRuntimeErrorTestSuites` (lines 112-114), which the bail check does not
read, and `buildFailureTestResult` gives a suite that failed to run
`numFailingTests: 0` (line 58).
Recorded with real Jest 30.5.2 to be sure: `--bail`, one worker, the first
file throws at import, two passing files follow. All three ran: `FAIL
./a-throws.test.ts`, `PASS` for the other two, `Test Suites: 1 failed, 2
passed, 3 total`, exit 1.
Provino's `onDone` count already matches (only failed `test-end` events count,
a load failure adds none), so there is no source change. The test pins it
through the bin against the golden, so counting load failures later would fail
it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(provino): run() answers a bad bail or detectOpenHandles with exit 2, not a rejection (B21a)
`run({ bail: -1 })`, `NaN` or `1.5` reached the orchestrator, which throws
`ORCH_BAD_OPTION`; `usageMessage` maps only `ORCH_BAD_PATTERN`, so `run()`
rejected where every other bad option is exit code 2 with a message on stderr
and a `null` summary.
`poolOptions` now checks the lifecycle options with the others: `bail` must be
a safe integer of at least 0 (0 is off), and `detectOpenHandles`, when given,
a boolean. Either is a `UsageError`.
Test: through `run()`, each of -1, 1.5, NaN and Infinity as `bail` and a string
as `detectOpenHandles`. Before: the run rejected with `ORCH_BAD_OPTION`. Now:
exit code 2, no summary, the message names the option.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(provino): the bin handles SIGHUP, and sets its exit code when the first signal lands (B21a)
SIGHUP. `handleSignals` took SIGINT and SIGTERM only, so `kill -HUP` (or a
closed terminal) ended the bin by Node's default action with no cleanup: a
worker in a synchronous loop survived it. SIGHUP is now handled like SIGTERM:
the first cancels the run (reason `'SIGHUP'`), a further signal of any kind
forces, the workers are killed, and the bin ends with 129 (128 + 1), as the
harness's `exitOnSignals` does. The after-run handler covers it too. The run's
summary calls it `interrupted`: the orchestrator knows only SIGTERM by name,
and the bin's exit code is the signal's.
Exit 13. The bin set `process.exitCode` only after `await main(...)` returned.
If `main` is still pending once the signal has taken every worker away and
nothing else holds the event loop open (a reporter promise that never
settles), Node ends the process on the unsettled top-level `await` with 13.
`handleSignals` now tells `onFirst` the exit code as the first signal lands,
and the bin sets `process.exitCode` there.
Tests: `signals.test.ts` (SIGHUP, `onFirst` once and before the abort is
delivered, force combinations), and through the real bin in a process group,
swept afterwards: SIGHUP while a worker loops synchronously (the bin was killed
by SIGHUP and the worker was left running; it is 129 and nothing is left), SIGHUP
then SIGHUP as a force, and each signal against a bin whose `main` (swapped by
a resolve hook) lets go of every handle and never settles (13, now 130, 143
and 129).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(provino): a workerIdleMemoryLimit that floors to 0 bytes is no limit, as in jest-worker, and the recycle test stops guessing a restart's timing (B21a)
Semantics. jest-worker 30.5.1 floors the limit (`Math.floor(totalmem() *
limit)` for a share in (0, 1]) and then restarts only on `limit && heapUsed >
limit`, so a share that floors to 0 bytes never restarts; only a limit of
exactly 0 means every file. `workerRecycle` mapped it to `memoryLimitBytes: 0`,
which replaces the worker after every file. It now returns `Infinity` (no
limit; omitting it would leave the pool's default) for a nonzero limit that
floors to 0, and 0 is still every file.
Test. The restart check read the child's pid again after a fixed 300 ms. The
check is a message round trip to the child and a restart an asynchronous kill,
so a slow runner could flip the answer. When a restart is due the test now
polls for the old child to be gone, with a 30 s deadline; when none is due it
watches the child for a bounded 1.5 s, which a slow machine can only make
weaker, never fail. A case that floors to 0 bytes (1e-15) is added, with
`workerRecycle` unit cases around the boundary; before the fix it asserted the
pool replaces (every file) where jest-worker restarts nothing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(orchestrator): the lifecycle tests synchronise on a marker and check the killed workers are gone, and the chaos run recycles before the heap cap (B21a)
- "kills the files still running" asserted that `b-hangs` had only seen
`file:start`, which holds only if b's worker took its file before a's worker
had finished and bailed: a race on a loaded machine. The failing test now
waits for a marker file that the hanging test writes once it is running, so
b's `file:start` is on the bus before a can fail. The assertion is unchanged.
(Eight runs under eight busy loops: no failure.)
- The SIGINT, SIGTERM, late-signal and force-signal tests did not look at the
workers they killed. They now load the pid-recording entry (the stuck-stop
worker records its pid too) and assert every pid is gone after the run, as
`coordinator.test.ts` does.
- The chaos run gave threads one 192 MB heap cap per thread, with the pool's
default recycle limit (at least 512 MiB) above it. A healthy worker that had
served many files could meet the cap as an OOM before the pool replaced it,
on a slow machine, and fail a file that did nothing wrong. The run now sets
`memoryLimitBytes` to 160 MiB, under the cap, so healthy workers are
replaced first; the five planted failures stay exact.
None of these has a red run to show: each is a failure that depends on load.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* docs(orchestrator): the lifecycle notes match the review fixes (B21a)
The sticky OOM flag in place of a stderr tail, a thread's OOM with no limit,
the deadline's worker being stopped from the moment the timer fires, the late
signal's reason, the limit of a force signal on an inline worker (code looping
in-process can't be interrupted), and that a file that fails to load is not a
failed test for `--bail`, as in Jest. The two test bullets say what the chaos
run's memory limit and the lifecycle tests' marker and pid checks are for. The
file is no longer than it was.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(provino): the second-SIGHUP test no longer races the run finishing by itself (B21a)
The bin-level "second SIGHUP is the force" test killed a bin whose worker was
in a synchronous loop, sent the second signal 20 ms later, and expected the
bin to be alive for it. The first signal kills that worker at once and the run
ends in a few milliseconds, so the second signal could arrive while the process
was already exiting, where the default action applies and the bin was killed by
SIGHUP (two runs of three failed).
It now runs against the swapped `main` (`fixtures/unsettled-main/`) with
`UNSETTLED_MAIN_HOLD=force`: the stand-in stays up until the force signal, says
`cancelled` when the first signal lands, and the test checks that one SIGHUP
leaves the bin running and that the second ends it with 129 within the grace.
The worker-in-a-synchronous-loop case with a single SIGHUP stays as it was, with
its no-child-survives sweep.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a cgroup with no memory limit no longer turns worker recycling off (B21a)
On GitHub's Linux runners `process.constrainedMemory()` reports about 2^64 bytes, a cgroup with
no limit. `defaultWorkerMemoryLimit` took that as the container's cap, so the default limit came
out at about 4.6 TB per worker and no worker was ever recycled on memory. The unit test caught it:
CI's three test legs failed "many workers: the floor" with 4611686018427 against 536870912. A cap
is now never more than the machine's memory, and the test pins both a 2^64 cgroup and a real cap
under the machine.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(orchestrator): one kill() marks a worker as dying, and in-process workers are a transport capability (B21a)
The pool set `killed` in three places and `timedOut` in a fourth, and the
deadline kill overloaded `track()` to mean "being killed". `kill(slot, cause)`
now records `killedFor` and terminates; `usable()` and `reportExit` read it, and
`retire()` waits for a killed worker's exit instead of stopping it again, so
`track` means "stop" again. `execute` splits the send into `send()`, whose
`finally` ends the deadline and the event route once, before `pump()` can set
the route for the worker's next file.
The pool also branched on `transport.kind === 'inline'`. A `sharesProcess`
capability on `TransportFactory` (next to `maxWorkers`) says a kill can't end a
worker, the inline transport sets it, and the pool reads it once. Each slot has
one `gone` promise: `exited`, or `Promise.race([exited, forced.promise])` only
when the worker shares the process and a force signal exists. Without a force
signal every file and stop used to race the never-settling `forced.promise`,
leaving a reaction on it that kept every file's `FileDone` alive until the pool
was collected. `runProjects` caps the workers by the factory's `maxWorkers`
instead of by kind.
Behaviour is unchanged. The pool test fake takes `sharesProcess` where a test
meant an inline worker.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): a worker that shares the coordinator's process is never recycled on memory (B21a)
An inline worker measures `heapUsed + external` of the whole coordinator
process. Since `ea00d5b` capped `process.constrainedMemory()` at `totalmem()`,
the default `workerIdleMemoryLimit`-style limit is real on a small Linux CI
runner (512 MiB to about 1.3 GB), so after every file the inline worker was over
it and "replaced", which frees nothing it measured: CI failed `replaces a worker
whose file left globals behind` (workers `[1, 2, 3]` for `[1, 1, 1]`) and `runs
an inline pool on one worker whatever maxWorkers says` (3 workers for 1). Locally
the limit is far above the test process's heap, so both passed.
`worn()` now applies only the file count to a worker of a transport with
`sharesProcess`; a leak still replaces it (D22). Jest's `--runInBand` recycles
nothing either.
Fails first: a pool test over a fake process-sharing transport that reports a
huge `memoryBytes` (workers `[1, 2, 3]` before, `[1, 1, 1]` now, limits 0 and
5000, and the count and leak rules still replace it), and a `runProject` test on
an inline pool with an explicit `memoryLimitBytes: 1`, which is the CI
condition. The fork and thread memory tests are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(orchestrator): the file deadline's timeout comes from the transport, like the start and stop timeouts (B21a)
The pool killed a worker for a file past `fileTimeoutMs` and then rebuilt the
exit itself (`FILE_TIMEOUT`, a `slot.timedOut` flag read in the catch), and
`crashError` re-worded it from a `fileTimeoutMs` threaded through `resultOf`.
`Transport.terminate(force, timeout?)` now takes the phase and the limit the pool
enforces, and `connect()`'s `timedOut ??=` reports `{ type: 'timeout', phase,
limitMs }` for it as it does for `start` and `stop`. The limit travels on the
exit as `oom` carries `limitMb`, for every phase (the start timeout, the
teardown timeout, `fileTimeoutMs`). `describeExit` is the only place that says
"past its deadline of N ms", so `crashError` and `resultOf` lose their
`fileTimeoutMs` parameter, and `FILE_TIMEOUT`, `timedOut` and the catch special
case are gone.
This changes `WorkerExit` in `@provino/types` (`limitMs` is required on a
timeout) and `Transport.terminate`. Type tests cover both, with a misuse case
each, and real forks and threads show a deadline kill reported as that timeout.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(orchestrator): OOM helpers in one place, and a fork's exit waits for stdio only when it reads it (B21a)
OOM helpers. `defaultHeapLimitMb()` and `oomExit(limitMb?)` live in
`transport/shared.ts` (the `Math.round(getHeapStatistics().heap_size_limit /
1048576)` was written in forks and threads), and read `node:v8` through
`process.getBuiltinModule` where an out-of-memory exit needs it, not as a static
import on the cold path. A fork's limit is `memoryLimitMb ?? <the last
--max-old-space-size of its flags>`, instead of regex-parsing the flag the
transport had just appended. The dead `failed` flag is gone (the spawn-failure
branch's `ended = { code: 1 }` already reports exit code 1), and the doc comment
no longer says the memory flag "replaces" one in `execArgv`: it is appended
after them, so it wins.
Behaviour change, deliberate and small. The fork's exit was reported once the
child had exited, its IPC channel had disconnected *and* its stdio had closed,
so a test that left a child holding the worker's stdout or stderr delayed every
worker's exit by `DISCONNECT_GRACE_MS` (1 s). Only a SIGABRT reads the stderr
(V8's out-of-memory line), so only it waits for `close`; any other exit is
reported on exit plus disconnect, as before B21a. The report is now once-only,
since `close` can follow it.
The logic moves out of `forksTransport` as `reportChildExit`, driven by a
child-like emitter, so `forks.test.ts` checks it by hand with no timing: a
clean exit is reported without `close`, a SIGABRT waits for it, the grace
still ends a stuck wait, a spawn failure is exit code 1. `transport.test.ts`
runs a real worker whose grandchild keeps its stderr open and expects the exit
in under the 1 s grace (it failed at about 1.18 s with the old rule).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(orchestrator): bail counts each file's failed tests in `runFile`, not through a new getter (B21a)
`FileDispatch.failedTests` and its counter existed only so `runFile` could read
a file's failures when the file ended. `runFile` now keeps its own per-file
count, bumped in `onTestFailed`, and one `countFailed(n)` adds to the run's total
and calls `checkBail`: per test under the policy's `'test'` rule, per file in
`onDone` under `'file'`. The duplicated `bail === undefined ||` guards are gone,
since `checkBail` already makes that check. Behaviour is unchanged.
Not done: having the pool record why it cancelled so `runFile` stops inferring a
bail from `bailed && signal?.aborted !== true`. The pool can tell a cancel from
a signal but not that a `close()` was the run's own bail, and a signal that
comes after the bail must still win, so that would need the run's inference
kept next to the pool's reason.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* perf(orchestrator): --detectOpenHandles tracks no promises and reads the creating stack as call sites (B21a)
The hook ran for every promise of the run only to skip it (`PROMISE` is an
ignored type), which made every `await` dearer: 300,000 `await null` took 35 ms
with a bare init hook and 13 ms with `trackPromises: false` (the lead measured 1M
at 395 ms against 40 ms with the real hook, on Node 24.22.1). The option is
ignored on Node 22.15, where the type is still skipped. The open-handle tests,
the `cli/detect-open-handles` golden and the live-Jest block still pass, so
attribution after an `await` did not move.
The creating stack is captured as structured call sites
(`Error.prepareStackTrace` around `captureStackTrace`, restored in a `finally`),
`isUserFile` reads `getFileName()`, and the stack's text is built only for a
resource that is kept. A resource made by something the user's code started
shares the trigger's frames by reference instead of copying them. `shown()` runs
once per frame, the own-package test is one function, and
`stripVTControlCharacters` over file paths is gone. `node:vm` and `node:v8` are
read where a collection needs them, not by every run that loads the module, and
the private `sleep` is `node:timers/promises`.
`collectOpenHandles` returns `{ collect, dispose }`. The run's error path calls
`dispose()`, which only disables the hook, instead of waiting for the full
collection. Tests: a handle a dependency made from a callback the project
scheduled (the trigger path had none), and `dispose`.
Not done: importing `open-handles.ts` dynamically from `run.ts`. The package
index re-exports `collectOpenHandles`, so every consumer loads the module
anyway; the builtins it needed are what was worth deferring. Dropping the export
would make the dynamic import worth it, and is left to Tyler.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(provino): one table of the signals that end a run, and a library run() aborted with SIGHUP exits 129 (B21a)
The signal -> reason -> exit code mapping lived in four places: `run.ts`
compared an untyped `signal?.reason === 'SIGTERM'`, `signals.ts` had
`EXIT_CODES`, `cli.ts` hard-coded 130, 143 and 129 in three `process.once`
calls, and `ExitCode.Sigint` and `Sigterm` were a fourth copy.
`RUN_SIGNALS` in `@provino/orchestrator` (`exit-code.ts`) is now the one table:
each of SIGINT, SIGTERM and SIGHUP has the summary's `reason` and the exit code
of a process it ends, built from `ExitCode` (which gains `Sighup: 129`). A test
checks each as 128 plus `os.constants.signals[name]`. `isRunSignal` narrows an
abort reason, so `run.ts` no longer compares a string it knows nothing about,
and `exitCodeFor` reads the table instead of two literals.
Behaviour change, for consistency. SIGHUP used to end a run `interrupted`
(130 from `exitCodeFor`) while the bin said 129. It is now its own
`RunEndReason`, `hangup`, and `exitCodeFor` maps it to 129, so a library `run()`
aborted with `'SIGHUP'` exits 129 like the bin. A reason was smaller than a
`RunSummary.signal` field: every consumer only compares the reason to `passed`.
Tests: the orchestrator's signal cases and `provino/test/run.test.ts` take every
abort reason from a table, the type tests cover the reason, the table and
`isRunSignal` (with misuse cases).
`signals.ts` builds its listeners from the table, one loop for `on` and one for
`off`. `SignalControl.afterRun()` replaces `dispose()` plus the bin's three
`process.once(<signal>, () => process.exit(<literal>))`: it stops the run's
handlers and ends the process at once with each signal's own code. The bin keeps
`signals.exitCode() ?? code`: a Ctrl+C during `--listTests` or `--showConfig`
runs no run at all, so no summary carries the code.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(provino): the pool and run limits are validated once, by the orchestrator (B21a)
`run()` re-checked `bail`, `workerMemoryLimit`, `maxFilesPerWorker` and
`fileTimeoutMs` (and that `detectOpenHandles` is a boolean, which its type
already says), which the pool's `checkedLimits` and `runProjects`' `bail.count`
check reject as `ORCH_BAD_OPTION` before anything reaches the bus. Those copies
are gone. `usageMessage` maps `ORCH_BAD_OPTION` to a usage message (exit 2, no
rejection) beside `ORCH_BAD_PATTERN`, and the orchestrator's messages say what
the option is for as well as its name and value, since a library user may not
know `recycle.memoryLimitBytes` is their `workerMemoryLimit`. `bail: 0` stays
off, filtered before the call, and `maxWorkers` stays checked here: the pool
would only round it.
The CLI parsers still name the flag. `parseMaxWorkers` is `parseWhole(text,
'--maxWorkers')` and `parseBail` is `parseWhole(text, '--bail', 0)`; the
`--bail` message now says "of at least 0" in the same words as the others.
Tests: the `bail` case matches the orchestrator's `bail.count` text, a new case
covers the three worker limits and the file deadline end to end (exit 2, nothing
run), and `describe.test.ts` covers the mapping. The assertion that a
non-boolean `detectOpenHandles` is exit 2 is removed with the check it tested:
the option is typed `boolean`, and a string is ignored like any other value that
is not `true`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(types): RunRequest drops bail, forceExit and detectOpenHandles, which nothing read (B21a)
`dialect-jest` filled them in from the command line, but `runJestCommand` reads
only `read.globalConfig`, which already merges the flag with the config (and
carries `bail: 2` from a config, which `--bail` on Jest 30.5.2 cannot). Two
sources for one setting invited the wrong one to be read, so the request no
longer has the fields, `jestArgvToRunRequest` no longer fills them, and their
tests and type tests go with them.
The three options are config keys, so the Jest CLI table classes them `config`,
not `request` (the class counts in the test move from 17 and 50 to 14 and 53).
A type test now holds the other way: a request with a `bail` is an error. The
argv still carries each flag, which the reader merges, and a test says so.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(provino): workerRecycle takes the reader's bytes, and its test runs jest-worker end to end (B21a)
The Jest config reader already applies `stringToBytes(option, totalmem())`
(jest-config 30.5.2's), so `read.globalConfig.workerIdleMemoryLimit` reaches
`runJestCommand` as bytes, or 0. `workerRecycle` still carried a `(0, 1]` share
branch and a "floors to 0 bytes means no limit" guard that nothing could reach.
It is now `limit === undefined ? {} : { recycle: { memoryLimitBytes: limit } }`.
What jest-worker 30.5.1 does with the number jest-runner gives it
(`idleMemoryLimit: workerIdleMemoryLimit` when it is a number), read in
`build/index.js`: a child-process worker restarts after every file for 0
(lines 979-981, "`idleMemoryLimit` of `0` means always restart") and otherwise
when `heapUsed` is over the limit; a thread worker takes `options.idleMemoryLimit
|| null`, so 0 there is no limit (line 1148). So the old test, which fed
jest-worker the raw `1e-15` and saw no restart, was checking an input Jest never
passes: the reader turns that share into 0, which restarts. Provino's 0 (replace
after every file) matches the child-process case, so no behaviour changes for
`provino jest`; the thread-worker case (`--workerThreads` with a limit of 0)
differs and joins the divergence already noted for `heapUsed` against RSS.
`worker-recycle.test.ts` now puts each config value (0, bytes, shares, `'50%'`,
`0.2`, `'512MB'`, `'1kb'`, the share that floors to 0) through the Jest reader,
hands the normalized number to a real jest-worker `Worker` and to
`workerRecycle`, and requires the child to be restarted exactly where the pool
replaces. It makes its project with `trackedProjects()` instead of
`process.env.TMPDIR ?? '/tmp'`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* refactor(reporters): the open-handle report uses counted() and trusts the summary to omit an empty list (B21a)
`openHandlesText` wrote its own "N open handle(s)" plural; it now calls the
`counted(count, noun)` the same file uses for the snapshot lines. The default
reporter's `openHandles.length > 0` guard is dropped: the orchestrator's
`summarize` omits the list when it found none (the type's contract: "absent when
it was off or found none"), and the only other builder of a summary, the
reporters' test support, passes through what it is given.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(orchestrator): shared run, pid and sweep helpers, tables for the signals, and no inline sleeps (B21a)
No assertion is weaker; each moved or merged one keeps its text.
- `sweep.ts`: the repeated "`ps` unavailable -> warn, else assert the group is
empty" block is `assertGroupEmpty(pgid, label)`, used by `pool-chaos`; the
header names `groupAlive`, the function that exists (it said `groupProbe`);
`ChaosRun.coordinatorPid`, which nothing read, is gone. `packages/provino/test`
keeps its own copy of the file: `pnpm boundaries` allows a package only another's
public entry (`public-entry-only`), and the type-test project refuses the relative
import across projects (TS2878), so the header of both copies says why.
- Pid records: one `recordPid()` writes the `provino-pids-<ppid>` line for the two
fixtures that stand in for a worker entry, `takeWorkerPids(owner = process.pid)`
takes the coordinator's pid, so `pool-chaos` uses it instead of its own read, and
the comment that named a nonexistent `pidsOf` is fixed.
- `support.ts` holds `recorder()`, `run()` and `assertWorkersGone(pids)`, which
`lifecycle.test.ts` had copied from `coordinator.test.ts`; both use them (the
recorder's `Seen` gains the file's `path`, and the lifecycle's `eventsOf` still
reads only `file:start` and `file:end`).
- The SIGINT, SIGTERM and SIGHUP cases of the lifecycle test are one table (the
SIGHUP row is the new `hangup` reason, 129) and the duplicated `exitCodeFor`
against a literal is one assertion.
- `setTimeout` from `node:timers/promises` replaces the inline
`new Promise((resolve) => setTimeout(resolve, n))`, and the three `settled`
flags of `pool.test.ts` are one `watch()`.
- `chaos-coordinator.ts` takes the `pool` object as JSON (`CHAOS_POOL`) instead of
rebuilding it with five conditional spreads.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(provino): one startCli/spawnCli, JEST and the live Jest runner shared, and a table for the signals (B21a)
No assertion is weaker.
- `support.ts`: `startCli(args, { cwd, deadlineMs, detached, env, nodeArgs })` is the
one place the bin is started, and `spawnCli` is `startCli(...).result()`.
`lifecycle.test.ts` had its own `startCli` with the `detached`, `env` and
`nodeArgs` options; it keeps a thin `startGroup` that fixes `detached` and the
deadline, and drops its own spawning.
- `live-jest.ts` exports `JEST` and a `runJest(cwd, args)` that returns the exit code
and stderr; `lifecycle.test.ts` and `projects.test.ts` use them, and
`liveJestStderr` is gone.
- The three "while a file runs" signal cases are one table (SIGINT 130, SIGTERM 143,
SIGHUP 129). Each now also checks the `Interrupted` line, which only SIGINT and
SIGHUP did, and the group is swept by the shared `assertGroupEmpty`.
- The fixed 4 s sleep behind a negative assertion ("without --forceExit the interval
holds the process up") polls for the run's summary instead and then gives the
process 500 ms to exit, racing its exit, so a process that ends fails at once.
- `setTimeout` from `node:timers/promises` replaces the inline promises.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* docs(orchestrator): the lifecycle notes match the cleanups, and are shorter than before (B21a)
The CLAUDE.md files say what the code now does: the deadline's exit comes from the
transport with its limit, an OOM and a fork's stdio (`oomExit`, `reportChildExit`),
`RUN_SIGNALS` as the one table of the signals, the tracker `collectOpenHandles`
returns, and the shared run helpers in `test/support.ts`. The orchestrator's is
about 45 bytes smaller than it was before this pass (it was over its guide
already): wording that restated code was cut.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(orchestrator): measure a thread worker by its own isolate heap, so a healthy thread is reused
A thread worker measured itself as `heapUsed + external` and the pool replaced it after any file
that left it over the limit. In a worker thread `external` counts the ArrayBuffers the isolate has
reserved, not memory it holds: oxc-parser's raw transfer buffer is a 6 GiB ArrayBuffer of virtual
memory (its own comment says so), so a thread with a RSS of 150 MB and a 20 MB heap read 6.47 GB.
Every thread was over the default limit (a quarter of the machine's memory over maxWorkers, never
under 512 MiB) as soon as maxWorkers was more than a few, and over the chaos test's 160 MiB always,
so `--pool threads` booted a new thread for every file. The chaos test's 200 thread boots took
13 s here and passed the 120 s watchdog on CI's Node 22.15, where each boot also strips types.
A thread (and an inline worker) now reports `v8.getHeapStatistics().used_heap_size`, the isolate's
own heap, which is what jest-worker 30.5.1's `process.memoryUsage().heapUsed` reads in its thread
and process children. A fork still reports RSS.
`runProject over real threads under the default memory limit` runs four files over one real thread
with the default limit at its 512 MiB floor and checks one worker took every file. It failed first
(workers 1, 2, 3, 4) and passes now; the chaos test passes under both pools, its threads run in
6.5 s instead of 13 s.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* fix(provino): run live Jest with colour off in the open-handle comparison, as the recorder does
The test that holds `--detectOpenHandles` to live Jest 30.5.2 compared the two blocks as text and
failed on GitHub's runners (Node 24 and 26) with Jest's block full of escape codes and Provino's
plain. It was the code frame only. Jest's `getRenderedCallsite` asks `@babel/code-frame` for
`{ highlightCode: true }` (jest-message-util `src/index.ts`), which highlights whenever picocolors
says colours are supported, and picocolors says so for a set `CI` (`!!env.CI`), a TTY or
`FORCE_COLOR`, whatever stream is written to. GitHub sets `CI=true`, so live Jest coloured the
frame; locally nothing is set, so both blocks were plain and the test passed. `CI=true pnpm test`
reproduces it, and fails the same way here.
Provino prints no colour (`--colors` is read but not applied), and every golden is recorded with
`NO_COLOR=1` (the harness's `runnerEnv`), so the test now gives both runs those conditions: `runJest`
spawns Jest with `noColorEnv()` (this process's environment, `NO_COLOR=1`, no `FORCE_COLOR`), and
Provino's run gets `NO_COLOR=1` too. The comparison is the same exact text of the same block.
It passes under `CI=true`, `CI=true FORCE_COLOR=1` and `CI=true TMPDIR=/tmp/claude`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(orchestrator, provino): busy-loop fixtures end by themselves after 120 s (B21a)
The hang fixtures looped forever with `for (;;) {}`. A test kills the bin's process group in a
`finally`, but when the test process itself is killed first (a command timeout, a cancelled run),
the `finally` never runs, and the detached bin and its workers live on. Two such workers were found
spinning a core each for hours on this machine. Each fixture now loops for 120 s, past every
test's own deadline, and then ends.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
* test(provino): the second-signal test no longer races the run ending on the first (B21a)
"a second Ctrl+C with a worker in a synchronous busy loop" sent SIGINT, waited 20 ms and sent
another. The first already kills busy workers (B21 Choice 3), so the run could end and the bin
start exiting before the second landed; a signal in Node's exit teardown takes the default action,
and the test failed with `{ code: null, signal: 'SIGINT' }`.
It is now two deterministic tests. The per-signal test runs two workers in a busy loop and checks
that SIGINT, SIGTERM and SIGHUP each kill both and exit 130, 143 and 129 with nothing left. The force
test, against the stand-in `main` that holds the run until the second signal, runs for SIGINT as
well as SIGHUP and checks that the bin is gone within 1 s of it. The force's kill of a worker stuck
in its stop stays the orchestrator's `lifecycle.test.ts`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tyler Robertson <[email protected]>
---------
Signed-off-by: Tyler Robertson <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>1 parent fbdd480 commit 03c6109
107 files changed
Lines changed: 5463 additions & 501 deletions
File tree
- packages
- bench/src/worker
- dialect-jest
- src/node
- harness
- corpus
- fixtures/cli
- bail-on-load-error
- __goldens__
- bail-one
- __goldens__
- bail-two
- __goldens__
- detect-open-handles
- __goldens__
- force-exit
- __goldens__
- skipped-file-alone
- __goldens__
- skipped-file
- __goldens__
- src/corpus
- orchestrator
- src
- transport
- worker
- test
- fixtures
- provino
- src
- internal
- test
- fixtures/unsettled-main
- reporters
- src
- default
- internal
- types
- src
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
197 | 196 | | |
198 | 197 | | |
199 | 198 | | |
200 | | - | |
201 | | - | |
| 199 | + | |
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
| |||
231 | 229 | | |
232 | 230 | | |
233 | 231 | | |
234 | | - | |
235 | | - | |
| 232 | + | |
236 | 233 | | |
237 | 234 | | |
238 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
996 | 996 | | |
997 | 997 | | |
998 | 998 | | |
999 | | - | |
| 999 | + | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
| |||
1092 | 1092 | | |
1093 | 1093 | | |
1094 | 1094 | | |
1095 | | - | |
| 1095 | + | |
1096 | 1096 | | |
1097 | 1097 | | |
1098 | 1098 | | |
| |||
1114 | 1114 | | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | | - | |
1118 | 1117 | | |
1119 | 1118 | | |
1120 | 1119 | | |
| |||
1128 | 1127 | | |
1129 | 1128 | | |
1130 | 1129 | | |
1131 | | - | |
1132 | | - | |
1133 | 1130 | | |
1134 | 1131 | | |
1135 | 1132 | | |
| |||
1180 | 1177 | | |
1181 | 1178 | | |
1182 | 1179 | | |
1183 | | - | |
| 1180 | + | |
1184 | 1181 | | |
1185 | 1182 | | |
1186 | | - | |
| 1183 | + | |
1187 | 1184 | | |
1188 | 1185 | | |
1189 | 1186 | | |
| |||
1307 | 1304 | | |
1308 | 1305 | | |
1309 | 1306 | | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1310 | 1321 | | |
1311 | 1322 | | |
1312 | 1323 | | |
| |||
0 commit comments