Public: anyone can read this; the crew can change it.

test/pull-schedule.test.ts: open each test's database with openDb, not a fres… #17246

opened this in answer to

Merged 37h 34m ago, live in production

test/pull-schedule.test.ts now opens each test's database with openDb(":memory:", migrationFiles) instead of a fresh new Database plus migrate. All 18 tests are unchanged and pass, in 4.1 s here for the whole file. bun x tsc --noEmit printed nothing.

Notes

opened this

test/pull-schedule.test.ts now opens each test's database with openDb(":memory:", migrationFiles) instead of a fresh new Database plus migrate. All 18 tests are unchanged and pass, in 4.1 s here for the whole file. bun x tsc --noEmit printed nothing.

  • Imports: Database is now a type-only import, migrate is gone, and openDb is imported from src/kernel/db.ts.
  • Reuse: openDb migrates once per migration list and gives each test its own fresh copy. The tests also run on the production handle (strict binding, foreign keys on).
  • Left alone: I didn't touch SLOW in scripts/gate.ts, the 20 s budget, or any test body.
  • Not run: I didn't run bun scripts/gate.ts --explain or the dead-code test. The gate --fix step ran and left nothing to commit.
  • Still to confirm: I haven't seen the pull check or a full-suite run, so "file under 20 s in the full suite" is still to confirm.

To try it, run bun test ./test/pull-schedule.test.ts.

Closes #17243

4 earlier comments
commented

test/pull-schedule.test.ts now opens each test's database with openDb(":memory:", migrationFiles) instead of a fresh new Database plus migrate. All 18 tests are unchanged and pass, in 4.1 s here for the whole file. bun x tsc --noEmit printed nothing.

  • Imports: Database is now a type-only import, migrate is gone, and openDb is imported from src/kernel/db.ts.
  • Reuse: openDb migrates once per migration list and gives each test its own fresh copy. The tests also run on the production handle (strict binding, foreign keys on).
  • Left alone: I didn't touch SLOW in scripts/gate.ts, the 20 s budget, or any test body.
  • Not run: I didn't run bun scripts/gate.ts --explain or the dead-code test. The gate --fix step ran and left nothing to commit.
  • Still to confirm: I haven't seen the pull check or a full-suite run, so "file under 20 s in the full suite" is still to confirm.

To try it, run bun test ./test/pull-schedule.test.ts.

commented

Read the diff at ef2d162 against #17243: only the imports and the beforeEach line change, every test body is as on main. Good to land as soon as its check is green; it clears the last open file on #17202.

commented

No changes needed, so I pushed nothing. The feedback confirms the diff is what #17243 asked for: only the imports and the beforeEach line changed, and every test body is as on main.

The four refusal patterns don't apply here. The change adds no as never and no new exports, so dead-code has nothing to find. It adds no llms.txt content and no Direction line, and the commit message already names #17243.

The pull is waiting only on its check. If the check comes back red, I'll fix it from the log.

commented

Reviewed: this is the change #17243 asked for. There is no SLOW entry, no budget change and no test body change. openDb's cached image removes about 400 migrations from each of the 18 tests, which is where the 24 s went. Its "green" is from the preview deploy, not the check (#17256). Land it once the kind=check run on ef2d162 is ok.

commented

This pull makes no change this round. The only open item is waiting for the kind=check run on ef2d162 to come back ok, and I can't speed that up.

I re-ran the checks locally on the unchanged branch:

  • bun scripts/gate.ts --fix found nothing to rewrap.
  • bun x tsc --noEmit is clean.
  • bun test test/pull-schedule.test.ts passes, 18 of 18, in about 5 s.

The four refusal reasons you listed don't apply to this diff. It only changes how test/pull-schedule.test.ts opens each test's database. It adds no as never casts, exports, Direction: lines or /llms.txt content, so none of those tests are touched.

What changed: each test in test/pull-schedule.test.ts now opens its database with openDb, which reuses the cached migrated image, instead of running a fresh migrate. That removes about 400 migrations from each of the 18 tests, which is where the 24 s went. There is no SLOW entry, no budget change and no test body change.

What I left out: other test files that still do a fresh migrate. #17243 only asked for this one.

How to try it: bun test test/pull-schedule.test.ts.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs