Skip to content

fix: 8 reliability issues in cloud ship command#74

Open
JoshSalway wants to merge 5 commits intolaravel:mainfrom
JoshSalway:fix/ship-reliability
Open

fix: 8 reliability issues in cloud ship command#74
JoshSalway wants to merge 5 commits intolaravel:mainfrom
JoshSalway:fix/ship-reliability

Conversation

@JoshSalway
Copy link

@JoshSalway JoshSalway commented Mar 16, 2026

Summary

Fixes 8 reliability issues in cloud ship that affect both interactive and non-interactive usage. This is the flagship onboarding command — these fixes make the experience match its ambition.

Closes #73

Context: This PR builds on other improvements

This work is part of a broader effort to make the CLI production-ready:

While this PR has several changes, each fix is surgical and targeted. The test suite (#43) validates nothing is broken.

Fixes

Critical

1. waitForUrlToBeReady infinite loop — Added 120-second timeout and treats redirects as success. Previously, a 3xx/4xx response (common with CloudFlare, fresh deploys) caused the spinner to run forever.

High

2. Non-interactive mode continues after "repo exists" error — Added return self::FAILURE so execution stops instead of falling through to create a duplicate app.

3. $environment->instances[0] crash — Added waitForInstance() helper that polls until the instance is provisioned (60s timeout). Previously crashed with undefined offset when the instance was not yet ready.

Medium

4. Database provisioning race condition — Retry handler now retries on any error during provisioning, not just "please wait" messages. Added max retry count.

5. .env parse errors silently swallowed — Now shows warning() with the parse error message so users know their env vars were not imported.

6. confirm() prompt in non-interactive mode — Gated "Open site in browser?" behind $this->isInteractive() so it does not crash in CI.

Low

7. createApplicationNonInteractively no error handling — Wrapped in try/catch with friendly error message instead of raw stack trace.

8. tryToSetAvatar catches Throwable too broadly — Narrowed to catch (RequestException) so genuine bugs are not silently swallowed.

Test plan

  • ./vendor/bin/pest — all 384 tests pass
  • ./vendor/bin/phpstan analyse — 0 errors
  • Run cloud ship interactively — should complete full flow without hanging
  • Run cloud ship --no-interaction — should fail cleanly if repo already has an app
  • Deploy an app that fails — should show error reason (see feat: auto-show deployment logs on failure #75 for log display)

Generated with Claude Code

Josh Salway and others added 5 commits March 17, 2026 02:51
Increases test coverage from 3/87 commands (~3%) to 43/87 (~49%),
following the Laravel Forge CLI pattern of one test file per command.

Commands now tested:
- Auth: auth, auth:token
- Application: create, get, update, delete
- Environment: create, get, list, update, delete, variables
- Domain: create, delete, list, verify
- Database: cluster create/delete/list, database create/delete/list
- Cache: create, delete, list
- Bucket: create, delete, list
- Instance: create, delete, list, update
- WebSocket: cluster create/delete/list, application create/delete
- Background Process: create, delete, list
- Command: run, list

Bugs documented in tests (skipped with references to PR laravel#42):
- 7 commands catch wrong RequestException class (Illuminate vs Saloon)
- ApplicationUpdate has no error handling for API failures
- DatabaseDelete catches Throwable which swallows CommandExitException
- DomainCreate missing non-interactive defaults
- CacheDelete/BucketDelete missing --json option

Refs laravel#41

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…3 files

Coverage now at ~95% of commands (80/87). Remaining untested:
Browser, Dashboard, Completions (utility commands that open browser/generate shell),
Ship (tested via refactor PR laravel#54), and DeployMonitor (complex polling).

New test files cover:
- Application: list (expanded)
- BackgroundProcess: get, update
- Bucket: get, update
- BucketKey: create, delete, get, list, update
- Cache: get, types, update
- Command: get
- DatabaseCluster: get, update
- Database: get, open, restore create
- DatabaseSnapshot: create, delete, get, list
- DedicatedCluster: list
- Deployment: get, list
- DeployMonitor: basic smoke test
- Domain: get, update
- EnvironmentLogs: basic test
- Instance: get, sizes
- IpAddresses: list, filter
- AuthToken: list, reveal
- WebSocket: app get/list/update, cluster get/update
- RepoConfig: git detection

Additional bugs found and filed:
- laravel#55: DatabaseRestoreCreate completely broken (TypeError)
- laravel#56: DatabaseSnapshotCreate missing CLI options
- laravel#57: DatabaseClusterUpdate unusable non-interactively

352 tests, 381 assertions, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add global options to BaseCommand so that application and environment
can be specified explicitly via --application and --environment flags,
removing the requirement to run commands from within a matching project
directory. The resolution priority is: explicit flag > local config >
git remote/branch detection > interactive prompt.

Closes laravel#61, refs laravel#62

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the missing CLI commands for starting and stopping environments.
The client code (EnvironmentsResource::start/stop and corresponding request
classes) already existed — this adds the Artisan commands and tests.

Closes laravel#65, relates to laravel#69

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses critical, high, medium, and low severity bugs that affect
reliability in both interactive and CI/non-interactive usage.

Fixes laravel#73

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JoshSalway

This comment was marked as spam.

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: cloud ship has 8 issues affecting reliability in both interactive and non-interactive modes

1 participant