fix(local): pin and own the @prisma/dev the local Postgres emulator runs on - #298
Conversation
…uns on Any Postgres message over 64 KiB killed the local emulator: the published @prisma/composer-prisma-cloud never declared @prisma/dev, and the local target resolved it from the application, so apps got whatever copy alchemy's ^0.20.0 range dragged in — a release whose pglite-socket hands each raw TCP chunk to PGlite as a whole message. The migration runner's contract snapshot crosses that size early, after which every connection is refused. - @prisma/composer-prisma-cloud and @internal/local-target declare @prisma/dev ^0.25.2 as a runtime dependency. - The local target resolves @prisma/dev from Composer's own package only; the application fallback is gone, and the not-installed error says to reinstall instead of adding devDependencies. - Regression test: a 100 KiB bind parameter round-trips through the emulator and a second connection still works. It fails against @prisma/dev 0.20.0. - scripts/check-prisma-dev-pin.test.mjs keeps the public manifest, the local target, and the emulator tests on one range, never below 0.21.0. - The stale-record test excludes every registry-claimed port via registryClaimedPorts (it skipped streams ports and tripped on a developer machine's records). - Skill and running-locally guide say which @prisma/dev the emulator uses. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
✅ Gizmo reviewed edcc39e — posted 0 inline comment(s) this pass. Open findings: none Change walkthroughChange walkthroughThis PR makes Composer the owner of the Dependency ownership. packages/9-public/composer-prisma-cloud/package.json:46 and local-target/package.json:21 now declare Tests. postgres.test.ts adds a live regression test — a 100 KiB bind parameter round-trips and a second connection still works — plus the module-resolution suite rewritten to assert Composer-owned, cwd-independent resolution. The stale-record port test now reuses Guard rail. check-prisma-dev-pin.test.mjs runs under Docs. The running-locally guide and the core-concepts skill drop the "add |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: Comment |
commit: |
The regex only matched two-digit minors, so a legitimate bump to 0.100.0 would have failed the guard with an unhelpful TypeError. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Problem
prisma devcrashed the local Postgres emulator on any message over 64 KiB (Connection terminated unexpectedly, then every later connection refused). The migration runner writes each contract snapshot as one jsonb bind parameter, so any app whose snapshot passes 64 KiB could no longer migrate locally (prisma/askshit it at its second migration).The defect is in
@electric-sql/pglite-socket0.0.20, which@prisma/dev0.20.0 depends on; every@prisma/devfrom 0.21.0 has the fix. Composer's published package never declared@prisma/devand resolved it from the application, so apps got whatever copy alchemy's^0.20.0range pulled in (or none at all under pnpm's isolated linker).Change
@prisma/composer-prisma-cloudand@internal/local-targetdeclare@prisma/dev ^0.25.2as a runtime dependency.@prisma/devfrom Composer's own package only. The application fallback is removed: Composer owns the emulator version, and an app's transitive copy must not replace it. The not-installed error now says to reinstall rather than add devDependencies.dev-emulators: a 100 KiB bind parameter round-trips and a second connection still works. Verified it fails against@prisma/dev0.20.0 with the reportedConnection terminated unexpectedly.scripts/check-prisma-dev-pin.test.mjs(runs underpnpm test:scriptsin CI) keeps the public manifest, the local target, and the emulator tests on one range and never below 0.21.0.registryClaimedPorts; it previously skipped streams ports and failed on a developer machine with such a record.@prisma/devthe emulator uses.Verification
@internal/local-targetand@internal/dev-emulatorssuites,pnpm test:scripts,pnpm lint:deps, typecheck: green.@prisma/composer-prisma-cloud,prisma8.0.0-rc.13 andpg, installed under bothnode-linker=hoistedandnode-linker=isolated, resolves@prisma/dev0.25.2 from Composer's package (under isolated the app has no@prisma/devof its own) and round-trips a 100 KiB parameter.lib/Prisma/PrismaDevDatabase.js; the local target'sLocalDatabaseProviderreplaces alchemy'sPrisma.Databaseprovider, so no alchemy issue is needed.Follow-up in
prisma/asksAfter this ships: upgrade Composer, delete
patches/@electric-sql__pglite-socket@0.0.20.patchand itspatchedDependenciesentry, and drop the gotcha.🤖 Generated with Claude Code