Skip to content

feat(engine): a child-status settlement carries the command's own error - #276

Draft
AmanVarshney01 wants to merge 2 commits into
mainfrom
feat/engine-child-status-carries-error
Draft

AmanVarshney01 wants to merge 2 commits into
mainfrom
feat/engine-child-status-carries-error

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Sep 21, 2026

Copy link
Copy Markdown
Member

A command that delegates to a child (prisma deploy → Composer → alchemy) settles a failed child with exitWithChildStatus. In json mode the engine named every such failure CLI.CHILD_PROCESS_FAILED, even when the command had built a precise error (DEPLOY.ENGINE_FAILED with diagnostics). Automation sees only the generic code; in create-prisma 0.13.1 telemetry it is 14 of 65 deploy-path failures, none diagnosable.

  • exitWithChildStatus({ error }): an optional CliStructuredError. For a child that exited non-zero the json envelope carries it through the existing conversion (diagnosticOf, emitErrored). The engine still writes the child's exitCode/signal into error.meta, and the process still exits with the child's code.
  • Unchanged: exit 0, signal-killed children (still CLI.CHILD_PROCESS_FAILED), human/markdown output, and the envelope when no error is attached.
  • Engine 0.4.1 (pnpm bump-cli-engine-version patch).

Open, needs a maintainer decision: the bump makes check:conformance report 6 engine-pin-mismatch findings because composer-cli and orm-toolchain peer 0.4.0 exactly. Earlier bumps (#222, #224, #260) carried this with two transition entries in packages/cli/scripts/conformance.ts. They are NOT added here, so Test is red.

Follow-up in prisma/composer: settleConvergeFailure passes error: toEngineError(failure) once composer-cli peers engine 0.4.1.

Lint, typecheck, engine tests, check:error-reference and check-engine-version pass.

🤖 Generated with Claude Code

A command that delegates to a child process settles a failed child with
exitWithChildStatus, and in json mode the engine named every such
failure CLI.CHILD_PROCESS_FAILED. The command often knows a precise
structured error for the failure (Composer builds DEPLOY.ENGINE_FAILED)
but had no way to hand it over while still exiting with the child's
status, so automation saw only the generic code.

exitWithChildStatus now accepts `error`, a CliStructuredError. For a
child that exited non-zero, the json envelope carries that error's code,
summary, why, where and meta through the same conversion settleErrored
uses; its next actions lead the settlement's, and its accompanying
diagnostics are reported alongside it. The engine still writes the
child's exitCode and signal into error.meta from its own record, over
any keys of those names, and the process exit code is still the child's.

Unchanged: a child that exited 0, a signal-killed child (still
CLI.CHILD_PROCESS_FAILED with no next actions), human and markdown
output (the child owned the terminal, so the error is not printed), and
every settlement with no error attached.

Engine 0.4.1 (`pnpm bump-cli-engine-version patch`): the public surface
grew and 0.4.0 is already published.

Known failing: `pnpm check:conformance` reports engine-pin-mismatch,
because @prisma/composer-cli and @prisma/orm-toolchain peer the engine
exactly and still peer 0.4.0. Earlier engine bumps (#222, #224, #260)
carried this with transition entries in the conformance exception list;
that list is left empty here for a maintainer to decide.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c10e333

Shortens the added doc comments in spawn.ts and settlement.ts, restores
the neighbouring comments this branch reworded, folds the docs into one
bullet and one sentence, and cuts the new tests to three sharing one
setup. No behaviour change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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