Repository navigation
TML-3900: Under --yes, the consent error says --yes is not sufficient - #399
Merged
Merged
Conversation
Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 45 minutes. View limit details
|
commit: |
wmadden
approved these changes
Nov 23, 2026
rome-xi
pushed a commit
to rome-xi/orm
that referenced
this pull request
Nov 23, 2026
…ys so in plain words (prisma#31179) A user removes the field `legacy` from the model `Shop` and runs `prisma migration plan` in a script. The plan would drop a column that holds data, so the command stops with an error. Before: ```text ✘ [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: ```text ✘ [CLI.CONSENT_REQUIRED] This command requires explicit consent, but it was not provided. 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 ``` Only the first line changes. ## Why the first line was a problem When a change would lose data, the command asks the user what they intend: is the field renamed, or deleted? In a terminal it asks with a prompt. In a script nobody can answer a prompt, so the user answers with a flag, `--rename` or `--delete`. If no flag answers the question, the command stops with the error above. The old first line described this in the CLI's internal vocabulary. "Statement" is the internal name for an answer given by flag, and "the session is not interactive" means the command could not show a prompt. A user who has never met either term could not tell from the line what went wrong. The new first line says what failed in plain words: the command needs the user's consent and did not get it. The `why` line already says what would be lost, and the next lines already give the exact flags, so those stay as they are. ## The change The ORM does not write the first line. It comes from `@prisma/cli-engine`, the library in prisma/prisma-cli that every Prisma CLI command runs on. Two engine changes reword it: prisma/prisma-cli#397 for the error above, and prisma/prisma-cli#398 for the engine's other consent error (see below). A third, prisma/prisma-cli#399, rewords the `--yes` form of the sentence. All three are in engine 0.10.4. This pull request moves the ORM from engine 0.10.0 to 0.10.4 and updates what depended on the old text: - 33 `package.json` files pin the engine at 0.10.4, and the lockfile follows. - The tests that assert the first line now assert the new one: two unit test files and 12 CLI journey test files. - An upgrade note under `upgrade-instructions/pending/cli-engine-0-10-4/` tells app and extension authors what to do if their scripts or tests matched the old line. No ORM source file changes. ## The other case: `--yes` `--yes` accepts ordinary confirmations, but it does not answer a question about losing data. In that case the old first line ended `which --yes cannot give`. It now reads: ```text ✘ [CLI.CONSENT_REQUIRED] This command requires explicit consent for which --yes is not sufficient. ``` ## The other consent error: `--confirm` The engine has a second error with the same code, for a yes/no consent that `--confirm <token>` answers. `prisma init` raises it when it would replace an existing project. Its first line used to quote the question. It now opens with the same sentence, and the question is in `why`: ```text ✘ [CLI.CONSENT_REQUIRED] This command requires explicit consent, but it was not provided. why: <the command's question> → Run the command interactively and type <token>, or pass --confirm <token>. ``` Two `prisma init` tests read the question from that first line; they now read it from `why`. The upgrade note covers both errors. ## What stays the same The error code, the exit code, the next-step lines and the error's `meta` in `--json` output. A script that reads any of those is unaffected. For the first error the `why` line is unchanged too. The first line used to name the subject (`"Shop.legacy"`), and it is now a fixed sentence. The subject is still in `meta.unanswered`, and the upgrade note points there. Tests in this repository that read the subject from the first line now read it from `meta.unanswered`. ## Also in this pull request Two project documents for the work on stating intent for destructive changes. Neither affects behaviour. - `projects/migration-statements/spec.md`: its example error is now the real output, and it links the terms it uses to the CLI style guide. - `projects/migration-statements/deferred.md`: records problems with these errors that manual testing and review found, for later work. They behave the same on `main`. ## Alternatives considered - **Rewrite the line inside the ORM.** The ORM could catch the engine's error and replace the first line. Every other product on the engine would keep the old line, and the ORM would carry a patch over its own dependency. The sentence is fixed where it is written. - **Put the data-loss sentence on the first line.** An earlier engine release, 0.10.1, moved the `why` text up to the first line and wrote a new generic `why`. Every CLI error has the same three parts: the first line says what failed, `why` gives the cause, and the next lines say what to do. That version moved the cause out of its place. Engine 0.10.2 replaced it, and nothing here uses it. - **Keep the subject in the first line.** A sentence such as `"Shop.legacy" requires explicit consent` reads badly when several questions are unanswered, and the `why` line already names each subject. Fixes TML-3900. Agent: hammurabi-19 --------- Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user runs a command with
--yes, and the command needs consent that--yescannot give.Before:
After:
Why
"--yes does not give it" reads oddly. The new sentence says the same thing in ordinary words:
--yesaccepts routine confirmations, and this consent needs more than that.The change
One sentence in
consentMissing(packages/cli-engine/src/execution/prompts.ts), which bothCLI.CONSENT_REQUIREDerrors use. The sentence without--yes,This command requires explicit consent, but it was not provided., is unchanged. So arewhy, the next steps,meta, the error code and the exit code.Three engine tests and one line of the error reference follow the new text.
Version and conformance
@prisma/cli-enginegoes from 0.10.3 to 0.10.4, a patch. The twodev-channel exceptions inpackages/cli/scripts/conformance.tsnow name 0.10.4. As before, a CLI release is refused until@prisma/orm-toolchainand@prisma/composer-clirequire this engine version, and the pull request that pins those releases removes the exceptions.Agent: hammurabi-19