Files
Maximo GukandClaude Opus 5.5 4358072f8c Fix flaky tests/their causes (#691)
* Check only the generated file in the schema-to-ts compile tests

Every compile built a fresh program over the default lib (82 files, 2.9M
chars, mostly lib.dom) and type-checked all of it, then dropped every
diagnostic outside the generated file. That was ~99% of the work, and on
loaded 4-vCPU runners the first compiling test ran past even its 15s
override.

Parse the lib once per worker, warmed at file load where no per-test
timeout applies, and collect only the generated file's diagnostics. The
override goes. On 23 deliberately broken outputs the restricted check
reports exactly what the full one did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Make two schedule driver tests independent of real alarms

"isolates unexpected failures" made each schedule due before the next
enable, so the alarm that enable planned was due at once and could
deliver "broken" with its valid spec before the test broke it ("expected
'active' to be 'pending'"). Break the spec and make both rows due only
after every enable, and assert the planned alarm and the delivery so a
stray alarm fails loudly.

"does not replace an existing earlier alarm" set that alarm at now + 1s
on the test's clock, which a slow run outlived. Read the clock inside the
object and set it a minute out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Re-render only the scheduler rows whose inputs changed

Every page state change (a search keystroke, a title batch, the load-more
toggle, the minute tick) re-rendered every loaded row, and each row built
three new Intl formatters. With 100 rows that dominated the page, and the
pagination test ran past 5s on loaded runners.

Memoise ScheduleRow with stable callbacks and share formatters per locale
and options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Let the materialization test reach its trigger in four submissions

The test made 1001 real submissions to cross the hard-coded 1000-row
threshold, about 12,000 storage operations, which loaded runners stretched
past 5s. Make the threshold an OverseerImpl field (production value
unchanged) and lower it in the test, which still drives the real trigger
and asserts the same outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the test watchdog's tree bounded when vp kills the watchdog

When a task fails, vp's fast-fail SIGKILLs the direct child of every other
running task, and that child was the watchdog, so its vitest and workerd
tree ran on with no bound. On Linux vp then waits for every descendant, so
one orphan that never exits hangs the run until the CI job times out.

The process vp spawns is now a thin front holding an IPC lifeline to the
real watchdog, which tears the tree down when the lifeline drops. Adds
with-timeout.test.ts for the kill, signal and exit-code paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Budget vitest workers by vp concurrency

vp runs four test tasks at once and each vitest defaulted to cpus-1
workers: about 12 forks plus workerd fleets on a 4-vCPU runner. jsdom
suites starved in bursts, so tests needing well under a second of CPU hit
5s timeouts.

scripts/vp/run.ts now sets VITEST_MAX_WORKERS to
min(cpus-1, max(2, floor(cpus / concurrency))), forwarded untracked by the
vitest tasks and withheld when a command or the run sets its own worker
count. The shared task also pins vitest's default reporter: under a coding
agent vitest picks a silent one, and the idle watchdog read any suite
longer than 60s as wedged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:22:14 -05:00
..
2026-10-07 11:22:14 -05:00