Skip to content

docs(design): ADR-0056 — prisma dev --serve runs a service's own dev command - #377

Merged
sneub merged 3 commits into
mainfrom
docs/adr-dev-command-serve
Oct 23, 2026
Merged

sneub merged 3 commits into
mainfrom
docs/adr-dev-command-serve

Conversation

@sneub

@sneub sneub commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Linked issue

n/a — design only. The implementation follows in a separate PR once this ADR is accepted.

Summary

A Next.js service under prisma dev runs its assembled standalone build. Every edit needs next build and a reconverge, and the service's logs don't show up in the terminal. Running next dev beside it doesn't work either, because nothing writes the address-free stash that service.input() and service.load() read, so input() throws env COMPOSER_INPUT is unset.

ADR-0056 decides the extension that local-dev.md § Out of scope sketched: prisma dev module.ts --serve web="next dev".

  • Per run. The flag is repeatable and is never declared on the service, so agents and CI keep artifact parity by default.
  • No assembly. The served service isn't assembled and lowers without its Deployment. lower() gains unassembled, and the service descriptor gains an optional reserve step. Its environment rows, its instance, its port and its dependents' URLs all stay as they are.
  • Same environment as run(). The command gets the deployment's materialized environment, re-stashed address-free by the same function run() uses, plus PORT and HOST, laid over the shell's environment.
  • Foreground. The command runs in the foreground with inherited stdio, so hot reload works and its logs are on screen. The instance keeps its port but runs no process, and the Compute emulator learns nothing new (ADR-0052).
  • Answers the four open questions:
    • Watch loop: other services still reconverge; the served one is never assembled or watched.
    • Environment change after a reconverge: the command restarts, and the changed keys are named (never their values).
    • --detach: refuses --serve.
    • prisma dev exec: would reuse only the environment function, not the process lifecycle.

Amends ADR-0041 (hot reload was left out, every service booted as deployed, the CLI supervised no process) and ADR-0053 (dev url reports served, dev stop ends a served command, --detach refuses --serve). Both ADRs carry amendment notes and the index is updated.

Testing performed

  • Doc-only. Ran node scripts/lint-control-bytes.mjs, node scripts/lint-framework-vocabulary.mjs and git diff --check; all pass.
  • Checked that every relative link in the ADR resolves.

Checklist

  • All commits are signed off (git commit -s) per the DCO. The DCO status check will block merge if any commit is missing a Signed-off-by: trailer.
  • I read CONTRIBUTING.md and the change is scoped to one logical concern.
  • The PR title is a conventional commit (feat, fix, chore, docs, refactor, test, build) — PR titles drive the auto-generated release notes.
  • Tests are updated (or n/a if the change is doc-only / refactor with no behavioural delta). n/a — doc-only.

Notes for the reviewer

  • The lowering change is the contentious part ("Lowering keeps the node and drops the deployment"). Skipping assembly alone isn't enough: lower() fails on a missing bundle, and dependents get the service's URL from the Deployment. reserve returns the URL from the App instead, which locally is the same localhost:<port>.
  • The CLI now owns one kind of process. If the served command exits, the session ends; there are no crash restarts.
  • Open calls you may want to bikeshed:
    • The flag name --serve, which overlaps with the serve() function in service-rpc. --dev-command is the alternative.
    • The command runs in the directory prisma dev was started from.
    • Output from several served commands isn't prefixed.
  • The ADR number may collide with a logs ADR from the parallel prisma dev logs work; whichever merges second renumbers.

…command

A Next.js service under `prisma dev` runs its assembled standalone build, so
every edit needs `next build` plus a reconverge, and its logs are not on the
terminal. Running `next dev` beside it fails because nothing writes the
address-free stash that `service.input()` and `service.load()` read.

ADR-0056 decides the extension that local-dev.md left open: a per-run
`--serve <address>=<command>` flag. The served service is not assembled. It
lowers without its Deployment, and its instance keeps its port but runs no
process. Its command runs in the foreground with inherited stdio, and gets the
deployment's environment re-stashed by the same function run() uses. The
ADR covers the watch loop, restarting the command when its environment
changes, the --detach conflict, and how a later `prisma dev exec` would reuse
the environment seam.

It amends ADR-0041 (hot reload was left out; every service booted as deployed;
the CLI supervised nothing) and ADR-0053 (dev url/dev stop/--detach). It also
points local-dev.md's out-of-scope note at the ADR.

Signed-off-by: Shane Neubauer <[email protected]>
@prisma-gizmo

prisma-gizmo Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Caution

Gizmo's review pass for 36d48fb failed before posting a review.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3e212f21-9ff0-4e58-8bc1-3046729d2937
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 37ac663

…d prisma dev runs it

Under `prisma dev`, a service runs the dev server its build adapter declares, in place of its built artifact, with no flag: `nextjs()` declares `next dev`, and `node()` declares none unless the author writes `dev: [...]` on it. The Compute emulator runs the dev server as a command deployment on the service's instance, so readiness, logs, crash supervision, restart on environment change, `--detach`, `dev stop` and session resume are unchanged and the dev session still owns no processes.

This replaces the per-run `--serve <address>=<command>` design: the adapter already knows the directory, the port flags and the binary, and the emulator already owns a process lifecycle. The ADR now specifies every type, route, event, message and sequence. The file is renamed to match the title; the amendment notes, the index and local-dev.md follow.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
@sneub
sneub marked this pull request as ready for review October 23, 2026 09:27
@sneub
sneub merged commit 0b4febc into main Oct 23, 2026
23 of 24 checks passed
@sneub
sneub deleted the docs/adr-dev-command-serve branch October 23, 2026 10:04
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