chore: Remove deprecated flat fields from NetworkSegment object - #4450
chore: Remove deprecated flat fields from NetworkSegment object#4450nvlitagaki wants to merge 3 commits into
Conversation
Signed-off-by: Leah Itagaki <litagaki@nvidia.com>
Summary by CodeRabbit
WalkthroughNetworkSegment removes deprecated flat protobuf fields and uses structured configuration, status, metadata, and dedicated history RPCs. RPC conversion, CLI output, test fixtures, and API tests now use the structured representation. ChangesNetworkSegment structured-field migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test eced758 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
🌿 Preview your docs: https://nvidia-preview-pull-request-4450.docs.buildwithfern.com/infra-controller |
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-07-31 18:50:21 UTC | Commit: eced758 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/admin-cli/src/network_segment/show/cmd.rs (1)
277-302: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winMove the state-history fetch inside the non-JSON branch.
show_network_informationfetches state history unconditionally at line 291, before thejsoncheck. Thejsonbranch only serializessegment, neverhistory. Ifget_segment_state_historyfails, the?operator aborts the whole call, including the--jsonoutput path that does not need history data at all.Move the history fetch into the
elsebranch so a history-retrieval failure cannot break the JSON output path.🔧 Proposed fix to scope the history fetch to the branch that needs it
- let history = api_client.get_segment_state_history(segment_id).await?; - if json { println!("{}", serde_json::to_string_pretty(&segment)?); } else { + let history = api_client.get_segment_state_history(segment_id).await?; println!( "{}", convert_network_to_nice_format(segment, Some(history), api_client).await? ); }🤖 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 `@crates/admin-cli/src/network_segment/show/cmd.rs` around lines 277 - 302, Move the get_segment_state_history call from the unconditional portion of show_network_information into the non-JSON else branch, immediately before convert_network_to_nice_format. Keep the JSON branch limited to serializing segment so it does not depend on history retrieval.
🤖 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.
Outside diff comments:
In `@crates/admin-cli/src/network_segment/show/cmd.rs`:
- Around line 277-302: Move the get_segment_state_history call from the
unconditional portion of show_network_information into the non-JSON else branch,
immediately before convert_network_to_nice_format. Keep the JSON branch limited
to serializing segment so it does not depend on history retrieval.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: b59d3dac-8d12-433a-b7c3-62131dc135e2
⛔ Files ignored due to path filters (1)
rest-api/proto/core/gen/v1/nico_nico.pb.gois excluded by!**/*.pb.go,!**/gen/**,!rest-api/**/*.pb.go
📒 Files selected for processing (11)
crates/admin-cli/src/devenv/config/apply/cmd.rscrates/admin-cli/src/instance/show/cmd.rscrates/admin-cli/src/network_segment/show/cmd.rscrates/api-core/src/tests/network_segment.rscrates/api-core/src/tests/network_segment_find.rscrates/rpc/proto/forge.protocrates/rpc/src/model/network_segment.rscrates/rpc/src/model/state_history.rsrest-api/db/pkg/db/model/subnet_test.gorest-api/proto/core/src/v1/nico_nico.protorest-api/site-workflow/pkg/grpc/server/nico_test_server.go
💤 Files with no reviewable changes (3)
- crates/api-core/src/tests/network_segment_find.rs
- crates/rpc/src/model/state_history.rs
- rest-api/db/pkg/db/model/subnet_test.go
Since the REST API no longer relies on the deprecated NetworkSegment (called Subnet in REST API docs) fields that were relocated to the Metadata, NetworkSegmentConfig and NetworkSegmentStatus, we can now go ahead and remove those fields. This work removes fallback logic to those deprecated fields that was present in the admin cli and updates tests as necessary.
Related issues
(#2796)
Type of Change
Breaking Changes
Direct clients of the gRPC API for VPCs will be forced to migrate to the structured fields, but we do not guarantee that the gRPC API is backward-compatible (https://github.com/NVIDIA/infra-controller/blob/main/docs/development/release_and_qa_process.md#what-is-explicitly-not-guaranteed)
Testing
Additional Notes