Skip to content

fix: show ips on instance get and list#37

Open
cokerrd wants to merge 4 commits into
zsoftly:mainfrom
cokerrd:fix/instance-ip-display
Open

fix: show ips on instance get and list#37
cokerrd wants to merge 4 commits into
zsoftly:mainfrom
cokerrd:fix/instance-ip-display

Conversation

@cokerrd

@cokerrd cokerrd commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Adresses #36

  • This primary resolves instance ips not displaying on list and get
  • Secondarily resolves the billing cycle not also displaying on get command
  • Added additional test cases for list and get mehtods
  • Lastly it adds a - instead of leaving it blank when the instance doesn't have an ip or isn't assigned one, this personally improves the readability, but this can be reverted if its the standard
Screen.Recording.2026-07-10.at.11.32.05.mov

Summary by CodeRabbit

  • Bug Fixes

    • Improved public IP display in instance list and detail views.
    • Corrected billing cycle information shown for instances.
    • Added fallback handling when network or IP address data is unavailable.
    • Improved handling of empty instance lists and missing instances.
  • Tests

    • Added coverage for empty list responses and not-found errors.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@cokerrd, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d1092ea-e903-4a34-9def-1856bcf444a9

📥 Commits

Reviewing files that changed from the base of the PR and between 1917418 and 3cafc9a.

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

Walkthrough

VM API models now include IP address and offering data, with helpers deriving display values. Instance list/get commands use those helpers and offering billing-cycle data, while service response tests cover empty lists and not-found errors.

Changes

VM output data

Layer / File(s) Summary
API VM data and helpers
pkg/api/instance/instance.go, pkg/api/instance/instance_test.go
VM payloads model IP addresses and offerings; IP helpers derive private/public values; list requests include network data; empty-list and not-found responses are tested.
Instance command rendering
internal/commands/instance.go
Instance list/get output uses the derived public IP, and billing cycle data comes from the VM offering.

Estimated code review effort: 3 (Moderate) | ~20 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 IP display in instance get and list.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
pkg/api/instance/instance.go (1)

180-185: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider renaming IPAddresses struct to IPAddress (singular).

The struct represents a single IP address entry, but the plural name IPAddresses makes the slice field []IPAddresses read as "a slice of IPAddresses" (redundant plural). Renaming to IPAddress would make []IPAddress clearer.

♻️ Optional naming refactor
-type IPAddresses struct {
+type IPAddress struct {
 	ID        string `json:"id"`
 	IPAddress string `json:"ipaddress"`
 	Type      string `json:"type"`
 }

And update the field type:

-	IPAddresses          []IPAddresses   `json:"ipaddresses"`
+	IPAddresses          []IPAddress     `json:"ipaddresses"`
🤖 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 `@pkg/api/instance/instance.go` around lines 180 - 185, Rename the IPAddresses
struct to IPAddress and update all references, including slice fields such as
[]IPAddresses, to use []IPAddress for consistent singular element naming.
🤖 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.

Inline comments:
In `@internal/commands/instance.go`:
- Around line 205-208: Guard the billing cycle access in the billing cycle
initialization by checking both vm.Offering and vm.Offering.BillingCycle for nil
before reading Name, preserving the previous nil-safe behavior.
- Around line 219-220: Rename the variable `pubicIP` to `publicIP` and update
all references, including the usage near line 230.

In `@pkg/api/instance/instance.go`:
- Around line 128-146: Update the instance retrieval path used by Service.Get to
append the query parameter include=networks,ipaddresses when requesting the
virtual machine by slug. Locate the relevant Service.Get method and ensure its
API request asks for expanded network and IP address data required by
VirtualMachine.GetPublicIPAddress.

---

Nitpick comments:
In `@pkg/api/instance/instance.go`:
- Around line 180-185: Rename the IPAddresses struct to IPAddress and update all
references, including slice fields such as []IPAddresses, to use []IPAddress for
consistent singular element naming.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50ef0757-18a6-4e6e-b10b-948e97a31e56

📥 Commits

Reviewing files that changed from the base of the PR and between 514a588 and 1917418.

📒 Files selected for processing (3)
  • internal/commands/instance.go
  • pkg/api/instance/instance.go
  • pkg/api/instance/instance_test.go

Comment thread internal/commands/instance.go
Comment thread internal/commands/instance.go Outdated
Comment thread pkg/api/instance/instance.go
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.

1 participant