Skip to content

Commit c982e9a

Browse files
TML-3900: Under --yes, the consent error says --yes is not sufficient (#399)
A user runs a command with `--yes`, and the command needs consent that `--yes` cannot give. Before: ```text ✘ [CLI.CONSENT_REQUIRED] This command requires explicit consent, and --yes does not give it. ``` After: ```text ✘ [CLI.CONSENT_REQUIRED] This command requires explicit consent for which --yes is not sufficient. ``` ## Why "--yes does not give it" reads oddly. The new sentence says the same thing in ordinary words: `--yes` accepts routine confirmations, and this consent needs more than that. ## The change One sentence in `consentMissing` (`packages/cli-engine/src/execution/prompts.ts`), which both `CLI.CONSENT_REQUIRED` errors use. The sentence without `--yes`, `This command requires explicit consent, but it was not provided.`, is unchanged. So are `why`, 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-engine` goes from 0.10.3 to 0.10.4, a patch. The two `dev`-channel exceptions in `packages/cli/scripts/conformance.ts` now name 0.10.4. As before, a CLI release is refused until `@prisma/orm-toolchain` and `@prisma/composer-cli` require this engine version, and the pull request that pins those releases removes the exceptions. Agent: hammurabi-19 Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
1 parent fc95f03 commit c982e9a

10 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎docs/reference/error-reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The config file's `$prismaConfig` marker declares a version other than the one t
184184

185185
### CLI.CONSENT_REQUIRED
186186

187-
A consent prompt was reached under `--yes` or in a non-interactive session. Consent has no default answer and `--yes` does not grant it, so there is nothing for the run to assume. The summary says the command requires explicit consent and did not get it (under `--yes`, that `--yes` does not give it), and `why` carries the consent's question. When the consent declares a token, the next action says to pass `--confirm <token>`, and the token travels in meta; without a token, the only path is running the command interactively. Meta: `consentToken` (only when the consent declares a token).
187+
A consent prompt was reached under `--yes` or in a non-interactive session. Consent has no default answer and `--yes` does not grant it, so there is nothing for the run to assume. The summary says the command requires explicit consent and did not get it (under `--yes`, that `--yes` is not sufficient), and `why` carries the consent's question. When the consent declares a token, the next action says to pass `--confirm <token>`, and the token travels in meta; without a token, the only path is running the command interactively. Meta: `consentToken` (only when the consent declares a token).
188188

189189
A statement prompt (`ctx.prompt.statement` or `ctx.prompt.statements`) raises the same code when no statement flag on the command line answers it. One error lists every question still unanswered: the summary is the same sentence, `why` carries the questions, and the next actions give one flag to pass per verb, such as `--delete Legacy` or `--rename 'Legacy:<new name>'`. `why` also lists every given statement flag that names none of the questions' subjects, and any `--confirm` token, which answers no statement, so a misspelled flag is reported before anyone answers a prompt. Meta: `unanswered` (a list of `{ subject, verbs }`), plus `subject` and `verbs` when exactly one question is unanswered; `unmatched` (a list of `{ verb, values }`) and `confirm` (the tokens) when any.
190190

‎packages/cli-engine/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prisma/cli-engine",
3-
"version": "0.10.3",
3+
"version": "0.10.4",
44
"description": "The execution engine of the unified Prisma CLI.",
55
"type": "module",
66
"exports": {

‎packages/cli-engine/src/execution/prompts.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ function answerWithoutAsking<T>(
441441

442442
function consentMissing(state: RunState): string {
443443
return state.yes
444-
? "This command requires explicit consent, and --yes does not give it."
444+
? "This command requires explicit consent for which --yes is not sufficient."
445445
: "This command requires explicit consent, but it was not provided.";
446446
}
447447

‎packages/cli-engine/tests/interaction-affordances.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe("consent tokens", () => {
192192
expect(withoutConfirm.exitCode).toBe(2);
193193
expect(errorOf(withoutConfirm)).toMatchObject({
194194
summary:
195-
"This command requires explicit consent, and --yes does not give it.",
195+
"This command requires explicit consent for which --yes is not sufficient.",
196196
why: "Delete the production database?",
197197
meta: { consentToken: "prod-db" },
198198
});

‎packages/cli-engine/tests/prompts.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ describe("consent", () => {
274274
code: "CLI.CONSENT_REQUIRED",
275275
severity: "error",
276276
summary:
277-
"This command requires explicit consent, and --yes does not give it.",
277+
"This command requires explicit consent for which --yes is not sufficient.",
278278
why: "Delete everything?",
279279
nextActions: [
280280
{

‎packages/cli-engine/tests/statement-prompts.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ describe("without a flag, a non-interactive run refuses", () => {
215215

216216
expect(result.exitCode).toBe(2);
217217
expect(errorOf(result)?.summary).toBe(
218-
"This command requires explicit consent, and --yes does not give it.",
218+
"This command requires explicit consent for which --yes is not sufficient.",
219219
);
220220
});
221221

‎packages/cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"dependencies": {
5151
"@manypkg/tools": "^2.1.2",
52-
"@prisma/cli-engine": "workspace:0.10.3",
52+
"@prisma/cli-engine": "workspace:0.10.4",
5353
"@prisma/composer-cli": "0.39.0",
5454
"@prisma/compute-sdk": "0.43.0",
5555
"@prisma/management-api-sdk": "1.80.0",

‎packages/cli/scripts/conformance.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ async function tarball(): Promise<readonly Finding[]> {
113113
{
114114
familyPackage: "@prisma/composer-cli",
115115
familyPin: "0.10.0",
116-
shellPin: "0.10.3",
116+
shellPin: "0.10.4",
117117
channel: "dev",
118118
reason:
119-
"engines 0.10.2 and 0.10.3 change the first line of the two consent refusals; composer-cli still peers 0.10.0",
119+
"engines 0.10.2 to 0.10.4 change the first line of the two consent refusals; composer-cli still peers 0.10.0",
120120
removeWhen:
121-
"composer-cli releases peering 0.10.3 and the follow-up bump PR pins that release",
121+
"composer-cli releases peering 0.10.4 and the follow-up bump PR pins that release",
122122
},
123123
{
124124
familyPackage: "@prisma/orm-toolchain",
125125
familyPin: "0.10.0",
126-
shellPin: "0.10.3",
126+
shellPin: "0.10.4",
127127
channel: "dev",
128128
reason:
129-
"engines 0.10.2 and 0.10.3 change the first line of the two consent refusals; orm-toolchain still peers 0.10.0",
129+
"engines 0.10.2 to 0.10.4 change the first line of the two consent refusals; orm-toolchain still peers 0.10.0",
130130
removeWhen:
131-
"orm-toolchain releases peering 0.10.3 and the follow-up bump PR pins that release",
131+
"orm-toolchain releases peering 0.10.4 and the follow-up bump PR pins that release",
132132
},
133133
],
134134
channel: CHANNEL,

‎packages/prisma/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@manypkg/tools": "^2.1.2",
53-
"@prisma/cli-engine": "workspace:0.10.3",
53+
"@prisma/cli-engine": "workspace:0.10.4",
5454
"@prisma/composer-cli": "0.39.0",
5555
"@prisma/compute-sdk": "0.43.0",
5656
"@prisma/management-api-sdk": "1.80.0",

‎pnpm-lock.yaml‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)