You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- pgsql-client: add registerPgClientFactory/defaultPgClientFactory seam
(mirror of pg-cache pool seam); PgClient routes its underlying client
through it. Default = new pg.Client, fully backward-compatible.
- pglite-adapter: extract shared query runner; add createPgliteClient so
the same in-process session backs both pool and client seams.
- pglite-test: new drop-in getConnections backed by in-process PGlite
(no server/createdb/psql). SharedTxn ref-counts transaction control so
the standard two-client beforeEach/afterEach savepoint harness works
over one PGlite session. Seeds via seed.pgpm(). 5 tests: deploy, per-test
isolation, RLS role/JWT switching incl. WITH CHECK.
- CI: add postgres/pglite-test to the no-services unit-tests (pglite) batch.
Copy file name to clipboardExpand all lines: poc/pglite/DESIGN.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,9 +175,11 @@ single-writer backend, but is not required for this rollout.
175
175
176
176
1.**`pg-cache` driver seam + registry** (default = pg; zero behavior change). ✅ **DONE** — `registerPgPoolFactory` / `defaultPgPoolFactory`, 19 unit tests, CI green.
177
177
2.**`@pgpmjs/pglite-adapter`** (in-process driver, all pglite deps here). ✅ **DONE** — `registerPglite()` registers a PGlite-backed `QueryablePool`; 6 tests deploy→verify→revert an unmodified pgpm plan into in-process PGlite (no socket), with `useTransaction: true`.
178
-
3.**`pglite-test`** drop-in `getConnections` (instance-per-test). Needs a matching client-factory seam in `pgsql-client` + a PGlite-aware admin, because `pgsql-test` bypasses `pg-cache` (`new Pool`/`new Client` directly + `createdb`/`psql`).
179
-
4. Convert this PoC's CI job to use the adapter instead of the socket shim.
178
+
2b. **`pgsql-client` client-factory seam** (default = `new pg.Client`; zero behavior change). ✅ **DONE** — `registerPgClientFactory` / `defaultPgClientFactory` / `getActivePgClientFactory`, mirroring the `pg-cache` pool seam; `PgClient` routes its underlying client through it; 4 unit tests. Needed because `pgsql-test`/`pgsql-client` build `pg.Client`s directly rather than via `getPgPool`.
179
+
3.**`pglite-test`** drop-in `getConnections` (instance-per-suite). ✅ **DONE** — composes `registerPglite()` (pool seam) + `registerPgClientFactory` (client seam) so `pg`/`db` share one in-process PGlite session; a `SharedTxn` ref-counter keeps the standard two-client `beforeEach`/`afterEach` savepoint harness working over a single session; seeds via `seed.pgpm()`; no `createdb`/`psql`. 5 tests cover deploy, per-test isolation, and RLS role/JWT switching (incl. `WITH CHECK`). No separate PGlite-aware `DbAdmin` subclass was needed — the instance *is* the database and extension/role bootstrap runs via `pglite.extensionSql`.
180
+
4. This PoC's socket-shim CI job (`pglite-poc.yaml`) is **kept as-is** — it's a standalone, out-of-workspace demonstration of the `pg-gateway` wire-protocol path (own lockfile, published `@pgpmjs/core`). The canonical in-process path is now proven by the `@pgpmjs/pglite-adapter` and `pglite-test` jest suites in `run-tests.yaml` (no-services tier).
180
181
5. (Optional) Core transaction-client fix — only if a *multi-connection* single-writer backend is ever targeted; the in-process adapter does not need it.
182
+
6. (Future) `pgpm init --pglite` scaffolder — CLI-layer convenience; no PGlite dep in core.
181
183
182
184
Each shipped step is independently testable; only step 1 touches core, and it adds
183
185
no PGlite dependency to it. All `@electric-sql/pglite*` deps live in
0 commit comments