Skip to content

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

Draft
wmadden-electric wants to merge 2 commits into
mainfrom
statement-refusal-plain-words
Draft

wmadden-electric wants to merge 2 commits into
mainfrom
statement-refusal-plain-words

Conversation

@wmadden-electric

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.

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 <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…ne question or several, the engine is 0.10.1, and tests cover --yes with several questions

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary by CodeRabbit

  • Bug Fixes
    • Consent prompts now make unanswered questions clearer, distinguish single questions from multiple choices, and explain when --yes cannot select an answer.
    • Errors provide clearer guidance when statement flags or --confirm values do not match the available choices.
  • Documentation
    • Updated the consent error reference to explain 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.

Merge Risk: Minimal · up to 9a79f

This updates the wording of unanswered-question errors and bumps the engine version. Anything matching the old summary text will need updating, but no functional risk was found and the change looks ready to merge.

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 …
Description check Passed The description explains the problem (a command asks the user to choose and nobody can answer), shows before and after error output, and gives a table of the new summary and why text. It also covers t…
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.
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 problem (a command asks the user to choose and nobody can answer), shows before and after error output, and gives a table of the new summary and why text. It also covers the flag-message rewording, the unchanged error code and meta, and the version bump. It matches the changes in prompts.ts, the tests, and the package.json files.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Simplify code

  • Commit to this branch
  • Create a new PR
  • 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: 9a79fe2

@wmadden-electric
wmadden-electric marked this pull request as draft November 20, 2026 23:29
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