Skip to content

fix: display job failures instead of throwing a CLIError - #251

Merged
madebydavid merged 7 commits into
mainfrom
248-bug-failed-shipthis-game-ship-results-in-uncaught-clierror
Aug 28, 2026
Merged

fix: display job failures instead of throwing a CLIError#251
madebydavid merged 7 commits into
mainfrom
248-bug-failed-shipthis-game-ship-results-in-uncaught-clierror

Conversation

@madebydavid

@madebydavid madebydavid commented Aug 28, 2026

Copy link
Copy Markdown
Member

This is to resolve #248

What's changed

  • Better failure template including the shipthis game job logs command
  • Showing 25 lines instead of 10
  • Don't show the log lines in follow mode (already shown)
  • Fixing bug where command would exit before last log lines shown
  • Separate ShipFailure component

Example - shipthis game ship

david@sal9000:~/game$ shipthis game ship --platform ios
# There was an error shipping your game

The iOS build failed (job 8dd796e7).

## What now?

    * The last 25 lines of each failed job are shown below
    * Read the full iOS log: shipthis game job logs 8dd796e7
    * See the iOS job in the ShipThis Dashboard https://develop.shipth.is/games/b8b2701f/job/8dd796e7

### Need help?

    * Join the Discord https://discord.gg/HuSvK4GT
    * Report an issue https://github.com/shipth-is/cli/issues

JOB LOGS - IOS
11:09:32.588 BUILD     [10:09:32]:  => 218:         bui
11:09:32.589 BUILD     [10:09:32]:     219:           workspace: use_workspace ? ENV['WORKSPACE_PATH']
11:09:32.590 BUILD     [10:09:32]:     220:	      project: !use_workspace ? ENV['PROJECT_PATH']
11:09:32.591 BUILD     [10:09:32]: ```
11:09:32.592 BUILD     +---------------------------------------------+
11:09:32.593 BUILD     |              fastlane summary               |
11:09:32.594 BUILD     +------+------------------------+-------------+
11:09:32.595 BUILD     | Step | Action                 | Time (in s) |
11:09:32.596 BUILD     +------+------------------------+-------------+
11:09:32.597 BUILD     | 1    | default_platform       | 0           |
11:09:32.598 BUILD     | 2    | import_certificate     | 0           |
11:09:32.599 BUILD     | 3    | install_provisioning_  | 0           |
11:09:32.600 BUILD     |      | profile                |             |
11:09:32.601 BUILD     | 4    | update_code_signing_s  | 0           |
11:09:32.602 BUILD     |      | ettings                |             |
11:09:32.603 BUILD     | 5    | update_project_provis  | 0           |
11:09:32.604 BUILD     |      | ioning                 |             |
11:09:32.605 BUILD     | 6    | update_project_team    | 0           |
11:09:32.606 BUILD     | 💥   | build_app              | 5           |
11:09:32.607 BUILD     +------+------------------------+-------------+
11:09:32.608 BUILD     [10:09:32]: fastlane finished with errors
11:09:32.991 BUILD     Fastlane failed, but continuing script
11:09:32.992 BUILD     Resetting default keychain to /Library/Keychains/System.keychain
11:09:34.033 BUILD     Failed to run the build script
11:09:34.034 SETUP     Failed to run the build script
david@sal9000:~/game$ 

Example - shipthis game ship --platform ios --follow

.... TRIMMED ...
[10:14:32]:     216:        end
[10:14:32]:     217:
[10:14:32]:  => 218:        build_app(
[10:14:32]:     219:          workspace: use_workspace ? ENV['WORKSPACE_PATH'] : nil,
[10:14:32]:     220:          project: !use_workspace ? ENV['PROJECT_PATH'] : nil,
[10:14:32]: ```
+---------------------------------------------+
|              fastlane summary               |
+------+------------------------+-------------+
| Step | Action                 | Time (in s) |
+------+------------------------+-------------+
| 1    | default_platform       | 0           |
| 2    | import_certificate     | 0           |
| 3    | install_provisioning_  | 0           |
|      | profile                |             |
| 4    | update_code_signing_s  | 0           |
|      | ettings                |             |
| 5    | update_project_provis  | 0           |
|      | ioning                 |             |
| 6    | update_project_team    | 0           |
| 💥   | build_app              | 5           |
+------+------------------------+-------------+
[10:14:32]: fastlane finished with errors
Fastlane failed, but continuing script
Resetting default keychain to /Library/Keychains/System.keychain
Failed to run the build script
Failed to run the build script
# There was an error shipping your game

The iOS build failed (job b4d5673d).

## What now?

    * Read the full iOS log: shipthis game job logs b4d5673d
    * See the iOS job in the ShipThis Dashboard https://develop.shipth.is/games/b8b2701f/job/b4d5673d

### Need help?

    * Join the Discord https://discord.gg/HuSvK4GT
    * Report an issue https://github.com/shipth-is/cli/issues
david@sal9000:~/game$ 

@madebydavid madebydavid linked an issue Aug 28, 2026 that may be closed by this pull request
@madebydavid
madebydavid marked this pull request as ready for review August 28, 2026 10:45
@madebydavid
madebydavid requested a balanced review from Copilot August 28, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves failed shipping output and prevents premature CLI termination while logs load.

Changes:

  • Adds platform-specific failure summaries and full-log commands.
  • Shows 25-line log tails outside follow mode.
  • Waits for failure logs before exiting and adds template tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
assets/markdown/ship-failure.md.ejs Expands failure guidance.
src/commands/game/ship.tsx Handles failed exits without CLIError.
src/components/JobLogTail.tsx Adds load callbacks and custom titles.
src/components/Ship.tsx Coordinates failure rendering and exit timing.
src/components/ShipFailure.tsx Adds reusable failure UI.
src/components/index.tsx Exports ShipFailure.
src/utils/ship/failure.ts Builds failure template data.
test/utils/ship/failure.test.ts Tests failure data and template output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

# There was an error shipping your game

**One or more of the jobs to build your game failed.**
<% if (failures.length === 1) { -%>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good find - i had forgotten!

@madebydavid

Copy link
Copy Markdown
Member Author

@copilot - updated the other caller, can you review again?

Co-authored-by: madebydavid <5401249+madebydavid@users.noreply.github.com>

Copilot AI commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@copilot - updated the other caller, can you review again?

Reviewed. The updated InitialAndroidBuild caller now correctly renders ShipFailure with the log tail, but it still used a fixed 1s setTimeout before calling onError, reintroducing the "exit before last log lines shown" bug for this caller. Fixed it to wait for ShipFailure's onLogsLoaded callback instead (same pattern as Ship.tsx), and restored onLogsLoaded as a required prop now that all callers pass it. Verified with lint, the full test suite, and a build.

@madebydavid

Copy link
Copy Markdown
Member Author

i will do some testing

@madebydavid

Copy link
Copy Markdown
Member Author

@copilot - after some testing i found some issues in the android wizard and have patched them up - could you re-review the code - please do not edit the code.

Copilot AI commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@copilot - after some testing i found some issues in the android wizard and have patched them up - could you re-review the code - please do not edit the code.

Reviewed 9abe38f without making edits, as requested.

The approach looks solid:

  • InitialAndroidBuild now surfaces failures via onError(new JobFailedError(job)) instead of rendering ShipFailure inline, which is simpler and consistent with how other errors propagate.
  • AndroidWizard.handleError correctly forwards the error to the wizard's onError prop instead of exiting directly.
  • game/wizard.tsx unmounts the full-screen alt-buffer UI before handling the error, matching the pattern already used in game/ship.tsx (unmount, then print/render in the normal buffer, then process.exit). JobFailedError renders ShipFailure with the log tail; other errors fall back to the plain chalk.red message.
  • job.project.id is valid (Job.project: Project has id), and the JobFailedError export/import chain through @cli/utils/errors.js and @cli/utils/index.js is correct.

I ran lint, the full test suite (158 passing), and a production build — all pass cleanly with no new errors or warnings introduced.

@madebydavid
madebydavid merged commit ff6e193 into main Aug 28, 2026
1 check passed
@madebydavid
madebydavid deleted the 248-bug-failed-shipthis-game-ship-results-in-uncaught-clierror branch August 28, 2026 13:35
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.

bug: failed shipthis game ship results in uncaught CLIError

3 participants