Public: anyone can read this; the crew can change it.
Full suite red: test/schema-migrations.test.ts #12820
Check · Review · Land · Live done — Landed and live in production.
test/schema-migrations.test.ts should no longer go over the 2 s test budget. The file now runs in about 4 s, down from about 8.7 s. I measured only the whole file; I did not time the two named tests on their own, and I ran no repeat runs (--rerun-each).
shipped production is serving it deploy 5bb6da3
test/schema-migrations.test.ts should no longer go over the 2 s test budget. The file now runs in about 4 s, down from about 8.7 s. I measured only the whole file; I did not time the two named tests on their own, and I ran no repeat runs (--rerun-each). The 26 tests pass, and tsc --noEmit and scripts/gate.ts print nothing.
Cause: the two tests the issue names, and others, each built production's data by booting the full migration list from scratch. That boot is the slow part and ran several times.
Change: production() now does that boot once per file and gives each test a copy of the resulting file. Each test still starts from its own private copy of real forge data, so what it checks is unchanged. The fix is in test/schema-migrations.test.ts only.
Not done: I did not add the file to SLOW in scripts/gate.ts. I made it faster instead.
To try it: bun test ./test/schema-migrations.test.ts
Test-only change, no web/TUI/security surface. production(migrations) is built once per file and each caller gets a private copy. The built file is checkpointed and closed, so copying it is safe. Non-default lists still build fresh, so the tests keep their meaning. Nothing was added to SLOW, which is what the issue wants. No new dependency, no README edit.
Two things I would do next:
- Time the two named tests alone and run --rerun-each, since only the whole file was measured.
- copyOf(production(migrations)) now copies twice. Let copyOf callers use production directly, or leave it, since the cost is small.
test/schema-migrations.test.tsshould no longer go over the 2 s test budget. The file now runs in about 4 s, down from about 8.7 s. I measured only the whole file; I did not time the two named tests on their own, and I ran no repeat runs (--rerun-each). The 26 tests pass, andtsc --noEmitandscripts/gate.tsprint nothing.Cause: the two tests the issue names, and others, each built production's data by booting the full migration list from scratch. That boot is the slow part and ran several times.
Change:
production()now does that boot once per file and gives each test a copy of the resulting file. Each test still starts from its own private copy of real forge data, so what it checks is unchanged. The fix is intest/schema-migrations.test.tsonly.Not done: I did not add the file to
SLOWinscripts/gate.ts. I made it faster instead.To try it:
bun test ./test/schema-migrations.test.tsCloses #12800