Skip to content

TML-3900: When nobody can answer a command's question, the error leads with the question in plain words - #396

Merged
wmadden-electric merged 4 commits into
mainfrom
statement-refusal-plain-words
Nov 22, 2026
Merged

wmadden-electric merged 4 commits into
mainfrom
statement-refusal-plain-words

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

A command asks the user to choose what happens to something, and nobody can answer: the run is a script, or --yes was passed. The ORM's prisma migration plan is the first such command. A user removes a field, and the plan would drop a column that holds data.

Before:

✘ [CLI.CONSENT_REQUIRED] "Shop.legacy" needs a statement, and the session is not interactive.
  why: Drop column "legacy" from "Store Front" would lose the values of field "Shop.legacy".
→ Run the command again with --rename Shop.legacy:Shop.rating
→ Run the command again with --delete Shop.legacy

After:

✘ [CLI.CONSENT_REQUIRED] Drop column "legacy" from "Store Front" would lose the values of field "Shop.legacy".
  why: You have to choose what happens, and this run cannot ask you.
→ Run the command again with --rename Shop.legacy:Shop.rating
→ Run the command again with --delete Shop.legacy

The change

The old first line described the engine's prompt mechanism ("needs a statement", "the session is not interactive") in words a user does not know. The error conventions say the first line of an error says what failed. The command's own question already says that, so it becomes the first line, and the engine's sentence underneath uses plain words.

Case Summary why
One question unanswered the command's question You have to choose what happens, and this run cannot ask you.
One question, under --yes the command's question You have to choose what happens, and --yes does not choose for you.
Several questions 2 choices are needed, and this run cannot ask you. the questions, one per line

Two lines that report a flag which answered nothing are reworded the same way:

  • --delete Legcy answers no question; the questions are about Legacy, User.nickname. becomes --delete Legcy does not name Legacy or User.nickname.
  • --confirm mydb answers no consent in this run; a statement flag is what answers these questions. becomes --confirm mydb does not choose what happens; --rename or --delete does.

What does not change

The error code, the exit code, the next actions and meta. No type, field or function is added. Scripts that branch on the code or read meta are unaffected; anything that matched the old summary text needs the new text.

Version

@prisma/cli-engine goes from 0.10.0 to 0.10.1, as the engine version check requires for any change to the engine. Only error text changes, so it is a patch.

Conformance

@prisma/orm-toolchain and @prisma/composer-cli require engine 0.10.0 exactly, so the conformance check reports a mismatch once the engine is 0.10.1. Two exceptions in packages/cli/scripts/conformance.ts allow that mismatch, and they are limited to the dev channel. Pull request CI and the development build that every merge publishes pass. Until both products move, a development build installs two engine copies, 0.10.0 for the product commands and 0.10.1 for the shell; they differ only in this error text, and the exceptions allow that finding too. A release of the CLI is still refused until both products require 0.10.1, and the exceptions are removed in the pull request that pins those product releases. This is the route #390 took for engine 0.10.0, with the channel limit added. ADR 0004 now records it, including that the follow-up must pin both products in one pull request, because one that pins only the first passes its checks and is then refused at publish.

After this

The ORM asserts the old text in its tests and docs. It takes the new text when it moves to this engine version.

Agent: hammurabi-19

…d's question and says in plain words that the user has to choose

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ne question or several, the engine is 0.10.1, and tests cover --yes with several questions

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

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Summary by CodeRabbit

  • Bug Fixes
    • Consent prompts now present a single unanswered question directly, or summarize the number of unanswered questions and list them in the error details.
    • Errors clarify when --yes cannot choose among multiple answers, and explain when statement flags or --confirm values do not match the available choices.
    • Refusal messages list only the statement flags relevant to unanswered questions.
  • Documentation
    • Updated the consent error reference and guidance to describe how unanswered questions and unmatched values are reported.

Walkthrough

The CLI Engine now formats consent errors using the question text for one unanswered question and a choice count for multiple unanswered questions. The why field lists questions or explains unmatched statement flags and --confirm values. Tests and reference documentation reflect the updated messages. The CLI Engine package version and its workspace dependency references change to 0.10.1.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: when no one can answer a command's question, the error now leads with the question in plain words. It matches the summary and the objectives (command question becomes …
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 The description explains the change to the CLI engine's CONSENT_REQUIRED error text. It covers the before and after output, the summary and why lines for one and several unanswered questions, the rewo…
Full details: Title check

Explanation

The title names the main change: when no one can answer a command's question, the error now leads with the question in plain words. It matches the summary and the objectives (command question becomes the error summary). The ticket prefix is acceptable and the title is specific enough for a teammate scanning history. It is somewhat long at 103 characters.

Full details: Description check

Explanation

The description explains the change to the CLI engine's CONSENT_REQUIRED error text. It covers the before and after output, the summary and why lines for one and several unanswered questions, the reworded flag messages, the unchanged error code, exit code, next actions and meta, the 0.10.0 to 0.10.1 version bump, and the conformance exceptions. It matches the changeset, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

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: 2a3ca69a-78a6-4852-9530-7b4021935e8a
Commits

Reviewing files that changed from the base of the PR and between 6914c1d and 9a79fe2.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 7

  • docs/reference/error-reference.md
  • packages/cli-engine/package.json
  • packages/cli-engine/src/execution/prompts.ts
  • packages/cli-engine/tests/consent-leftovers.test.ts
  • packages/cli-engine/tests/statement-prompts.test.ts
  • packages/cli/package.json
  • packages/prisma/package.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@prisma/cli@396
npx https://pkg.pr.new/@prisma/cli-engine@396

commit: c948ca4

@wmadden-electric
wmadden-electric marked this pull request as draft November 20, 2026 23:29
…lchain and Composer CLI still require 0.10.0; a release is still refused until they match

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…of the refusal and how an engine change merges before the products require it; a test covers which flags the --confirm line names

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 22, 2026 22:34
@wmadden-electric
wmadden-electric enabled auto-merge (squash) November 22, 2026 22:34
@wmadden-electric
wmadden-electric merged commit bb14707 into main Nov 22, 2026
15 of 16 checks passed
@wmadden-electric
wmadden-electric deleted the statement-refusal-plain-words branch November 22, 2026 22:36
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.

1 participant