Skip to content

fix: add missing required flags to instance create help texts#25

Merged
ditahkk merged 1 commit into
zsoftly:mainfrom
cokerrd:fix/instance-create-flags
Jul 7, 2026
Merged

fix: add missing required flags to instance create help texts#25
ditahkk merged 1 commit into
zsoftly:mainfrom
cokerrd:fix/instance-create-flags

Conversation

@cokerrd

@cokerrd cokerrd commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #24

This PR fixes the zcp instance create command examples which were missing required flags, causing the command to fail when users copied and ran the examples.

Changes made

  • Added --network-plan and --storage-category to the example commands
  • Added validation checks for the storage category and network plan flags
  • Updated flag descriptions for the required flags
Screenshot 2026-07-06 at 01 42 17

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for instance creation by requiring storage category and network plan settings.
    • Clearer error messages now appear when those values are missing.
  • Documentation
    • Updated the instance creation example to better show waiting for completion and importing an SSH key.
    • Refreshed flag help text so required options and descriptions are clearer.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updated the instance create command in internal/commands/instance.go to require --storage-category and --network-plan flags, returning explicit errors when missing. Also updated the command's Example text and flag help descriptions to reflect these requirements.

Changes

Instance create required flags fix

Layer / File(s) Summary
Required flag validation and updated help text
internal/commands/instance.go
Adds validation errors for missing --storage-category and --network-plan, and updates the Example text and flag help descriptions for --storage-category, --compute-category, --blockstorage-plan, and --network-plan.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing missing required flags and help text for instance create.
Linked Issues check ✅ Passed The PR addresses #24 by enforcing --storage-category and --network-plan and updating the command help text.
Out of Scope Changes check ✅ Passed No unrelated changes are evident; the edits stay focused on instance create validation and documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/commands/instance.go (1)

387-392: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for the new required-flag validations.

No test evidence is provided confirming instance create returns the expected errors when --storage-category or --network-plan are omitted, unlike the existing TestNetworkCreateIsolatedRequiresNetworkPlan pattern for network create.

#!/bin/bash
# Confirm whether instance create already has tests for these required flags
rg -n 'instanceCreateExec|storage-category is required|network-plan is required' internal/commands/commands_test.go
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/commands/instance.go` around lines 387 - 392, Add test coverage for
the new required-flag checks in instance create by extending the existing
command tests around instanceCreateExec in commands_test.go. Add cases that omit
--storage-category and --network-plan separately, then assert the command
returns the same validation errors currently produced by the storageCategory and
networkPlan checks in internal/commands/instance.go, following the style of
TestNetworkCreateIsolatedRequiresNetworkPlan for expected-error assertions.
Ensure the tests exercise the instance create path directly so the required-flag
behavior is verified end to end.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/commands/instance.go`:
- Around line 387-392: Add test coverage for the new required-flag checks in
instance create by extending the existing command tests around
instanceCreateExec in commands_test.go. Add cases that omit --storage-category
and --network-plan separately, then assert the command returns the same
validation errors currently produced by the storageCategory and networkPlan
checks in internal/commands/instance.go, following the style of
TestNetworkCreateIsolatedRequiresNetworkPlan for expected-error assertions.
Ensure the tests exercise the instance create path directly so the required-flag
behavior is verified end to end.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7ad7152-a60d-496c-ba68-7cb5605de527

📥 Commits

Reviewing files that changed from the base of the PR and between cdd3ccf and e3f07cc.

📒 Files selected for processing (1)
  • internal/commands/instance.go

@ditahkk ditahkk 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.

Thanks for contribution

@ditahkk ditahkk merged commit 5695f07 into zsoftly:main Jul 7, 2026
12 checks passed
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] instance create examples fail due to missing required flags

2 participants