Skip to content

chore: upgrade Prisma Next to the @prisma/* 8.0.0-rc.1 packages - #212

Merged
wmadden-electric merged 8 commits into
mainfrom
claude/prisma-upgrade-8-0-0-02d808
Aug 9, 2026
Merged

wmadden-electric merged 8 commits into
mainfrom
claude/prisma-upgrade-8-0-0-02d808

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Prisma Next moved into the prisma/prisma monorepo and its npm packages were renamed and regrouped. This upgrades Composer from @prisma-next/* 0.16.0 to @prisma/orm-* 8.0.0-rc.1, following the prisma-next-upgrade and prisma-8-extension-upgrade skills from that repo. Two commits, one per release step: 0.16 → 0.17, then 0.17 → 8.0.0-rc.1.

What the rename means for us

The old scope published one npm package per internal package. From 0.17 there are 16 published @prisma/orm-* "shells", and each old package became a subpath of exactly one of them. An application depends on a single database facade; a package that extends the framework depends on the platform shells (ADR 242).

Composer is both kinds of consumer, so the manifests split:

Package Depends on
examples/* (apps) @prisma/orm-postgres only — the facade carries the CLI bin and republishes every surface an app reaches
@internal/prisma-cloud, @internal/auth @prisma/orm-postgres + @prisma/orm-toolchain (config loader, CLI, migration tools)
@prisma/composer-prisma-cloud @prisma/orm-toolchain as a dependency; @prisma/orm-postgres as a peer dependency

The peer dependency is the one deliberate change of shape. @prisma/composer-prisma-cloud ships an extension pack that consumers register in their own prisma-next.config.ts, and the pack is registered against the app's copy of the target. A hard dependency would let an app upgrade the facade without upgrading Composer and end up with two copies of the ORM — the codec and operation registries silently diverge and instanceof stops holding. As a peer, that combination fails to install instead. This is what the extension-author upgrade skill prescribes and what Prisma's own packs (@prisma/orm-extension-pgvector and friends) do. ADR-0022's consequences section is updated to say so.

Import specifiers follow the same split — @prisma-next/sql-contract/types becomes @prisma/orm-postgres/family-contract/types, @prisma-next/config-loader becomes @prisma/orm-toolchain/config-loader, and so on. The emitter independently produced exactly the same facade specifiers when the contracts were regenerated, which is a good cross-check: emission reads each project's own manifest to decide which names generated code may carry.

Breaking changes applied

Content hashes are bare hex. The sha256: prefix is gone from every surface and loaders now reject the prefixed form. The skill's codemod handled the committed migration trees; test literals and one per-space contract snapshot the codemod does not reach were done by hand. migrationHash values change because the hashed bytes embed the now-bare from/to.

Migration contract snapshots moved into a content-addressed store. The per-package end-contract.json/.d.ts siblings and the per-space head copy fold into migrations/snapshots/<hex>/, one entry per distinct contract. Done with scripts/migrate-migrations-layout.mjs from the prisma/prisma checkout.

extensionPacks → extensions, in the config, the control-client options, the TS builder's defineContract, and the emitted contract's top-level key. Composer's own field of the same name follows, so the vocabulary stays consistent end to end. Also outputPath → output.

PostgreSQL native types are authored in type position. The auth pack's Tstz = DateTime @db.Timestamptz becomes Tstz = Timestamptz. The stored column type does not change.

Indexes are name-identified. Every index entry now carries name and unique. Our three index names are author-owned rather than toolchain-generated, so no physical name changed and no index is rebuilt.

A generator default no longer picks a column's storage. Pre-0.17, String @id @default(uuid(4)) re-picked the column to character(36); from 0.17 the type position is the only storage decider, so it emits text. This changes the DDL for Widget.id in pn-widgets and Order.id in store/orders:

- "id" character(36) NOT NULL,
+ "id" text NOT NULL,

text is accepted rather than pinned back with Char(36) @default(uuid(4)), because these are example apps with no deployed database and text is the better column for a UUID — character(n) blank-pads and compares with padding. An application that has this schema deployed must not take that silently: pin the old storage in the type position, or plan a real migration. The store/catalog tree is unaffected (its ids are author-supplied), and the auth pack is unaffected (its ids are plain String).

Aggregate results carry their target's codec (the only 0.17 → rc.1 breaking change). count() is a bigint on PostgreSQL, integer averages are decimal strings. Nothing in this repo calls an aggregate, a groupBy, or an include reducer, so there was nothing to translate; regenerating the contracts adds the AggregateTypes block the ORM and SQL builder now resolve result types from.

Re-emission and re-anchoring

Every contract space was re-emitted. The extensions key and the index shape sit in the canonicalized bytes, so every storage hash moved at 0.17 and every migration tree had to be re-anchored — a re-baseline, since each is a single from: null init migration.

The regenerated DDL is not identical everywhere, and the differences are worth reading before merging:

Tree DDL change
examples/auth, auth pack none — 38 SQL statements byte-identical
store/catalog params: [] added to CREATE INDEX (a 0.17 normalisation), plus a leading CREATE SCHEMA IF NOT EXISTS "public"
pn-widgets, store/orders the above, plus id moves from character(36) to text (see the generator-default entry above)

Because these are re-baselines rather than hash-advances, a database already signed at an old head does not converge from the new tree: its marker matches neither the new ref nor null, so planning fails with MIGRATION_PATH_NOT_FOUND. That is a loud failure rather than a silent one, but it is a dead end — anything deployed against the old heads needs a hand-authored advance. This matters most for the auth pack, whose migrations ship to downstream consumers we cannot see; its DDL is provably unchanged, so a no-op hash-advance edge would have been the cheaper option and is worth considering before this merges.

At 8.0.0-rc.1 no storage hash moved, so nothing needed re-anchoring in the second commit — which is exactly how the snapshot type files went stale (see below).

Two small enabling changes came out of this:

  • The auth pack's prisma-next.config.ts now names migrations: { dir: './src/pack/migrations' }, and the widget/gadget fixtures name output: '../emitted'. Without those, prisma-next migration plan and contract emit wrote to the wrong place, so the documented regeneration procedure could not actually be run.
  • The packed-contract test fixture carried a synthetic contract with a made-up head hash. 0.17 verifies a descriptor's head against its own contractJson at config load, so the fixture now borrows the gadget fixture's real emitted contract.

Bundling

Several tsdown configs list /^@prisma\// under noExternal, meaning "inline Composer's own packages". After the rename that pattern would also swallow the whole ORM, so it is narrowed to /^@prisma\/(?!orm-)/ everywhere the previous behaviour kept @prisma-next/* external. The one place that deliberately inlined the ORM — the auth testing bundle, whose local bootstrap runs the real dbInit path — keeps doing so.

Verification

pnpm build, pnpm typecheck, pnpm lint, pnpm lint:deps and pnpm test are all green — 63 of 63 test packages. That includes the real-Postgres integration suites that exercise Prisma Next end to end (@internal/prisma-cloud, 338 tests; @internal/auth, 106 tests), the local-dev emulator suites (@internal/dev-emulators, @internal/local-target, @prisma/integration-tests), and prisma-next migration check on all four example migration trees.

The emulator suites needed a machine-local cleanup first, unrelated to this change: a postgres-main daemon left running by another worktree was holding port 4303 and the @prisma/dev lock files, and the shared registries still listed databases from runs whose worktrees no longer exist. Clearing the stale daemon and those records fixed all three.

Review round 1

A local review (architect + principal-engineer passes) and CodeRabbit found four things worth acting on; all are fixed in the last three commits.

  • The snapshot type files were stale. The rc.1 re-emit added AggregateTypes to every emitted contract.d.ts without moving a storage hash, so nothing re-anchored and all five migrations/snapshots/<hex>/contract.d.ts entries kept their 0.17-era types. migration plan reads the store copy, so those were the types a regenerated migration would import. Fixed, plus a lint-contract-snapshots check that fails on the drift.
  • Nothing kept the shell pins exact. check-publish-deps scopes its exact-pin rule to packages this workspace publishes, so all 11 @prisma/orm-* specs were unchecked — including the facade peer whose whole job is to prevent two copies of the ORM. Added lint-orm-pins.
  • The pack preflight never compared heads (CodeRabbit). It looked the pack up by id and stopped, so a database listing the pack at a different head passed. Five places already documented the behaviour the code lacked, and the test named for it passed vacuously. The gap predates this PR; fixed here because it sits one line from code the rename touched.
  • My "DDL is unchanged" claim was wrong. Corrected above with the actual per-tree diff.
  • The extensions rename went too far. The 0.17 config key rename was propagated past resolvePrismaNextConfig into Composer's own types — but extensions is already Composer's word for what a prisma-composer.config.ts lists, and 1-extensions/ is a layer name, so one word ended up meaning two things. Prisma Next's word now appears only in the two lines that talk to Prisma Next; everything Composer owns is extensionPacks again.
  • The install-contract change was filed as a consequence of a different decision. It is now ADR-0046, which also records what the old bullet understated: /auth/pack needs the peer at runtime too, not just /prisma-next.

The review artefacts are local-only under wip/review-code/pr-212/.

Follow-ups

  • prisma-next contract emit writes contract JSON without a trailing newline; biome wants one, and reformats some of the emitted files further. Committed artefacts are biome-formatted after each emit, as they were before this change. Worth settling one way or the other.
  • packages/1-prisma-cloud/2-shared-modules/auth/src/execution/empty-app-contract.json is a hand-kept copy of the empty-app fixture's emitted contract. The fixture's own contract.json is not committed, so the new snapshot check has nothing to compare it against — committing the fixture output would close that.
  • @internal/lowering's the heartbeat extends the lease on schedule is timing-dependent — it sleeps 100ms and asserts at least two PATCH requests at a 10ms interval — and failed once on a loaded CI runner. It comes from this branch's base commit, is untouched here, and passes locally on every run. Worth a tolerance or a fake clock.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c98191d7-0769-40db-9cd7-c8d12daff491

📥 Commits

Reviewing files that changed from the base of the PR and between 8a58e45 and 0e55ecc.

📒 Files selected for processing (15)
  • docs/design/90-decisions/ADR-0022-data-deps-carry-a-prisma-next-contract.md
  • docs/design/90-decisions/ADR-0046-the-orm-facade-is-a-peer-dependency.md
  • docs/design/90-decisions/README.md
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/pack.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/source/prisma-next.config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/source/prisma-next.spaceless.config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pack-preflight.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pn-config.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pn-extension-packs.integration.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/pn-config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/pn-migration-resource.ts
  • packages/1-prisma-cloud/1-extensions/target/src/preflight.ts
  • packages/1-prisma-cloud/1-extensions/target/src/prisma-next-migrate.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/pack-conformance.integration.test.ts
  • scripts/lint-contract-snapshots.mjs

Summary by CodeRabbit

  • New Features

    • Added support for aggregate type mappings, including average, count, maximum, minimum, and sum operations.
    • Added scalar-list capability metadata and improved storage-column type mappings.
    • Added validation for contract snapshots, ORM version consistency, and extension pack configuration.
    • Added support for extensions without contract spaces.
  • Migration Updates

    • Updated example migrations and generated contracts for text-based identifiers and explicit schema creation.
  • Documentation

    • Added architecture guidance for ORM integration and versioning.

Walkthrough

The pull request migrates examples and Prisma Cloud packages from @prisma-next/* to @prisma/orm-*. Generated contracts now include aggregate and storage-column type maps, updated codecs, hashes, capabilities, and extensions metadata. Migrations use typed end contracts and PostgreSQL text columns where applicable. Runtime configuration, preflight validation, bundling rules, fixtures, and integration tests use the new package names. New lint scripts validate ORM version pins and contract snapshot consistency. ADR-0046 documents the peer-dependency policy.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: upgrading Prisma Next packages to the renamed @prisma/* 8.0.0-rc.1 packages.
Description check ✅ Passed The description directly explains the package upgrade, migration changes, compatibility effects, verification, and related implementation work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/prisma-upgrade-8-0-0-02d808
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/prisma-upgrade-8-0-0-02d808

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@prisma/composer@212
npm i https://pkg.pr.new/@prisma/composer-prisma-cloud@212

commit: 6ce6339

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/1-prisma-cloud/1-extensions/target/src/preflight.ts`:
- Around line 273-279: Update the extension-pack lookup in the preflight
validation around resolvePrismaNextConfig to require both requirement.packId and
requirement.headHash matching the pack’s contractSpace.headRef.hash. Preserve
the existing missing-pack error behavior for either an absent pack or a hash
mismatch, and add coverage for a pack ID whose configured head hash differs from
the required head.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 63030fc8-504f-45ed-ac5b-d8ab772df3af

📥 Commits

Reviewing files that changed from the base of the PR and between de78022 and 27a870c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (92)
  • docs/design/90-decisions/ADR-0022-data-deps-carry-a-prisma-next-contract.md
  • examples/auth/contract.d.ts
  • examples/auth/contract.json
  • examples/auth/migrations/app/20260723T0709_init/end-contract.json
  • examples/auth/migrations/app/20260723T0709_init/migration.json
  • examples/auth/migrations/app/20260723T0709_init/migration.ts
  • examples/auth/migrations/auth/0001_init/migration.json
  • examples/auth/migrations/auth/0001_init/ops.json
  • examples/auth/migrations/auth/refs/head.json
  • examples/auth/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts
  • examples/auth/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.json
  • examples/auth/migrations/snapshots/6bbd4dc1c19c8aa5e0d60c9755e0f8ea07ba1c01d20c48cf3aa7226e4ee7d33f/contract.d.ts
  • examples/auth/migrations/snapshots/6bbd4dc1c19c8aa5e0d60c9755e0f8ea07ba1c01d20c48cf3aa7226e4ee7d33f/contract.json
  • examples/auth/package.json
  • examples/auth/prisma-next.config.ts
  • examples/pn-widgets/contract.d.ts
  • examples/pn-widgets/contract.json
  • examples/pn-widgets/migrations/app/20260711T1921_init/end-contract.json
  • examples/pn-widgets/migrations/app/20260711T1921_init/migration.json
  • examples/pn-widgets/migrations/app/20260711T1921_init/migration.ts
  • examples/pn-widgets/migrations/app/20260711T1921_init/ops.json
  • examples/pn-widgets/migrations/snapshots/2c0c3445737906d85590514e3cec242919c12f8112346c2cebe74e681d65f0f0/contract.d.ts
  • examples/pn-widgets/migrations/snapshots/2c0c3445737906d85590514e3cec242919c12f8112346c2cebe74e681d65f0f0/contract.json
  • examples/pn-widgets/package.json
  • examples/pn-widgets/prisma-next.config.ts
  • examples/store/modules/catalog/contract.d.ts
  • examples/store/modules/catalog/contract.json
  • examples/store/modules/catalog/migrations/app/20260713T1212_init/end-contract.json
  • examples/store/modules/catalog/migrations/app/20260713T1212_init/migration.json
  • examples/store/modules/catalog/migrations/app/20260713T1212_init/migration.ts
  • examples/store/modules/catalog/migrations/app/20260713T1212_init/ops.json
  • examples/store/modules/catalog/migrations/snapshots/6e17ba1a02b94d229e945c92406158ed240eeb2afb84ab890413c4b0d1774a16/contract.d.ts
  • examples/store/modules/catalog/migrations/snapshots/6e17ba1a02b94d229e945c92406158ed240eeb2afb84ab890413c4b0d1774a16/contract.json
  • examples/store/modules/catalog/package.json
  • examples/store/modules/catalog/prisma-next.config.ts
  • examples/store/modules/orders/contract.d.ts
  • examples/store/modules/orders/contract.json
  • examples/store/modules/orders/migrations/app/20260713T1212_init/end-contract.json
  • examples/store/modules/orders/migrations/app/20260713T1212_init/migration.json
  • examples/store/modules/orders/migrations/app/20260713T1212_init/migration.ts
  • examples/store/modules/orders/migrations/app/20260713T1212_init/ops.json
  • examples/store/modules/orders/migrations/snapshots/eee8ad6db4dca6d22c79a724f3d2a6086ffe08fd32b8b778dd2d0d6c464b25b4/contract.d.ts
  • examples/store/modules/orders/migrations/snapshots/eee8ad6db4dca6d22c79a724f3d2a6086ffe08fd32b8b778dd2d0d6c464b25b4/contract.json
  • examples/store/modules/orders/package.json
  • examples/store/modules/orders/prisma-next.config.ts
  • packages/1-prisma-cloud/1-extensions/target/package.json
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/gadget-contract/emitted/contract.d.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/gadget-contract/emitted/contract.json
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/gadget-contract/source/prisma-next.config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/pack.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/source/contract.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/packed-contract/source/prisma-next.config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/widget-contract/emitted/contract.d.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/widget-contract/emitted/contract.json
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/widget-contract/source/contract.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/fixtures/widget-contract/source/prisma-next.config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/invariants.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pack-preflight.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pn-config.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pn-extension-packs.integration.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pn-target-ref.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/prisma-next-migrate.integration.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/prisma-next.integration.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/prisma-next.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/descriptors/prisma-next.ts
  • packages/1-prisma-cloud/1-extensions/target/src/pn-config.ts
  • packages/1-prisma-cloud/1-extensions/target/src/pn-migration-resource.ts
  • packages/1-prisma-cloud/1-extensions/target/src/preflight.ts
  • packages/1-prisma-cloud/1-extensions/target/src/prisma-next-migrate.ts
  • packages/1-prisma-cloud/1-extensions/target/src/prisma-next.ts
  • packages/1-prisma-cloud/1-extensions/target/src/required-pack-head.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/package.json
  • packages/1-prisma-cloud/2-shared-modules/auth/prisma-next.config.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/barrel-invariants.test.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/fixtures/empty-app/emitted/contract.d.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/fixtures/empty-app/source/prisma-next.config.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/__tests__/pack-conformance.integration.test.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/execution/empty-app-contract.json
  • packages/1-prisma-cloud/2-shared-modules/auth/src/execution/local-schema.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/contract.d.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/contract.json
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/contract.prisma
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/index.ts
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/migrations/0001_init/migration.json
  • packages/1-prisma-cloud/2-shared-modules/auth/src/pack/migrations/0001_init/ops.json
  • packages/1-prisma-cloud/2-shared-modules/auth/tsdown.config.ts
  • packages/1-prisma-cloud/2-shared-modules/cron/tsdown.config.ts
  • packages/1-prisma-cloud/2-shared-modules/email/tsdown.config.ts
  • packages/1-prisma-cloud/2-shared-modules/storage/tsdown.config.ts
  • packages/1-prisma-cloud/2-shared-modules/streams/tsdown.config.ts
  • packages/9-public/composer-prisma-cloud/package.json
  • scripts/publish-packages-utils.test.mjs
💤 Files with no reviewable changes (4)
  • examples/auth/migrations/app/20260723T0709_init/end-contract.json
  • examples/store/modules/orders/migrations/app/20260713T1212_init/end-contract.json
  • examples/pn-widgets/migrations/app/20260711T1921_init/end-contract.json
  • examples/store/modules/catalog/migrations/app/20260713T1212_init/end-contract.json

wmadden-electric added a commit that referenced this pull request Aug 9, 2026
… just the pack id

`runPackPreflight` looked the pack up by id and stopped there, so a database
whose config listed the pack at a different `contractSpace.headRef.hash` passed.
The migration step would then take the database to the configured head while the
service is typed against a different one — the exact case the preflight exists
to catch, since wireability deliberately says yes to every required head.

Five places already described the behaviour the code did not have: the function
doc, the auth README, the test file header, a test name, and the
`RequiredPackHeadContract` doc comment. The test named for it passed vacuously.

An absent pack keeps its existing error; a head mismatch gets its own, naming
both hashes. Raised by CodeRabbit on #212; the gap predates that PR.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/1-prisma-cloud/1-extensions/target/src/__tests__/pack-preflight.test.ts`:
- Around line 106-116: Add a test alongside the existing pack head-mismatch case
that configures the listed pack without a contractSpace, invokes
runPackPreflight, and asserts rejection includes the expected “(no contract
space)” text. Use the existing graphWith and pack identifiers/helpers, while
preserving the current coverage and behavior for packs with a contract space.

In `@scripts/lint-contract-snapshots.mjs`:
- Around line 54-61: Update the grouping logic in the contract snapshot scan so
a valid contract.json is recorded even when its sibling contract.d.ts is
missing, using an explicit absent-types marker rather than continuing. Extend
the group validation to fail when the same canonical contract group contains
both members with types and members without, while preserving existing handling
for invalid storageHash values.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 149116dd-3a47-4878-93d8-d975aa0f41ee

📥 Commits

Reviewing files that changed from the base of the PR and between 27a870c and 8a58e45.

📒 Files selected for processing (10)
  • examples/auth/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts
  • examples/auth/migrations/snapshots/6bbd4dc1c19c8aa5e0d60c9755e0f8ea07ba1c01d20c48cf3aa7226e4ee7d33f/contract.d.ts
  • examples/pn-widgets/migrations/snapshots/2c0c3445737906d85590514e3cec242919c12f8112346c2cebe74e681d65f0f0/contract.d.ts
  • examples/store/modules/catalog/migrations/snapshots/6e17ba1a02b94d229e945c92406158ed240eeb2afb84ab890413c4b0d1774a16/contract.d.ts
  • examples/store/modules/orders/migrations/snapshots/eee8ad6db4dca6d22c79a724f3d2a6086ffe08fd32b8b778dd2d0d6c464b25b4/contract.d.ts
  • package.json
  • packages/1-prisma-cloud/1-extensions/target/src/__tests__/pack-preflight.test.ts
  • packages/1-prisma-cloud/1-extensions/target/src/preflight.ts
  • scripts/lint-contract-snapshots.mjs
  • scripts/lint-orm-pins.mjs

Comment thread scripts/lint-contract-snapshots.mjs Resolved
wmadden-electric added a commit that referenced this pull request Aug 9, 2026
…dary

The 0.17 config key rename went past `resolvePrismaNextConfig` into Composer's
own types, which was a step too far. `extensions` is already Composer's word for
what a `prisma-composer.config.ts` lists (`prismaCloud()`, `nodeBuild()`), and
`1-extensions/` is a layer name — so the rename left one word meaning two
different things in one codebase, with the element type still `PnExtensionPack`
and every lambda parameter still `pack`.

Prisma Next's word now appears in exactly the two lines that talk to Prisma
Next: `config.extensions ?? []` where the config is read, and
`createPostgresControlClient({ extensions: extensionPacks })` where the client is
built. Everything Composer owns is `extensionPacks` again. Error text still says
`prisma-next.config.ts extensions`, because that is the key the user typed.

Also restores the fixture comment that recorded the translation — it had
degenerated to "`extensions` … lands in the loaded config as `extensions`" — and
replaces a `toThrow(/extensions/)` assertion with a phrase from the message it
means to match, since `extensions` on its own is a common word.

Raised by the architect pass on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Aug 9, 2026
… peer dependency

Composer's published package now requires the application to install
`@prisma/orm-postgres` rather than installing it itself. That is a change to the
install contract, so it is a decision, and it was recorded only as an edited
bullet in ADR-0022's consequences list — the wrong place to look for it and the
wrong weight.

ADR-0046 states it with its reasoning: Composer registers an extension pack
against the application's copy of the target, and two copies of a shell in one
tree means two codec and operation registries and two class identities, so a
value from one is rejected by the other with nothing to detect it. A peer turns
that combination into an install failure. It also records what the earlier
bullet understated — `/auth/pack` needs the peer at runtime too, not just
`/prisma-next`, because the built pack verifies itself against its own contract
through `@prisma/orm-postgres/family-contract/canonicalization-hooks`.

ADR-0022's bullet now states the requirement and points here for how it is
expressed.

Raised by the architect pass on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Aug 9, 2026
`lint-contract-snapshots` skipped any `contract.json` with no emitted types
beside it. So deleting a snapshot's `contract.d.ts` dropped it from its group,
the group fell below the two members a comparison needs, and the check passed —
silently missing the drift class it exists to catch.

Copies with no types are now recorded rather than skipped, and a group that
holds both a member with types and one without fails, naming the copy that lost
them. Verified by deleting a snapshot's types file: the check now fails.

Also covers the preflight's `(no contract space)` branch, which had no test.
A pack declaring no `contractSpace` carries no head, so it can never satisfy a
required one; the fixture gains a second pack and config for exactly that shape,
and the test fails if the message degrades to printing `undefined`.

Both raised by CodeRabbit on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The `@prisma-next/*` scope is retired. Every consuming package now names a
published shell (ADR 242): the example apps take the single `@prisma/orm-postgres`
facade, and the tooling/extension packages add `@prisma/orm-toolchain` for the
config loader, CLI and migration tools. `@prisma/composer-prisma-cloud` declares
the facade as a peer dependency so an app cannot end up with two copies of the ORM.

Applied the 0.16 -> 0.17 upgrade instructions: bare-hex content hashes (the
`sha256:` prefix is gone everywhere, including test literals), migration contract
snapshots folded into the content-addressed `migrations/snapshots/<hex>/` store,
`extensionPacks` -> `extensions`, `outputPath` -> `output`, and PostgreSQL native
types authored in type position (`DateTime @db.Timestamptz` -> `Timestamptz`).

Every contract space was re-emitted and its migrations re-anchored to the new
hashes. The auth pack schema is unchanged; only its contract hash moved, so its
shipped init migration was regenerated against the new head.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Bumps every `@prisma/orm-*` pin from 0.17.0 to 8.0.0-rc.1 (npm `latest`).

The one breaking change in this transition — aggregate results now decode
through the codec their target declares, so `count()` is a `bigint` — needs no
source edits here: nothing in this repo calls an aggregate, a groupBy, or an
include reducer. Regenerating the contracts adds the `AggregateTypes` block the
ORM and SQL builder resolve aggregate result types from. Every storage hash is
unchanged, so no migration was re-anchored.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… just the pack id

`runPackPreflight` looked the pack up by id and stopped there, so a database
whose config listed the pack at a different `contractSpace.headRef.hash` passed.
The migration step would then take the database to the configured head while the
service is typed against a different one — the exact case the preflight exists
to catch, since wireability deliberately says yes to every required head.

Five places already described the behaviour the code did not have: the function
doc, the auth README, the test file header, a test name, and the
`RequiredPackHeadContract` doc comment. The test named for it passed vacuously.

An absent pack keeps its existing error; a head mismatch gets its own, naming
both hashes. Raised by CodeRabbit on #212; the gap predates that PR.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…stay in step

The 8.0.0-rc.1 re-emit added the `AggregateTypes` block to every emitted
`contract.d.ts` without moving any storage hash. Nothing re-anchored, so all
five `migrations/snapshots/<hex>/contract.d.ts` entries kept their 0.17-era
types — and `migration plan` reads the store copy, so those stale types are what
a regenerated migration would import. `migration check` does not look at them.

Two checks so this cannot drift again, both wired into `lint:deps`:

- `lint-contract-snapshots` requires every committed copy of one contract to
  carry the same emitted types. It groups by canonical contract content rather
  than by storage hash, because the hash covers the `storage` subtree alone and
  two genuinely different contracts can share one.
- `lint-orm-pins` requires every `@prisma/orm-*` spec to be one exact version,
  and all of them the same version. `check-publish-deps` enforces exact pins
  only for packages this workspace publishes, so the shells went unchecked — and
  a range on the facade peer would reintroduce the two-copies split that peer
  exists to prevent.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The Lint job checks formatting; my local run reported the error inside a
truncated diagnostic list and I read only the summary line.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…dary

The 0.17 config key rename went past `resolvePrismaNextConfig` into Composer's
own types, which was a step too far. `extensions` is already Composer's word for
what a `prisma-composer.config.ts` lists (`prismaCloud()`, `nodeBuild()`), and
`1-extensions/` is a layer name — so the rename left one word meaning two
different things in one codebase, with the element type still `PnExtensionPack`
and every lambda parameter still `pack`.

Prisma Next's word now appears in exactly the two lines that talk to Prisma
Next: `config.extensions ?? []` where the config is read, and
`createPostgresControlClient({ extensions: extensionPacks })` where the client is
built. Everything Composer owns is `extensionPacks` again. Error text still says
`prisma-next.config.ts extensions`, because that is the key the user typed.

Also restores the fixture comment that recorded the translation — it had
degenerated to "`extensions` … lands in the loaded config as `extensions`" — and
replaces a `toThrow(/extensions/)` assertion with a phrase from the message it
means to match, since `extensions` on its own is a common word.

Raised by the architect pass on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… peer dependency

Composer's published package now requires the application to install
`@prisma/orm-postgres` rather than installing it itself. That is a change to the
install contract, so it is a decision, and it was recorded only as an edited
bullet in ADR-0022's consequences list — the wrong place to look for it and the
wrong weight.

ADR-0046 states it with its reasoning: Composer registers an extension pack
against the application's copy of the target, and two copies of a shell in one
tree means two codec and operation registries and two class identities, so a
value from one is rejected by the other with nothing to detect it. A peer turns
that combination into an install failure. It also records what the earlier
bullet understated — `/auth/pack` needs the peer at runtime too, not just
`/prisma-next`, because the built pack verifies itself against its own contract
through `@prisma/orm-postgres/family-contract/canonicalization-hooks`.

ADR-0022's bullet now states the requirement and points here for how it is
expressed.

Raised by the architect pass on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
`lint-contract-snapshots` skipped any `contract.json` with no emitted types
beside it. So deleting a snapshot's `contract.d.ts` dropped it from its group,
the group fell below the two members a comparison needs, and the check passed —
silently missing the drift class it exists to catch.

Copies with no types are now recorded rather than skipped, and a group that
holds both a member with types and one without fails, naming the copy that lost
them. Verified by deleting a snapshot's types file: the check now fails.

Also covers the preflight's `(no contract space)` branch, which had no test.
A pack declaring no `contractSpace` carries no head, so it can never satisfy a
required one; the fixture gains a second pack and config for exactly that shape,
and the test fails if the message degrades to printing `undefined`.

Both raised by CodeRabbit on #212.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric force-pushed the claude/prisma-upgrade-8-0-0-02d808 branch from 0e55ecc to 6ce6339 Compare August 9, 2026 18:27
@wmadden-electric
wmadden-electric merged commit c713358 into main Aug 9, 2026
18 checks passed
@wmadden-electric
wmadden-electric deleted the claude/prisma-upgrade-8-0-0-02d808 branch August 9, 2026 18:38
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.

2 participants