test/pull-schedule.test.ts: open each test's database with openDb, not a fresh migrate (24 s, over the 20 s file budget, #17202)
Cause: the file's top-level beforeEach does db = new Database(":memory:"); migrate(db, migrationFiles);, so each of its 18 tests runs every migration under src/core/migrations again (about 400 now). src/kernel/db.ts puts one fresh empty database at about 200 ms on a quiet machine; 18 of them, with the full suite running 6 files at a time, is most of the 24 s #17202 measured. The tests themselves use fake clocks and loopback servers.
Fix, test-only:
In beforeEach: db = openDb(":memory:", migrationFiles); with import { openDb } from "../src/kernel/db.ts";.
Drop the now-unused migrate import, and make Database a type-only import (it is only let db: Database after this), so the dead-code check stays green.
Why this and not a local cache: openDb already keeps the migrated empty image per migration list (in-process, and across the run's processes through the preload's empty-images), so the file migrates at most once and every test still gets its own fresh copy. It also runs the tests on the handle production uses (strict binding, foreign keys on, the forge's pragmas). pull_run has no foreign key (20261109120000-pull-run.ts), and the pullDue test already turns foreign keys off before inserting its app rows, so no test body changes.
Not this: adding the file to SLOW in scripts/gate.ts, raising the 20 s budget, or loosening or skipping any test.
Done when bun test ./test/pull-schedule.test.ts passes with all 18 tests unchanged, the pull check is green, and the next full suite shows the file under 20 s.
test/pull-schedule.test.ts: open each test's database with openDb, not a fresh migrate (24 s, over the 20 s file budget, #17202)
Cause: the file's top-level beforeEach does
db = new Database(":memory:"); migrate(db, migrationFiles);, so each of its 18 tests runs every migration under src/core/migrations again (about 400 now). src/kernel/db.ts puts one fresh empty database at about 200 ms on a quiet machine; 18 of them, with the full suite running 6 files at a time, is most of the 24 s #17202 measured. The tests themselves use fake clocks and loopback servers.Fix, test-only:
db = openDb(":memory:", migrationFiles);withimport { openDb } from "../src/kernel/db.ts";.migrateimport, and makeDatabasea type-only import (it is onlylet db: Databaseafter this), so the dead-code check stays green.Why this and not a local cache: openDb already keeps the migrated empty image per migration list (in-process, and across the run's processes through the preload's empty-images), so the file migrates at most once and every test still gets its own fresh copy. It also runs the tests on the handle production uses (strict binding, foreign keys on, the forge's pragmas). pull_run has no foreign key (20261109120000-pull-run.ts), and the pullDue test already turns foreign keys off before inserting its app rows, so no test body changes.
Not this: adding the file to SLOW in scripts/gate.ts, raising the 20 s budget, or loosening or skipping any test.
Done when
bun test ./test/pull-schedule.test.tspasses with all 18 tests unchanged, the pull check is green, and the next full suite shows the file under 20 s.