Repository navigation
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
@tanstack/cms-api
@tanstack/cms-cli
@tanstack/cms-client
@tanstack/cms-compat-wp
@tanstack/cms-connect-atproto
@tanstack/cms-migrate-wp
@tanstack/cms-skills
@tanstack/cms-core
@tanstack/cms-media-s3
@tanstack/search-ai
@tanstack/search-cms
@tanstack/search-core
@tanstack/search-headless
@tanstack/search-ui-react
@tanstack/cms-store-postgres
@tanstack/cms-ui-dom
@tanstack/cms-ui-react
commit: |
Measured: a PGlite VM costs ~400ms to boot (WASM + baked catalog) while the CMS migrations on top are only ~13ms — so the test cost was dominated by booting a fresh VM per `defineCms`, not by schema work. The `@tanstack/cms-store-postgres/testing` setup now shares ONE in-memory VM per process and gives each config an isolated schema via a table prefix keyed by its resolved data dir. This mirrors the old embedded default's semantics exactly (same dataDir shares — so close+reopen still sees its data — distinct dataDirs isolate), but pays the 400ms boot once instead of per config. A passed-in pool isn't closed by storage.close(), so the shared VM survives per-config teardown. Result: core 48s→28s, api ~26s→5.5s; no test changes needed. app/base keeps on-disk persistence via the new `./testing-disk` variant — its recover-owner test spawns a subprocess that reads the database file, which an in-memory VM can't serve. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
85acc20 to
0ef0fae
Compare
|
Superseded by #68, which flattens this stack into a single PR against |
What
Cuts test-suite wall-clock by sharing one PGlite VM across tests instead of booting a fresh one per
defineCms.Why (measured, not guessed)
Benchmarked PGlite on this machine:
PGlite.create()≈ 400ms every instance (WASM VM boot + baked Postgres catalog load; ~150ms of that is one-time WASM compile per process).So the flaky/slow CI wasn't schema work or our code — it was booting a 400ms VM for every
defineCmsacross ~54 test files, serially (VITEST_MAX_WORKERS=1). A pre-migrated snapshot wouldn't help; the cost is per-VM-boot.How
@tanstack/cms-store-postgres/testing(the vitestsetupFilesthat restores the embedded engine for tests) now:dataDir.This reproduces the old embedded default's semantics exactly — same
dataDirshares a schema (so close + re-defineCmsstill sees its data, which the cross-restart tests rely on), distinctdataDirs are isolated — so no test files changed.createPostgresStoragealready skipspool.end()for a passed-in pool, so the shared VM survives per-configstorage.close().app/basekeeps real on-disk persistence via a new./testing-diskvariant: itsrecover-ownertest spawns a subprocess that reads the database file, which an in-memory VM can't serve.Result
@tanstack/cms-core@tanstack/cms-apiFull
test:libgreen across all 24 projects; core 661/661; sherif clean. Beyond the speedup, the headroom directly relieves the 20s-per-test timeout flakes.Notes
feat/capability-seams(refactor: inject AI / code-mode / MCP / storage as opt-in capabilities (bundle-time seams) #66) — it introduced thetestingsetup module this builds on.🤖 Generated with Claude Code