Skip to content

The engine becomes an exact peer of the toolchain, and a bin-less package smokes its cli entry - #30009

Merged
wmadden-electric merged 1 commit into
mainfrom
claude/orm-engine-peer
Aug 17, 2026
Merged

wmadden-electric merged 1 commit into
mainfrom
claude/orm-engine-peer

Conversation

@wmadden-electric

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

Copy link
Copy Markdown
Contributor

Before and after

Before, @prisma/orm-toolchain carried @prisma/cli-engine as an ordinary dependency:

$ npm ls @prisma/cli-engine        # any tree where pins drift
`-- prisma CLI
  +-- @prisma/[email protected]
  `-- @prisma/orm-toolchain
    `-- @prisma/[email protected]   # a silent second engine

After, the engine is an exact peerDependency: npm resolves a peer against the ancestor, so exactly one engine exists in any tree it can assemble, and a version conflict fails at install time instead of resolving a second copy.

The decision

This is the prisma/prisma share of ADR 0004 (prisma-cli, docs/architecture/adrs/0004-engine-version-pinning.md, operator-settled 2026-08-13): product CLI packages declare the engine as an exact peer the consolidated CLI satisfies; product libraries carry no engine relationship; ranges are the post-GA destination behind a written compatibility contract, not now — during the rc line the engine breaks its consumers deliberately, so the peer stays exact. No package split is needed here: applications never install orm-toolchain directly (its vite plugin reaches them as a forwarded export of @prisma/orm-postgres), so the toolchain already is the ORM's CLI package.

How the change is routed

Through the manifest generator's own rules, not around them: @internal/cli moves the engine from dependencies to peerDependencies (keeping a devDependency so the workspace resolves it for builds and tests), and shell-build's validator then expects exactly that peer on the published @prisma/orm-toolchain manifest, which changes the same way. pnpm build — where the validator runs — passes unchanged.

scripts/check-conformance.mjs follows the strategy: the source-of-truth pin is now @internal/cli's peer, and an engine appearing in any packed dependencies field is a new wrong-field finding, so a regression to the old shape fails the publish.

Found red on main, fixed here

#30005 retired the prisma-next bin but left the conformance check requiring bin entries, so pnpm check:conformance — a publish blocker — currently fails on main with "the packed manifest has no bin entries". A bin-less package's sandbox smoke now imports its published /cli entry in a fresh node instead: the anti-vacuity guarantee survives (a package whose entry cannot import fails loudly) without demanding an executable nobody ships.

Verification

  • node --test scripts/check-conformance.test.mjs — 43/43 (3 new: the wrong-field finding, the bin-less entry smoke, the failing-entry finding).
  • pnpm check:conformance end to end — exit 0: packs all publishable packages, sweeps packed imports, runs the shipped orm validator over the hostile corpus, installs the toolchain tarball into the sandbox (the exact peer resolves from the registry), imports @prisma/orm-toolchain/cli in a fresh node, and every engine reference agrees at 0.0.9.
  • pnpm check:publish-deps — exit 0. pnpm build — exit 0.
  • pnpm test:scripts — 77 failures that reproduce identically on a clean origin/main checkout (upgrade-coverage and worktree-hygiene scripts, unrelated); this change adds 3 passing tests and no failures.

The follow-up this enables

In prisma-cli, once composer's split package also carries the peer: the shell's conformance check evolves from pin-equality to peer-satisfaction and deletes its recorded exception list — the moment mismatches become impossible to ship rather than merely detected.

Alternatives considered

Hand-editing only the published manifest. The validator would reject it: expected peers are derived from the bundled internals, so the internal package's manifest is the source of truth — changing it is the sanctioned route.

A version range now. Removes the repin train, but promises compatibility the rc-line engine deliberately does not offer. Recorded in ADR 0004 as the post-GA destination.

Keeping the bin requirement and exempting the toolchain. An exemption list for a package that will never have a bin again is a permanent exception; smoking the published entry asserts something real instead.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Corrected CLI engine dependency handling so it is provided as a peer dependency rather than bundled at runtime.
    • Improved validation to detect incorrect dependency placement and version mismatches.
    • Enhanced command-line package checks, including better reporting when CLI entry points fail to load.
  • Tests

    • Expanded conformance coverage for valid peer dependencies, misplaced engine declarations, and CLI entry-point failures.

A product CLI package is a plugin to the CLI engine, and a plugin
declares its host as a peer: npm resolves a peer against the ancestor,
so exactly one engine exists in any tree it can assemble, and a version
conflict fails at install time instead of silently resolving a second
copy. The strategy is recorded in prisma-cli as ADR 0004
(docs/architecture/adrs/0004-engine-version-pinning.md); this is the
prisma/prisma share of it. The peer stays EXACT during the rc line —
the engine breaks its consumers deliberately — with ranges recorded
there as the post-GA destination.

The route is the manifest generator's own: @internal/cli moves the
engine from dependencies to peerDependencies (keeping a devDependency
so the workspace resolves it), and shell-build's validator then expects
exactly that peer on the published @prisma/orm-toolchain manifest,
which changes the same way. No generator changes were needed.

The conformance check follows the strategy: the source-of-truth pin is
now @internal/cli's peer, an engine appearing in any packed
dependencies field is a new wrong-field finding, and agreement checks
work as before across whatever fields declare the engine.

One discovery while verifying, fixed here because the publish gate was
red without it: #30005 retired the prisma-next bin but left the
conformance check requiring bin entries, so check:conformance failed on
main. A bin-less package's sandbox smoke now imports its published
/cli entry in a fresh node instead — the anti-vacuity guarantee
survives without demanding an executable nobody ships.

Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c14c60c-2e9a-4ce2-ab2f-04c3738e964f

📥 Commits

Reviewing files that changed from the base of the PR and between 71e2e0d and 2fce7fe.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • packages/1-framework/3-tooling/cli/package.json
  • packages/9-public/@prisma/orm-toolchain/package.json
  • scripts/check-conformance.mjs
  • scripts/check-conformance.test.mjs

📝 Walkthrough

Walkthrough

The package manifests move @prisma/cli-engine to peer dependencies. Conformance checks validate peer dependency pins and import the published CLI entry in a sandbox. Tests cover valid pins, wrong fields, successful imports, and failed imports.

Changes

Engine dependency and conformance

Layer / File(s) Summary
Package peer dependency declarations
packages/1-framework/3-tooling/cli/package.json, packages/9-public/@prisma/orm-toolchain/package.json
The packages remove @prisma/cli-engine from runtime dependencies. The CLI package adds it to devDependencies and both packages declare it in peerDependencies at version 0.0.9.
Peer-field engine pin validation
scripts/check-conformance.mjs, scripts/check-conformance.test.mjs
Engine pin collection preserves the dependency field. Validation requires peerDependencies and reports wrong-field findings for other fields. Fixtures and tests use peer dependency pins.
Sandbox CLI entry smoke test
scripts/check-conformance.mjs, scripts/check-conformance.test.mjs
The conformance check imports @prisma/orm-toolchain/cli in a fresh process when no published binaries exist. Timeout and nonzero-exit results produce bin-failed findings. Tests cover successful and failed imports.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 2fce7

The change updates engine dependency resolution and adjusts conformance smoke behavior for a package without a binary entry; the supplied checks pass, so no actionable merge-blocking risk remains beyond normal review.

Sequence Diagram(s)

sequenceDiagram
  participant runCheck
  participant SandboxProcess
  participant ORMToolchainCLI
  runCheck->>SandboxProcess: Import `@prisma/orm-toolchain/cli`
  SandboxProcess->>ORMToolchainCLI: Load CLI entry
  ORMToolchainCLI-->>SandboxProcess: Exit status and output
  SandboxProcess-->>runCheck: Success or bin-failed diagnostics
Loading

Possibly related PRs

Suggested labels: lgtm

Suggested reviewers: aqrln

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both primary changes: the exact peer dependency and the CLI entry smoke test for bin-less packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/orm-engine-peer

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 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30009

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30009

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30009

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30009

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30009

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30009

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30009

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30009

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30009

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30009

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30009

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30009

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30009

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30009

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30009

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30009

commit: 2fce7fe

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 171.55 KB (0%)
postgres / emit 148.73 KB (0%)
mongo / no-emit 101.15 KB (0%)
mongo / emit 91.01 KB (0%)
cf-worker / no-emit 195.88 KB (0%)
cf-worker / emit 170.59 KB (0%)

@wmadden-electric
wmadden-electric added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit a70f109 Aug 17, 2026
26 of 27 checks passed
@wmadden-electric
wmadden-electric deleted the claude/orm-engine-peer branch August 17, 2026 08:07
wmadden-electric added a commit that referenced this pull request Aug 17, 2026
#30009 gave a bin-less package a sandbox smoke by importing one hardcoded
entry, @prisma/orm-toolchain/cli. The other 34 subpaths in the exports map
are equally published and equally reachable, and nothing checks them: the
import-purity sweep reads the imports inside packed files, so it cannot see
an exports subpath whose target file never made it into the tarball.

Every exported subpath is smoked now. Proven by deleting dist/emitter.mjs
and running both versions against the same tarball: the check on main exits
0, this one exits 1 naming @prisma/orm-toolchain/emitter.

The bin loop is untouched — a package that ships a bin still starts it. Only
the bin-less path widens. The anti-vacuity rule moves with the subjects: a
manifest with neither a bin nor an importable export is a finding.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
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