Skip to content

Run persistence DB tests on PGlite; keep concurrency tests on real Postgres - #37

Merged
yashau merged 1 commit into
mainfrom
claude/pglite-db-tests-385851
Jul 12, 2026
Merged

Run persistence DB tests on PGlite; keep concurrency tests on real Postgres#37
yashau merged 1 commit into
mainfrom
claude/pglite-db-tests-385851

Conversation

@yashau

@yashau yashau commented Jul 12, 2026

Copy link
Copy Markdown
Owner

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() + a pglite:// URL registry in createDatabase(). PGlite is loaded via dynamic import, so the production postgres-js path never loads WASM. Added @electric-sql/pglite devDep and "types": ["node"].
  • 6 persistence tests → PGlite (no more skips, now in the default node:test suite): bigint chunk size, per-channel room persistence, OIDC group collision, login constraint, OIDC user linking, access-tx rollback.
  • Concurrency harness (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 the node:test-db harness's db:migrate.
  • Reconciled AGENTS.md, testing/data-model/tasks/development docs, and the checked OIDC baseline.

Verification (local)

  • node:check (tsc, all packages) ✅
  • API tests: 651 pass / 0 fail / 11 skip (9 concurrency subtests via node:test-db + 2 pre-existing unrelated opt-ins) · Web: 163/0
  • node:test-db against 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

…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]>
@yashau
yashau merged commit 82f7406 into main Jul 12, 2026
1 check passed
@yashau
yashau deleted the claude/pglite-db-tests-385851 branch July 12, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant