Repository navigation
Composer runs on Prisma ORM 8.0.0-rc.23 and prisma 8.0.0-rc.31 - #423
Conversation
The prisma 8.0.0-rc.31 CLI bundles @prisma/orm-toolchain 8.0.0-rc.22, which refuses rc.20 contracts, so an app on Composer 0.37.0 and that CLI fails npm install on the exact rc.20 peer. @prisma/cli-engine stays at 0.9.0, the version orm-toolchain rc.22 peers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The widget and packed-contract fixtures used the field presets that rc.21 removed (field.id.uuidv4String(), field.text()). They now write field.column(type.UuidString()).id().onCreate(gen.uuid()) and field.column(type.String()), which emit the same contract. gen is the module export, because the defineContract callback types its gen as GeneratorHelpersOf<unknown> when the scaffold passes extensions: {}.
Older migration snapshots and the auth empty-app fixture imported Interval, Time, Timestamp and Timestamptz, which rc.21 no longer exports. The imports drop them, as branded-time-types-removed says.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Every storage hash stays the same, the auth pack's included (24a0762…). contract.d.ts gains the aggregate rows for the codecs rc.21 and rc.22 added, and examples/auth's contract.json records the auth pack at version 0.37.0. The auth pack's snapshot in examples/auth gets the new contract.d.ts, as scripts/lint-contract-snapshots.mjs requires. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
|
✅ Gizmo reviewed ba8100d — posted 1 inline comment(s) this pass. Open findings: 🟡 3 minor Change walkthroughChange walkthroughThis delta moves the repo's Contract re-emit gate. scripts/emit-contracts.mjs discovers contracts by scanning tracked Empty-app fixture relocation. The empty-app contract source, config, and both emitted files now live together under execution/empty-app/ as an ordinary emit target, config shape matching the auth pack's existing config. Both importers (local-schema.ts and the pack-conformance test) were updated; a repo-wide grep found no stale references to the old paths. The relocated Verification run in this sandbox: |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
commit: |
rc.22 refused to create a client when two copies of the ORM were loaded, and every Composer service loads two: the wrapper main.mjs and the app. rc.23 removes that check (prisma/orm#30961). The prisma host stays at 8.0.0-rc.31, which bundles orm-toolchain rc.22; no published prisma CLI bundles rc.23 yet. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Storage hashes do not change. Each contract gains the Postgres target's new insertOnConflictTarget capability. The auth pack's snapshot in examples/auth gets the same contract.json and contract.d.ts, so its copies still agree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was a problem hiding this comment.
New findings: 🟡 1 minor · trace
Findings outside the diff
- 🟡 Minor · consistency packages/1-prisma-cloud/2-shared-modules/auth/src/tests/fixtures/empty-app/emitted/contract.d.ts — empty-app fixture was hand-edited instead of re-emitted; its committed types no longer match the pinned toolchain's output
The fixture's header saysGENERATED FILE - DO NOT EDIT, but this PR hand-patches it (drops the four removed type imports) instead of re-emitting it with the pinned orm-toolchain 8.0.0-rc.23. Its committed emitted types — theAggregateTypescodec domain in particular — therefore no longer match what the toolchain this repo pins actually emits, while the rest of the PR's emitted artifacts were fully regenerated for exactly that reason. The drift is invisible to the repo's own guard: scripts/lint-contract-snapshots.mjs groups copies by acontract.jsonbeside the.d.ts, and this fixture directory contains only the.d.ts, so nothing re-derives it. If the fixture is ever regenerated in place, the diff will be a full-file churn that reviewers may mistake for unexplained drift.
Recommended fix: Re-emitpackages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/fixtures/empty-app/emitted/contract.d.tsfrom an empty app scaffold with orm-toolchain 8.0.0-rc.23 (as the PR did for the gadget/widget fixtures), or record in the fixture why re-emission is not possible so the next full re-emit diff is not mistaken for drift.
…t, and CI checks it The auth module's empty-app contract was hand-edited in this PR instead of re-emitted: its config was named prisma-next.config.ts, so the re-emit sweep missed it, and its emitted contract.json lived apart from its .d.ts, so lint-contract-snapshots never compared them. It is now one ordinary emit target under execution/empty-app/, re-emitted with prisma 8.0.0-rc.32, the first CLI that bundles orm-toolchain 8.0.0-rc.23 (the catalog pin moves to it). pnpm contracts:emit re-emits every committed contract and formats the output as a commit does. pnpm check:contracts-emitted runs it in CI and fails when a committed contract differs, so a missed contract or a hand edit fails CI. The emitted-contracts rule says so, and that an upgrade recipe's edit to a contract.d.ts applies only to frozen migration snapshots. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The examples' prisma.config.ts files import the built @prisma/composer-prisma-cloud, which that job had not built. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
| alwaysApply: false | ||
| --- | ||
|
|
||
| # Emitted contracts come from `pnpm contracts:emit` |
There was a problem hiding this comment.
🟡 Minor · conventions — Rule omits that pnpm contracts:emit needs workspace packages built first
The rule tells contributors to run pnpm contracts:emit after any pin or contract-source change, but the examples' configs import built workspace packages (@prisma/composer/config, @prisma/composer-prisma-cloud/auth/pack — see the comment this PR added to .github/workflows/ci.yml:297). On a fresh checkout (or after changing a pin, which is exactly when the rule says to run it) the emits fail with unresolvable or stale dist imports unless pnpm turbo run build --filter '@prisma/composer-prisma-cloud...' (or a full build) runs first. CI works around this, but a contributor following only this rule hits a confusing failure that looks like the emit tooling is broken. The doc should state the prerequisite.
Recommended fix
Add a sentence to the rule, e.g. "The examples' configs import the built packages — run pnpm turbo run build --filter '@prisma/composer-prisma-cloud...' first (CI does this)."
There was a problem hiding this comment.
pnpm contracts:emit now builds the extension packages itself, so it works on a fresh checkout and CI runs it with no separate build step; the rule needs no prerequisite.
🤖 Addressed by Claude Code
There was a problem hiding this comment.
That removes the premise of the finding — if pnpm contracts:emit self-builds the extension packages, there's no prerequisite worth documenting, and a fresh checkout works as-is. The doc is fine as written; this thread can be resolved.
| .filter((file) => file !== '') | ||
| .map((config) => { | ||
| const source = readFileSync(join(root, config), 'utf8'); | ||
| const output = /output:\s*'([^']+)'/.exec(source)?.[1] ?? '.'; |
There was a problem hiding this comment.
🟡 Minor · error-handling — A contract whose output: is not a single-quoted literal is silently skipped by the emit sweep and the CI check
The sweep reads each config's output directory with /output:\s*'([^']+)'/.exec(source)?.[1] ?? '.' (line 26) and then only checks a config whose parsed output dir holds a tracked contract.json (lines 30-34). A config that spells output any other way — double quotes, a template literal, a spread from a helper — silently falls back to '.', the tracked.has(...) gate then drops it, and both pnpm contracts:emit and the CI check report green while never emitting or verifying that contract. This is the same class of silently-missed contract the PR's own root-cause analysis calls out (the empty-app contract was missed because its config was named differently). All current configs use single-quoted literals, so nothing is skipped today, but the guard gives false confidence the first time one isn't.
Recommended fix
When a config contains @prisma/orm-postgres/config but the regex finds no output: literal, fail (or at least print the config as skipped) instead of silently defaulting to '.', so an unparseable config surfaces as a loud gap in coverage rather than a silent skip.
There was a problem hiding this comment.
A config with an output the script cannot read as a single-quoted path now fails the run, and every ORM config without a committed contract is printed as skipped.
🤖 Addressed by Claude Code
…annot read The script builds the extension packages the examples' configs import, so `pnpm contracts:emit` works on a fresh checkout and CI runs it alone. A config whose `output` is not a single-quoted path now fails instead of being skipped, and an ORM config without a committed contract is listed as skipped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was a problem hiding this comment.
New findings: 🟡 1 minor · trace
Still open from previous reviews: 🟡 2 minor
| ] | ||
| .join('') | ||
| .trim(); | ||
| if (changed !== '') { |
There was a problem hiding this comment.
🟡 Minor · error-handling — --check misses a hand-edited contract that has been staged
git diff --name-only compares the worktree to the index. If a developer hand-edits an emitted contract.json/contract.d.ts and stages the edit (e.g. via git add -A before running the check), the worktree matches the index, the drift is invisible, and --check passes locally. CI still catches it on a fresh checkout, but the gate's stated purpose is to catch hand edits before they are committed. Comparing against HEAD covers staged and unstaged edits alike and behaves identically in CI.
Recommended fix
| if (changed !== '') { | |
| run('git', ['diff', '--name-only', 'HEAD', '--', ...emitted]), |
There was a problem hiding this comment.
No change: the check re-emits before it compares, so a staged hand edit is overwritten in the worktree and git diff (worktree against index) shows it. I checked this case: staging an added line in an emitted contract.d.ts makes --check fail. Comparing against HEAD would also flag correct, staged re-emits that are not yet committed.
🤖 Addressed by Claude Code
There was a problem hiding this comment.
You're right, and I withdraw the finding. The re-emit at scripts/emit-contracts.mjs:50 overwrites the worktree with canonical output before the comparison at scripts/emit-contracts.mjs:58, so a staged hand edit resurfaces as an index-vs-worktree diff and fails the check. Your point against comparing to HEAD also stands — it would flag legitimate re-emits that are staged but not yet committed. This thread can be resolved.
Moves Composer to Prisma ORM
8.0.0-rc.23and theprismaCLI8.0.0-rc.31.Every committed contract is emitted, and CI checks it
An earlier commit on this branch hand-edited the auth module's empty-app
contract.d.tsinstead of re-emitting it. Its config was namedprisma-next.config.ts, so the re-emit sweep missed it, and itscontract.jsonlived apart from the.d.ts(execution/empty-app-contract.json), solint-contract-snapshotsnever compared them. Fixed at the root:packages/1-prisma-cloud/2-shared-modules/auth/src/execution/empty-app/(source, config and both emitted files), re-emitted.pnpm contracts:emit(scripts/emit-contracts.mjs) re-emits every committed contract: eachprisma.config.tsthat configures the ORM and whose output directory holds a committedcontract.json. It formats the output as a commit does.pnpm check:contracts-emittedruns it in CI and fails when a committed contract differs from what the pinned toolchain emits. Checked: it passes on this branch and fails when a line is added to an emittedcontract.d.ts..agents/rules/emitted-contracts.mdcsays to run it after any ORM orprismapin change and never to edit an emitted contract. An upgrade recipe's edit to acontract.d.tsapplies only to frozen copies undermigrations/snapshots/<hash>/.What changes for users
Composer 0.37.0 peers
@prisma/orm-postgresat exactly8.0.0-rc.20. The currentprismaCLI,8.0.0-rc.31, bundles@prisma/orm-toolchain8.0.0-rc.22, which refuses rc.20 contracts. So a new create-prisma app on Composer 0.37.0 andprismarc.31 failsnpm installwithERESOLVE, and with the peer bypassed it failsprisma contract emit.After this change, an app upgrades like this:
{ "dependencies": { "@prisma/composer": "0.38.0", "@prisma/composer-prisma-cloud": "0.38.0", "@prisma/orm-postgres": "8.0.0-rc.23" }, "devDependencies": { "prisma": "8.0.0-rc.31" } }@prisma/composerand@prisma/composer-prisma-cloudto 0.38.0 (the release this PR goes into),@prisma/orm-postgresto8.0.0-rc.23, andprismato the first release that bundles@prisma/composer-cli0.38.0. The CLI and the app's Composer packages must be on the same version. Onlyprisma8.0.0-rc.31 was tested here; it emits the same files as an rc.23 toolchain for every contract (checked below).prisma skills sync, then the guides under.agents/skills/prisma-8/upgrading/app/upgrades/). The ones most likely to matter on Postgres:field.id.uuidv4String()andfield.text().DateTime,DateandTimenew meanings on Postgres.SmallInt,BigIntNumber,Numeric,UnboundedInt,Real,VarCharandVarBit, and renames the column helpersint8ColumnandnumericColumn.postgres()refusesnullor an empty string asurl,pgorbindingwhen it is called. Composer builds its clients with apgPoolbinding over a URL it requires, so a Composer service is not affected.Changes
@prisma/orm-postgresand@prisma/orm-toolchain8.0.0-rc.20→8.0.0-rc.23in all seven manifests (11 pins, including the peer ranges of@prisma/composer-prisma-cloud). The catalog'sprismahost8.0.0-rc.26→8.0.0-rc.31.@prisma/cli-enginestays0.9.0: orm-toolchain rc.22 and rc.23 peer0.9.0, andprismarc.31 depends on it.ts-field-presets-removed(rc.21). The widget and packed-contract fixtures in@internal/prisma-cloudusedf.id.uuidv4String()andf.text(). The detection did not match them, because it looks forfield.and the fixtures call the helperf;prisma contract emitrefused them withCONTRACT.FIELD_HELPER_UNKNOWN. They now writef.column(t.UuidString()).id().onCreate(gen.uuid())andf.column(t.String()), and emit the same storage and execution hashes.genis imported from@prisma/orm-postgres/contract-builder, because thedefineContractcallback types itsgenasGeneratorHelpersOf<unknown>when the scaffold passesextensions: {}.branded-time-types-removedandinterval-with-precision-typed-as-parts(rc.21). Four older migration snapshots and the auth package'sempty-appfixture importedInterval,Time,TimestampandTimestamptz, which rc.21 no longer exports. Their imports drop those names.contract-types-list-new-aggregates(rc.21),contract-emit-pins-pack-files(rc.22) andcontract-artifacts-restamp(rc.21, rc.22, rc.23): covered by the re-emit below. The re-emit wrote no new files undermigrations/.one-orm-version(rc.22): every@prisma/orm-*pin is the same version. The lockfile also holds orm-toolchain and orm-framework rc.22, which theprismarc.31 host brings.close-ends-the-client-not-your-pool(rc.21) matches Composer's ownpostgres({...})node, and nothing capturesdb.runtime().iso-string-date-time-values(rc.21) matches codec IDs and@default(now()), not literal defaults;examples/store's orders service already passesplacedAtthroughnew Date(...).date-style-iso-required(rc.21) matchesnew pg.Pool(andnew pg.Client(; nothing setsDateStyle.postgres-checks-database-input(rc.23) matchesurl: nullinprisma deploy listandprisma emulator listrows, which are notpostgres()inputs. Composer's own client (packages/1-prisma-cloud/1-extensions/target/src/orm-postgres.ts) passesbinding: { kind: 'pgPool', pool }; the auth module usespgdirectly.pnpm contracts:emitwithprisma8.0.0-rc.32, the first CLI that bundles orm-toolchain 8.0.0-rc.23 (the catalog'sprismapin moves to it) withprisma8.0.0-rc.31 using orm-toolchain 8.0.0-rc.23 (installed in a scratch folder with an npm override), and the output matches what the plain rc.31 CLI writes. No storage hash changes.contract.d.tsgains rows for the codecs rc.21 and rc.22 added, every contract gains rc.23'sinsertOnConflictTargetcapability, andexamples/auth/contract.jsonrecords the auth pack at version0.37.0. The auth pack's snapshot inexamples/auth/migrations/snapshots/24a0762…/gets the newcontract.jsonandcontract.d.ts, solint-contract-snapshotsstill finds its copies equal. The other example snapshots are older emits of the same storage (same storage hash as their project's current contract), which the ORM accepts, so they keep their own files.24a0762cac2c89426d118c9a9a81876ebcf32eba11789722d7c907ba710dc60dexamples/auth0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599examples/orm-demo175be57590fa5824e15c09338d2e8c3fd18a5d96d8cf804d8e86eff38010e7eeexamples/storecatalog6db9c25a3e2e1fcaa023871b01a2b5e9180ad55f6c5be50d8f66113b098723f7examples/storeorders37a51f5613ada855a5cfabe9b5b25d154acf46e13ffd472c047817d8e42e363369ac5b6eeae1468b57bb3b8ee3236f95411726d2c0c9f2deb83c98addc0dc79c4ac61af81be17e9f549065e62bbcf92fff553d2844ef1f340c1bed33af837d82Checks run locally
pnpm buildandpnpm typecheck(80 tasks andtypecheck:scripts) pass.lint,lint:casts,lint:deps,test:scripts,check:orm-pins,check:family-static-graph,check:floor-imports,lint:retired-binary-name,lint:control-bytes,lint:rules:symlinks,check:cli-engine-pin,check:publish-deps,check:npm-effect-resolutionandcheck:skill-packagingpass.@internal/prisma-cloud: 616 tests and its type tests pass.@internal/auth: 132 tests pass.examples/auth: 3 tests pass.@internal/cli: 480 tests pass.@store/storefront: 1 test passes. The Postgres tests ran against a local Postgres throughSTATE_TEST_DATABASE_URL, because this machine had no shared memory left for the test harness to start its own.test/integration:bun testpasses (5 tests).bun run test/local-dev-store.integration.ts, with its own emulators directory, passes:PASS: local dev (S5 proving) — examples/store, criteria 1/2/3/6.Agent: saruman-67
🤖 Generated with Claude Code