Skip to content

fix(cli): migration graph --dot draws the DOT as a human block, un-redding main - #30057

Merged
wmadden merged 1 commit into
mainfrom
fix/migration-graph-dot-human-block
Aug 18, 2026
Merged

fix(cli): migration graph --dot draws the DOT as a human block, un-redding main#30057
wmadden merged 1 commit into
mainfrom
fix/migration-graph-dot-human-block

Conversation

@wmadden-electric

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

Copy link
Copy Markdown
Contributor

What broke

8.0.0-rc.2 shipped with migration graph --dot printing no DOT on a terminal, and main has been red on test/integration/test/cli-journeys/migration-graph-dot.e2e.test.ts since the release merge (#30049) — silently, because integration tests were not a required check at the time.

@prisma/cli-engine 0.1.1 treats a command's stdout payload as a mirror of the human output and suppresses it when stdout and stderr are one screen (isTty.stdout && isTty.stderr && outputStreamsShareDevice !== false). For --dot the payload was the only copy of the DOT text, so a terminal showed nothing, and piping switches the engine to json mode, so there was no stream shape that produced raw DOT.

The fix

graphPresentations now also emits the DOT as a human drawing block. That makes the stdout payload a genuine mirror, so the engine's suppression rule is correct in every shape:

  • one shared screen: the human block shows the DOT on stderr, the stdout mirror is suppressed
  • split sinks (stdout terminal, stderr elsewhere): stdout carries the raw DOT and stderr the human copy
  • json mode: unchanged — the result envelope carries dot alongside the graph document

Tests

  • packages/1-framework/3-tooling/cli/test/orm/migration-graph.test.ts: new case pinning the one-shared-screen shape (human block present, stderr shows DOT, stdout empty, payload still declared); the split-shape case now also asserts the raw DOT actually reaches stdout.
  • test/integration/test/cli-journeys/migration-graph-dot.e2e.test.ts: the red journey now asserts the new contract and passes.

Verified locally: cli package suite (1421 tests), the DOT journey (3 tests), pnpm typecheck, pnpm lint — all green.

Follow-up not in this PR

runtimeFromProcess still never sets Runtime.outputStreamsShareDevice, so two genuinely separate terminals are treated as one screen. Upstream prisma/prisma-cli#198 makes the field required, which will force that decision here when the next engine version is adopted.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Enhancements
    • Improved migration graph --dot output in human-readable mode.
    • DOT diagrams now appear in the human presentation while remaining available through the existing standard output format.
    • Clarified command documentation describing how DOT output is presented.

…ives one shared screen

cli-engine 0.1.1 suppresses the stdout payload when stdout and stderr are
one screen, treating it as a mirror of the human output. For --dot the
payload was the only copy, so a terminal showed no DOT at all and main went
red on the migration-graph-dot journey. The DOT is now also a human drawing
block: one screen shows the human copy with the mirror suppressed, split
sinks get the raw DOT on stdout too, and json mode is unchanged.

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 18, 2026 08:28
@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.

@coderabbitai

coderabbitai Bot commented Aug 18, 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: e2b74346-fc54-4d15-93ed-211cbf57737b

📥 Commits

Reviewing files that changed from the base of the PR and between 456ba69 and 4e19eec.

📒 Files selected for processing (3)
  • packages/1-framework/3-tooling/cli/src/orm/migration/graph.ts
  • packages/1-framework/3-tooling/cli/test/orm/migration-graph.test.ts
  • test/integration/test/cli-journeys/migration-graph-dot.e2e.test.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The migration graph command now renders available DOT output in human mode as a drawing block. Tests verify shared-TTY stream handling and preserve DOT data in stdout presentation and JSON results.

Changes

Migration graph DOT presentation

Layer / File(s) Summary
Human-mode DOT rendering
packages/1-framework/3-tooling/cli/src/orm/migration/graph.ts
The --dot documentation describes human and stdout presentation. Human output includes DOT content as a drawing block when available.
DOT presentation validation
packages/1-framework/3-tooling/cli/test/orm/migration-graph.test.ts, test/integration/test/cli-journeys/migration-graph-dot.e2e.test.ts
Tests verify drawing output, stderr rendering, empty raw stdout on a shared TTY, and preservation of DOT data in presented stdout and JSON results.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 4e19e

The change restores terminal and split-stream DOT output while preserving JSON behavior; no actionable merge-blocking risk remains beyond normal checks and review.

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 describes the main change: rendering migration graph DOT output as a human block in CLI terminal usage.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/migration-graph-dot-human-block

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

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

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

@prisma/orm-extension-middleware-cache

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

@prisma/orm-extension-paradedb

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

@prisma/orm-extension-pgvector

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

@prisma/orm-extension-postgis

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

@prisma/orm-extension-supabase

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

@prisma/orm-family-mongo

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

@prisma/orm-family-sql

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

@prisma/orm-framework

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

@prisma/orm-mongo

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

@prisma/orm-postgres

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

@prisma/orm-sqlite

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

@prisma/orm-target-mongo

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

@prisma/orm-target-postgres

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

@prisma/orm-target-sqlite

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

@prisma/orm-toolchain

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

commit: 4e19eec

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 172.72 KB (0%)
postgres / emit 149.89 KB (0%)
mongo / no-emit 101.15 KB (0%)
mongo / emit 91.01 KB (0%)
cf-worker / no-emit 197.16 KB (0%)
cf-worker / emit 171.8 KB (0%)

@wmadden
wmadden added this pull request to the merge queue Aug 18, 2026
@wmadden-electric
wmadden-electric removed this pull request from the merge queue due to a manual request Aug 18, 2026
@wmadden-electric
wmadden-electric added this pull request to the merge queue Aug 18, 2026
@wmadden-electric
wmadden-electric removed this pull request from the merge queue due to a manual request Aug 18, 2026
@wmadden-electric
wmadden-electric added this pull request to the merge queue Aug 18, 2026
@wmadden
wmadden removed this pull request from the merge queue due to a manual request Aug 18, 2026
@wmadden
wmadden merged commit 7934152 into main Aug 18, 2026
18 checks passed
@wmadden
wmadden deleted the fix/migration-graph-dot-human-block branch August 18, 2026 10:26
wmadden-electric added a commit to WhyAsh5114/prisma that referenced this pull request Aug 18, 2026
…nch window (prisma#30059)

Integration Tests is no longer a required check during the launch window
(until ~2026-08-21). Two changes, both marked for removal when the
requirement returns:

- The `test-integration` job in CI (PR) skips `merge_group` events — a
queue group was spending ~30 minutes of runner time on a check that
cannot block the merge. It still runs on every pull request, so the
people who want the signal keep getting it.
- `integration-nightly.yml` runs the same job on `main` every night at
03:00 UTC (and on `workflow_dispatch`). An unrequired check is exactly
how a red e2e sat silently on main from rc.2 until prisma#30057 — the nightly
run is what keeps regressions surfacing while nothing blocks on them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Integration tests now run nightly on the main branch and can also be
triggered manually.
- Integration tests are skipped for merge queue validation events while
continuing to run for pull requests and other supported events.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
wmadden-electric added a commit to WhyAsh5114/prisma that referenced this pull request Aug 18, 2026
…nals keep the stdout mirror (prisma#30060)

## What this closes

The last piece of the cli-engine 0.1.1 stream-suppression adoption. The
engine drops a command's stdout payload when both output streams are
TTYs, unless the host says they are separate devices via
`Runtime.outputStreamsShareDevice`. Our bin adapter never set the field,
so stdout and stderr routed to two different terminals were still
treated as one screen and the machine-readable stdout copy was dropped.
(prisma#30057 fixed the data-loss half — every payload now has a human mirror
— this fixes the over-suppression half.)

## The fix

`runtimeFromProcess` now compares the device and inode behind the two
streams' fds (`fstatSync`) and answers the field:

- same file identity → `true`: one screen, mirror suppressed, human copy
shown — unchanged behavior
- different identities → `false`: two sinks, both copies delivered
- no fd on a stream, or fstat fails → field stays absent and the engine
keeps its one-screen default, which is the safe common case

This also pre-empts prisma/prisma-cli#198, which makes the field
required — when the next engine version lands, this adapter already
answers.

## Tests

Four new cases in
`packages/1-framework/3-tooling/cli/test/orm/cli.test.ts` driving
`runtimeFromProcess` with real fds: same file twice → `true`, two files
→ `false`, fd-less streams → absent, unstat-able fd → absent.

Verified locally: cli package suite (1425 tests), `pnpm typecheck`,
`pnpm lint` — all green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Runtime detection now reports whether standard output and error
streams share the same device when this can be determined.
* **Bug Fixes**
* Improved handling of missing or invalid output stream descriptors by
returning an indeterminate result instead of failing.
* Improved configuration loading across environments with more reliable
module resolution.
* **Tests**
* Added coverage for shared devices, separate devices, unavailable or
invalid stream descriptors, and configuration loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
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