fix(domain): add --domain validation and fix spinner leaks in domain create#222
Conversation
…create In non-interactive mode, `domain create` proceeds with an empty domain name if --domain is not provided, causing a confusing API error. Add validation to require the --domain flag. Also fix spinner goroutine leaks where s.Stop() is not called before returning on error in both interactive and non-interactive paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe domain creation command now stops spinners on interactive availability and listing failures, validates that non-interactive mode receives a non-blank Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/cmd/domain/create/create.go`:
- Around line 167-169: The current non-interactive validation only checks
opts.domainName == "" and allows whitespace-only names; change the check to trim
whitespace (e.g., use strings.TrimSpace on opts.domainName) and treat a trimmed
empty string the same as missing, returning the existing error
fmt.Errorf("--domain is required in non-interactive mode"); update the
validation in the same function where opts.domainName is currently checked so
whitespace-only inputs are rejected early.
🪄 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: CHILL
Plan: Pro
Run ID: a1eeadaf-a745-4546-b8e1-d7173cb19c6a
📒 Files selected for processing (1)
internal/cmd/domain/create/create.go
pan93412
left a comment
There was a problem hiding this comment.
You need to resolve CodeRabbit's suggestion (or explain why their suggestion is invalid)
|
@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. |
Summary
--domainflag validation in non-interactive mode — previously, omitting--domainwould pass an empty string to the API, producing a confusing server errors.Stop()was not called before returningChanges
runCreateDomainNonInteractive--domainempty check with clear error messagerunCreateDomainNonInteractiveline 192s.Stop()before returning onAddDomainerrorrunCreateDomainInteractiveline 111s.Stop()before returning onCheckDomainAvailableerrorrunCreateDomainInteractiveline 128s.Stop()before returning onListDomainserrorReproducing the bug
Test plan
domain create --id <id> -i=falsewithout--domainreturns clear errordomain create --id <id> --domain test -g -i=falsestill works🤖 Generated with Claude Code
Summary by CodeRabbit