Skip to content

ORM commands now state all four output channels instead of letting the engine fill them in - #30004

Merged
wmadden-electric merged 1 commit into
mainfrom
orm-declare-presentations
Aug 13, 2026
Merged

ORM commands now state all four output channels instead of letting the engine fill them in#30004
wmadden-electric merged 1 commit into
mainfrom
orm-declare-presentations

Conversation

@wmadden-electric

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

Copy link
Copy Markdown
Contributor

Here is the entire change, repeated across 21 files:

  // src/orm/migration/list.ts
  function listPresentations(inputs: { … }): Presentations {
    return {
      human: (): readonly Block[] => [
        { kind: 'fields', rail: true, rows: [ … ] },
        { kind: 'drawing', lines: toneDrawing(inputs.tree) },
      ],
+     stdout: () => [],
+     next: () => [],
      json: () => inputs.list,
    };
  }

What those four things are

Every CLI command hands the engine four ways of reporting what it did, and the engine uses the ones the run needs:

what it is who reads it
human the blocks a person sees, on stderr someone at a terminal
stdout plain data lines, on stdout a pipe, a script
json the result inside the --json envelope a program parsing output
next suggested follow-up commands the person, after the command finishes

Today human is required and the other three are optional. When a command leaves one out, the engine substitutes a default — an empty list for stdout and next.

The decision

The engine is dropping those defaults and requiring all four. A command will state what it publishes on each channel rather than inheriting it by omission.

This PR does that stating for the ORM commands. Nothing else changes.

Why it matters, concretely

Once the engine stops substituting, it calls whatever the command declared. Our commands declare two of the four, so it calls functions that are not there:

$ prisma migration list
# exit 2

That is stdout in human mode — the default for anyone at a terminal — and next in both modes. It affects the 21 command files in this diff.

Worth noting how it was found, because it says something about our coverage: this package's own suite passes either way. It never sees the engine version it will be mounted against. The failure only appears when you run the assembled prisma binary, which neither repo tests today.

Behaviour is identical

Every added stdout and next returns the same empty array the engine was already substituting. This is a no-op at runtime, on purpose.

What it buys is visibility. stdout is the channel a script reads, and today every ORM command returns nothing on it — not as a decision, but because nobody wrote one. After this, that gap is a visible () => [] in each file, and a command that ought to emit machine-readable lines can be given them one at a time, deliberately and reviewably.

Timing: this does not wait on anything

The three fields are optional in the engine we pin (0.0.9) and in the newest published engine (8.0.0-rc.1, on the next tag) alike. The version that requires them is not published yet — it is prisma-cli#171, still open. So this can merge and ship now, and the engine can then require the fields without breaking us.

How I know nothing was missed

I made the four fields required in the installed engine's type declarations and typechecked the package against that — the exact condition the new engine imposes. Zero errors across src/ afterwards, and it caught one site a grep had missed: a fixture in test/orm/define-command.test.ts. The declarations were then restored, so nothing in this diff touches node_modules.

pnpm build, typecheck and lint clean; 155 test files, 1943 tests passing.

Alternatives considered

Handle it in prisma-cli instead, by calling the missing channels defensively. That shim exists today and works. Rejected as the permanent answer: it stands in for a declaration we can simply write in our own code, and it keeps the engine guessing on behalf of every ORM command we add from here.

Wait for the strict engine to publish and do this together with the version bump. Rejected: the fields are optional in every published engine, so this ships now. Waiting only keeps the consumer shimmed for longer and couples two releases that need not be coupled.

Bump the engine pin from 0.0.9 to 8.0.0-rc.1 in the same PR. Worth doing — an install of @prisma/cli currently carries two copies of the engine because this package pins 0.0.9 while prisma-cli builds 8.0.0-rc.1 — but it is a large version jump with its own surface changes, and it is not needed to make the presentations correct. Kept separate so this diff stays a reviewable no-op.

Give the commands real stdout output now rather than () => []. Rejected for this PR. What migration list should print to a pipe is a genuine per-command design question and a behaviour change deserving its own review. () => [] is exactly what ships today, which keeps this diff a no-op reviewable in one pass.

`Presentations` in @prisma/cli-engine 0.0.9 makes `stdout`, `json` and
`next` optional, and these commands took that up: 21 files declared
`human` and `json` and left the other two to the engine's defaults.

The engine is making all four required, so a command states each surface
it publishes rather than inheriting one by omission. Until that version
is pinned here the consumer has to call the missing ones defensively,
which is a shim standing in for a declaration we can simply write.

Behaviour is unchanged: every added `stdout` and `next` returns the empty
array the engine already substituted. The point is that the omission
becomes visible, so a command that should publish machine-readable lines
can be given them one at a time.

Verified against the stricter type by making the four required in the
installed engine's declarations and typechecking: no source file is
missing one. A test fixture in define-command.test.ts was the only other
site.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner August 13, 2026 07:04
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

prisma-next

npm i https://pkg.pr.new/prisma-next@30004

@prisma/orm-extension-arktype-json

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

@prisma/orm-extension-middleware-cache

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

@prisma/orm-extension-paradedb

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

@prisma/orm-extension-pgvector

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

@prisma/orm-extension-postgis

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

@prisma/orm-extension-supabase

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

@prisma/orm-family-mongo

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

@prisma/orm-family-sql

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

@prisma/orm-framework

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

@prisma/orm-mongo

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

@prisma/orm-postgres

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

@prisma/orm-sqlite

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

@prisma/orm-target-mongo

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

@prisma/orm-target-postgres

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

@prisma/orm-target-sqlite

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

@prisma/orm-toolchain

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

commit: 15e8442

@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: 3474c0cb-8ed6-47d2-ab38-211ee27c6547

📥 Commits

Reviewing files that changed from the base of the PR and between c4a5875 and 15e8442.

📒 Files selected for processing (22)
  • packages/1-framework/3-tooling/cli/src/orm/contract/emit.ts
  • packages/1-framework/3-tooling/cli/src/orm/contract/infer.ts
  • packages/1-framework/3-tooling/cli/src/orm/db/init.ts
  • packages/1-framework/3-tooling/cli/src/orm/db/schema.ts
  • packages/1-framework/3-tooling/cli/src/orm/db/sign.ts
  • packages/1-framework/3-tooling/cli/src/orm/db/update.ts
  • packages/1-framework/3-tooling/cli/src/orm/db/verify.ts
  • packages/1-framework/3-tooling/cli/src/orm/format.ts
  • packages/1-framework/3-tooling/cli/src/orm/init-blocks.ts
  • packages/1-framework/3-tooling/cli/src/orm/migrate.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/check.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/graph.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/list.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/log.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/new.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/plan.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/show.ts
  • packages/1-framework/3-tooling/cli/src/orm/migration/status.ts
  • packages/1-framework/3-tooling/cli/src/orm/ref/delete.ts
  • packages/1-framework/3-tooling/cli/src/orm/ref/list.ts
  • packages/1-framework/3-tooling/cli/src/orm/ref/set.ts
  • packages/1-framework/3-tooling/cli/test/orm/define-command.test.ts

📝 Walkthrough

Walkthrough

ORM CLI presentation objects now include empty stdout and next handlers where required. Existing human and JSON presentations remain. The command test now supplies explicit empty handlers.

Changes

ORM presentation normalization

Layer / File(s) Summary
Add empty ORM presentation handlers
packages/1-framework/3-tooling/cli/src/orm/..., packages/1-framework/3-tooling/cli/test/orm/define-command.test.ts
Contract, database, formatting, initialization, migration, and reference command presentations now provide empty stdout and next handlers where required. The command test defines explicit empty presenters while retaining the JSON response.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 15e84

This localized change makes command output declarations explicit without changing intended behavior, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: ORM commands now declare all four output channels instead of relying on engine defaults.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch orm-declare-presentations

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.

@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 changed the title Declare every presentation the ORM commands publish ORM commands now state all four output channels instead of letting the engine fill them in Aug 13, 2026
@wmadden-electric
wmadden-electric added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 71e2e0d Aug 13, 2026
27 of 28 checks passed
@wmadden-electric
wmadden-electric deleted the orm-declare-presentations branch August 13, 2026 13:49
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.

3 participants