Skip to content

Improve deploy status and retry UX#26

Merged
luanvdw merged 4 commits into
mainfrom
feat/pr2-deploy-status-copy
May 25, 2026
Merged

Improve deploy status and retry UX#26
luanvdw merged 4 commits into
mainfrom
feat/pr2-deploy-status-copy

Conversation

@luanvdw
Copy link
Copy Markdown
Member

@luanvdw luanvdw commented May 22, 2026

Summary

  • Make local deploy setup one-time by writing .prisma/local.json before build/deploy and using a compact retry header afterward.
  • Replace misleading deploy progress with phase-based copy and a concise success block with Runtime logs.
  • Add explicit build-failure and runtime-failure copy, plus controller coverage for both paths.

Tests

  • pnpm --filter @prisma/cli exec vitest run tests/app-controller.test.ts tests/output.test.ts
  • pnpm --filter @prisma/cli build
  • pnpm --filter @prisma/cli test

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Phase-based deploy progress with clearer, shorter status lines.
    • Success output shows "Live in ", the URL on its own line, and a "Logs prisma-cli app logs" row.
    • --json output includes app/deploy identifiers, URL, and next steps.
  • Bug Fixes

    • First-time setup/customization prompts run only during initial binding and won’t repeat on failed deploy retries.
    • Deploy output no longer implies runtime readiness prematurely.
  • Documentation

    • Updated deploy and error output conventions and human-readable error templates.
  • Tests

    • Expanded tests for deploy output rendering and human-readable error handling.

Walkthrough

Adds phase-tracking state and phase-aware progress callbacks to preview deploy, writes local binding on first deploy, maps deploy failures to humanLines-aware CliError, simplifies deploy success output (duration + URL + logs row), updates related docs, and expands tests for output and failure scenarios.

Changes

App Deploy Progress and Error Handling

Layer / File(s) Summary
Progress state and error foundation
packages/cli/src/lib/app/preview-progress.ts, packages/cli/src/shell/errors.ts, packages/cli/src/shell/output.ts
Introduce PreviewDeployProgressState and factory, refactor progress creation to accept shared state and ui, add CliError.humanLines handling and early-path writeHumanError rendering.
Deploy controller wiring and failure mapping
packages/cli/src/controllers/app.ts
Thread progress state into provider.deployApp, write .prisma/local.json immediately on first bind with maybeRenderLocalPinBound, compute durationMs, stop passing showSubsequentAnnotations, refactor localPin lookup, and convert failures using appDeployFailedError(progress).
Deploy output rendering and types
packages/cli/src/lib/app/deploy-output.ts, packages/cli/src/presenters/app.ts, packages/cli/src/types/app.ts
Add renderDeployOutputRows and DeployOutputRow, simplify renderAppDeploy to Live in <duration>, optional URL, blank line, and Logs row; add durationMs to deploy result and formatDuration helper.
Docs: command, output, error conventions
docs/product/command-spec.md, docs/product/error-conventions.md, docs/product/output-conventions.md
Document first-deploy-only settings prompts and local pin write timing, structured multi-line build/deploy/runtime error examples with “Why”/“Fix”, and explicit deploy progress and success output wording and table styling.
Tests: output and failure scenarios
packages/cli/tests/output.test.ts, packages/cli/tests/app-controller.test.ts
Add tests for renderDeployOutputRows formatting and ANSI behavior, CliError humanLines cloning/normalization, and app deploy failure modes: build-failure (local pin written + BUILD_FAILED), post-build-before-runtime failure, and runtime failure with runtime-logs guidance; update PRISMA_PROJECT_ID expectation.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: improving deploy status messaging and retry user experience through better progress output, success formatting, and one-time setup.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the three main improvements: one-time setup via local.json, phase-based progress copy with concise success output, and explicit failure copy with test coverage.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pr2-deploy-status-copy
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/pr2-deploy-status-copy

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/controllers/app.ts`:
- Around line 2497-2521: The current CliError always uses the runtime-focused
headline and human message ("Runtime failed after the build completed.") even
when the failure occurred during deploy/upload/start; update the CliError
construction (the return new CliError({...}) block) to pick a phase-accurate
headline and humanLines first line based on progress.containerLive (or the same
phase logic used for meta.phase): e.g., if progress.containerLive is true keep
"Runtime failed after the build completed.", otherwise use "Deploy failed after
the build completed." Make the summary field and the first element of humanLines
conditional so the displayed message matches meta.phase.

In `@packages/cli/src/shell/errors.ts`:
- Line 49: Normalize the humanLines assignment so empty arrays become null and
non-empty arrays are cloned: replace the direct assignment to this.humanLines
from options.humanLines with logic that sets this.humanLines = null when
options.humanLines is falsy or has length === 0, otherwise set this.humanLines
to a shallow clone (e.g., [...options.humanLines]); update the
constructor/assignment site that currently uses "this.humanLines =
options.humanLines ?? null" to use this new normalization so downstream
rendering will fall back correctly when no human lines are provided.

In `@packages/cli/src/shell/output.ts`:
- Around line 71-81: The current conditional treats an empty array in
error.humanLines as truthy and can cause no output; change the guard in the
block that uses error.humanLines (the branch that builds lines, appends trace
via options.trace and error.debug, calls renderNextSteps and writeHumanLines) to
only run when humanLines is a non-empty array (e.g., check
Array.isArray(error.humanLines) && error.humanLines.length > 0); leaving the
rest of the logic (trace handling, renderNextSteps(error.nextSteps),
writeHumanLines(output, lines)) intact so errors with humanLines: [] fall
through to default formatting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32d8022d-a1b4-4986-a294-db8a5ad7b692

📥 Commits

Reviewing files that changed from the base of the PR and between eb17985 and 34f7498.

📒 Files selected for processing (10)
  • docs/product/command-spec.md
  • docs/product/error-conventions.md
  • docs/product/output-conventions.md
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/lib/app/preview-progress.ts
  • packages/cli/src/presenters/app.ts
  • packages/cli/src/shell/errors.ts
  • packages/cli/src/shell/output.ts
  • packages/cli/src/types/app.ts
  • packages/cli/tests/app-controller.test.ts

Comment thread packages/cli/src/controllers/app.ts Outdated
Comment thread packages/cli/src/shell/errors.ts Outdated
Comment thread packages/cli/src/shell/output.ts Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/controllers/app.ts`:
- Around line 2483-2485: The recovery copy uses an inconsistent CLI prefix;
update the command string(s) that currently read "prisma app logs --deployment
${progress.versionId}" to use the canonical prefix "prisma-cli" instead (so
"prisma-cli app logs --deployment ${progress.versionId}"). Edit the
recoveryLines definition (the const recoveryLines that depends on
progress.versionId) and any other occurrences in the same failure-path block
(the similar strings around lines 2510-2512) to replace "prisma " with
"prisma-cli" so all recovery messages use the same CLI invocation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e71e34ef-b54a-427b-a688-46cef978caeb

📥 Commits

Reviewing files that changed from the base of the PR and between 34f7498 and 54244df.

📒 Files selected for processing (11)
  • docs/product/command-spec.md
  • docs/product/error-conventions.md
  • docs/product/output-conventions.md
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/lib/app/deploy-output.ts
  • packages/cli/src/lib/app/preview-progress.ts
  • packages/cli/src/presenters/app.ts
  • packages/cli/src/shell/errors.ts
  • packages/cli/src/shell/output.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/output.test.ts

Comment thread packages/cli/src/controllers/app.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/cli/src/presenters/app.ts (1)

50-56: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep the success action labeled as Runtime logs.

The rest of this deploy flow is now phase-aware, but this row falls back to a generic Logs label. Renaming it keeps the success block aligned with the new build/deploy/runtime wording in this PR.

Suggested fix
-      { label: "Logs", value: "prisma-cli app logs" },
+      { label: "Runtime logs", value: "prisma-cli app logs" },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/presenters/app.ts` around lines 50 - 56, Update the success
action label in the deploy presenter: in the array assigned to lines (in
packages/cli/src/presenters/app.ts) change the deploy output row entry passed to
renderDeployOutputRows from { label: "Logs", value: "prisma-cli app logs" } to
use the new label "Runtime logs" so the success block is phase-aware and
consistent with build/deploy/runtime terminology.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/cli/src/presenters/app.ts`:
- Around line 50-56: Update the success action label in the deploy presenter: in
the array assigned to lines (in packages/cli/src/presenters/app.ts) change the
deploy output row entry passed to renderDeployOutputRows from { label: "Logs",
value: "prisma-cli app logs" } to use the new label "Runtime logs" so the
success block is phase-aware and consistent with build/deploy/runtime
terminology.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ad974083-c002-4642-978b-6a0bc5000a0d

📥 Commits

Reviewing files that changed from the base of the PR and between 54244df and f5daa95.

📒 Files selected for processing (6)
  • docs/product/command-spec.md
  • docs/product/error-conventions.md
  • docs/product/output-conventions.md
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/presenters/app.ts
  • packages/cli/tests/app-controller.test.ts

@luanvdw luanvdw merged commit b6c06c0 into main May 25, 2026
4 checks passed
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