Run persistence DB tests on PGlite; keep concurrency tests on real Postgres - #37
Merged
Conversation
…stgres Persistence/round-trip DB tests previously skipped whenever no Postgres was reachable. Route them through an in-process PGlite (WASM Postgres) so they run everywhere with no server, and keep the concurrency/race tests on a real Postgres (single-connection PGlite serializes transactions and cannot reproduce row-lock / atomic-CAS contention). - @rakkr/db: add createPgliteDatabase() + a pglite:// URL registry in createDatabase(); PGlite is dynamically imported so the production postgres-js path never loads WASM. Add @electric-sql/pglite devDep and node types. - Convert 6 persistence tests to createPgliteDatabase() (no skip): bigint chunk size, per-channel room persistence, OIDC group collision, login constraint, OIDC user linking, access-tx rollback. - run-db-integration-tests.mjs now runs the 8 concurrency/race tests only, and picks up the two previously-orphaned races (recording-job-claim-atomic, oidc-race-conflict) that ran nowhere before. - db:verify replays migrations against PGlite (no Docker); real-server migration application still runs in CI via the node:test-db harness. - Reconcile AGENTS.md, testing/data-model/tasks/development docs, and the checked OIDC baseline. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Persistence/round-trip DB tests previously skipped whenever no Postgres was reachable (Windows dev, no Docker). This routes them through an in-process PGlite (WASM Postgres) so they run everywhere with no server — while keeping the concurrency/race tests on a real Postgres, because single-connection PGlite serializes transactions and cannot reproduce row-lock / atomic-CAS contention (a race test on PGlite would pass even with the production lock removed).
Changes
@rakkr/db:createPgliteDatabase()+ apglite://URL registry increateDatabase(). PGlite is loaded via dynamic import, so the production postgres-js path never loads WASM. Added@electric-sql/pglitedevDep and"types": ["node"].node:testsuite): bigint chunk size, per-channel room persistence, OIDC group collision, login constraint, OIDC user linking, access-tx rollback.run-db-integration-tests.mjs) now runs the 8 race tests only, and picks up two previously orphaned races that ran nowhere before:recording-job-claim-atomic,oidc-race-conflict.db:verify→ PGlite (no Docker). Real-server migration application still runs in CI via thenode:test-dbharness'sdb:migrate.Verification (local)
node:check(tsc, all packages) ✅node:test-db+ 2 pre-existing unrelated opt-ins) · Web: 163/0node:test-dbagainst real Postgres: 12/0 (incl. both de-orphaned races)db:verify(PGlite, no Docker) ✅ ·auth:check-oidc·check:loc·oxlint·oxfmt --check✅🤖 Generated with Claude Code