fix(domain): add --domain validation and fix spinner leaks in domain create
Summary
- Add missing
--domainflag validation in non-interactive mode β previously, omitting--domainwould pass an empty string to the API, producing a confusing server error - Fix spinner goroutine leaks in 3 error paths where
s.Stop()was not called before returning
Changes
| Location | Fix |
|---|---|
runCreateDomainNonInteractive |
Add --domain empty check with clear error message |
runCreateDomainNonInteractive line 192 |
Call s.Stop() before returning on AddDomain error |
runCreateDomainInteractive line 111 |
Call s.Stop() before returning on CheckDomainAvailable error |
runCreateDomainInteractive line 128 |
Call s.Stop() before returning on ListDomains error |
Reproducing the bug
# Missing --domain: previously sent empty string to API
zeabur domain create --id <service-id> -g -i=false
# Before: confusing API error
# After: "Error: --domain is required in non-interactive mode"
Test plan
- [ ] Verify
domain create --id <id> -i=falsewithout--domainreturns clear error - [ ] Verify
domain create --id <id> --domain test -g -i=falsestill works - [ ] Verify spinner does not leak on API errors (no lingering animation in terminal)
π€ Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- Enhanced error handling in domain creation to prevent application hangs and ensure proper cleanup when errors occur
- Added validation requiring the domain name parameter in non-interactive mode
- Improved failure handling during domain operations to maintain system stability and prevent incomplete transactions
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3f7dd3b0-e462-4b41-a529-632e925686b9
π₯ Commits
Reviewing files that changed from the base of the PR and between b209bd1104b1d661908dbdc21c59175844ce77d2 and e1f3cb16324cdd39fc65d32b316afa78a6bd96a5.
π Files selected for processing (1)
internal/cmd/domain/create/create.go
π§ Files skipped from review as they are similar to previous changes (1)
- internal/cmd/domain/create/create.go
π Walkthrough
Walkthrough
The domain creation command now stops spinners on interactive availability and listing failures, validates that non-interactive mode receives a non-blank --domain value, and stops the spinner when non-interactive domain addition fails.
Possibly related PRs
- zeabur/cli#217: Updates the interactive domain availability failure path in the same command.
π₯ 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 |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title clearly summarizes the main changes: non-interactive --domain validation and spinner cleanup in domain creation. |
| 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. |
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.
Comment @coderabbitai help to get the list of available commands.
@pan93412 I addressed the requested CodeRabbit feedback in e1f3cb1 by rejecting whitespace-only domain names with strings.TrimSpace. The refreshed build-test, golangci-lint, CodeQL, and CodeRabbit checks are all green, and CodeRabbit approved the new commit. This is ready for re-review when you have a chance.