Skip to content

feat: surface initError on the build when deploy fails - #71

Open
jonoirwinrsa wants to merge 6 commits into
mainfrom
feat/show-init-error
Open

feat: surface initError on the build when deploy fails#71
jonoirwinrsa wants to merge 6 commits into
mainfrom
feat/show-init-error

Conversation

@jonoirwinrsa

@jonoirwinrsa jonoirwinrsa commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

When a deploy fails terminally (e.g. capacity unavailable, init_failure), upstream writes a user-facing message to build.initError. The CLI was already polling build status but discarded initError, so the user only saw ✗ Build failed with status: init_failure with no actionable detail.

This adds InitError to the AppBuild API type, threads it through buildStatusUpdateMsg → buildCompleteMsg → logDrainCompleteMsg, and prints it after the failure line in both SimpleOutput and interactive modes.

Test plan

  • go build ./...
  • go test ./internal/ui/commands/...
  • TestDeployView_initErrorReachesOutput covers the plumbing end to end: a failing build fetched from GetBuild through to stdout in simple output mode, plus an empty initError printing nothing extra. Verified both subtests fail when the field is dropped at either hop.
  • Trigger a capacity failure on dev — verify the CLI prints the capacity message after the failure line in both --simple and interactive modes.
  • Trigger a non-capacity init_failure (e.g. crashing app) — verify nothing regresses; if initError is not populated, only the existing failure line should print.

Not covered by the tests: the json:"initError" tag (the client is mocked, so no wire decoding happens) and the interactive tea.Println scrollback, whose text is not reachable from View().

🤖 Generated with Claude Code

When a deploy hits a terminal failure (e.g. capacity unavailable,
init_failure), the backend now writes a user-facing message to the
build's initError field synchronously. The CLI was polling the build
status but discarding initError, so the user only saw
"✗ Build failed with status: init_failure" with no actionable detail.

This wires initError through buildStatusUpdateMsg →
buildCompleteMsg → logDrainCompleteMsg and prints it after the failure
line in both SimpleOutput and interactive modes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jonoirwinrsa
jonoirwinrsa requested a review from wesrobin May 7, 2026 19:19
Comment thread internal/ui/commands/deploy.go Outdated
Comment thread internal/api/types.go Outdated
jonoirwinrsa and others added 2 commits May 8, 2026 14:43
No functional difference between nil and empty in this case, so the
non-pointer type is simpler to work with.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both struct types share the same fields, so use Go's type conversion as
the original code did rather than a struct literal (staticcheck S1016).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jonoirwinrsa
jonoirwinrsa requested review from Hkhan161 and removed request for elijah-rou August 11, 2026 20:37
jonoirwinrsa and others added 2 commits August 11, 2026 17:24
The message is only carried by the poll → complete → drain messages and
printed to scrollback, so a dropped field is invisible to the existing
tests. Drive a failing build from GetBuild through to stdout in simple
output mode, and pin that an empty initError prints nothing extra.

Co-Authored-By: Claude Opus 5 (1M context) <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.

2 participants