✅ test(dvara): two supervisor tests no longer fail under load
Slice: #148
Two dvara supervisor tests stop depending on how fast git and ps start, so a local pnpm check on a loaded machine no longer fails in dvara. dvara's behaviour does not change, and nothing is released. Proposal approved on #148 (page).
The change
- "stops waiting on output a leftover process holds open" no longer times the whole
superviserun against 2500 ms. Its leftover job holds the hook's output open until the test releases it, and the test checks thatsupervisereturned before the job wrote its marker, which is what the drain limit is for. A 30 s fallback in the job turns a supervisor that waits for it into a red assertion, not a hang. The memory sampler'spsis stubbed in this test. - "records a passing run with its stages and leaves no listener behind" no longer reads its invocation from the real
ps, whose 5 s timeout gives"unknown"under load.Optionstakes an optionalparentTable, passed straight toinvocationContext(which already took one), and the test gives it a fixed chain ending at init, with pids no real process has, so asupervisethat ignored the option would get"unknown"from the real table. The other supervise tests, andcontext.test.ts's "reads the real process table by default", still run the realps, with no timing riding on it.
Proof
PATH shims that sleep before exec-ing the real binary (docs/lessons/testing.md, "Budget flakes come from stalls, not load"):
git +1.5 s | ps +6 s | |
|---|---|---|
| test 1, before | ✖ Date.now() - started < 2500 (26.1 s) | |
| test 2, before | ✖ 'unknown' !== 'manual' | |
| both, after | ✔ | ✔ |
Each test still goes red when what it guards is broken (both breaks reverted):
- Drain limit removed from the race in
drained(): test 1 fails at the marker check, after the job's fallback (57 s). superviseignoringparentTable: test 2 fails with'unknown', with no shim.
pnpm -C packages/dvara check passes (328 tests, coverage thresholds met). The full local pnpm check (provenance, every package's check, test:scripts, lint, guards) passes on a loaded Mac, after merging main with #159, the fix for veda-hq/veda#147. Before that merge it failed only in kavach's run-child test, #147's.
🤖 Generated with Claude Code
Summary by cubic
Fixes two dvara supervisor tests so a local pnpm check no longer fails on a loaded machine; dvara's behavior doesn't change.
- The leftover-process test no longer times the whole
superviserun against 2500 ms. It now checks thatsupervisereturned before the job wrote its marker, with a 30 s fallback in the test's job that turns a hung supervisor into a red assertion rather than a hang. - The passing-run test no longer reads its invocation from the real
ps, which gives"unknown"under load.Optionsnow accepts an optionalparentTablepassed straight toinvocationContext, and the test uses a fixed chain with pids no real process has, so ignoring the option fails via the real table.