Skip to content

feat(rack): list configured rack profiles - #4425

Merged
poroh merged 6 commits into
NVIDIA:mainfrom
poroh:feature/list-rack-profiles
Aug 1, 2026
Merged

feat(rack): list configured rack profiles#4425
poroh merged 6 commits into
NVIDIA:mainfrom
poroh:feature/list-rack-profiles

Conversation

@poroh

@poroh poroh commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Creating an expected rack requires a valid rack_profile_id, but clients previously could only inspect the effective profile of an existing rack through GetRackProfile.

This PR adds ListRackProfiles to the Rack API, allowing clients to discover all configured rack profile IDs and their definitions before calling AddExpectedRack. Results are sorted by profile ID and come directly from runtime configuration, so no existing rack database records are required.

It also adds nico-admin-cli rack profile list, with concise table output and complete profile definitions in JSON or YAML. The existing rack profile show behavior remains unchanged.

Related issues

Closes #4421

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

Rack profiles remain read-only runtime configuration. This change does not introduce persisted profile resources or profile mutation APIs.

@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary by CodeRabbit

  • New Features

    • Added the rack profile list CLI command to display configured rack profiles, including hardware, topology, class, and capability details.
    • Added table, JSON, and YAML output formats with sorting options.
    • Added API support for retrieving configured rack profiles in deterministic ID order.
  • Documentation

    • Added command documentation covering usage, options, examples, and supported sorting values.

Walkthrough

This change adds a Forge RPC and nico-admin-cli rack profile list command. The backend reads configured runtime profiles, sorts them by ID, and returns complete profile data. The CLI supports JSON, YAML, empty-result, and table output.

Changes

Rack profile listing

Layer / File(s) Summary
RPC contract and profile conversion
crates/rpc/..., rest-api/proto/...
The RPC returns configured profile IDs with complete, serializable profile definitions.
Backend listing and authorization
crates/api-core/src/api.rs, crates/api-core/src/handlers/rack.rs, crates/api-core/src/auth/internal_rbac_rules.rs, crates/api-core/tests/integration/*
The Forge service authorizes the operation, reads runtime configuration, sorts profile IDs, and covers populated and empty responses.
CLI command and rendered output
crates/admin-cli/src/rack/profile/..., crates/admin-cli/src/rack/tests.rs, crates/admin-cli/src/rpc.rs
The CLI parses rack profile list, calls the API, and renders structured or tabular profile details with capability summaries.
CLI command documentation
docs/manuals/nico-admin-cli/commands/rack/*
The documentation describes the command, options, sort values, example usage, and runtime configuration source.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant AdminCLI
  participant ApiClient
  participant Forge
  participant RackHandler
  participant RuntimeConfiguration

  Operator->>AdminCLI: run rack profile list
  AdminCLI->>ApiClient: list_rack_profiles()
  ApiClient->>Forge: ListRackProfiles(empty request)
  Forge->>RackHandler: list_rack_profiles()
  RackHandler->>RuntimeConfiguration: read configured rack_profiles
  RackHandler-->>Forge: sorted profile response
  Forge-->>ApiClient: ListRackProfilesResponse
  ApiClient-->>AdminCLI: configured profiles
  AdminCLI-->>Operator: render JSON, YAML, empty message, or table
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The REST API protobuf addition appears outside the linked issue scope because REST exposure was identified as future follow-up work. Remove the REST API protobuf changes from this PR, or link an explicit requirement that includes REST exposure and update the scope accordingly.
Docstring Coverage ⚠️ Warning Docstring coverage is 34.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: listing configured rack profiles.
Description check ✅ Passed The description directly explains the new API, CLI command, output formats, behavior, testing, and scope.
Linked Issues check ✅ Passed The implementation covers listing, deterministic ordering, empty results, conversion, authorization, Rust client access, CLI output, tests, and documentation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/api-core/tests/integration/rack_profile.rs (1)

79-138: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use one table-driven integration test for the listing cases.

These tests call ListRackProfiles with different runtime configurations. Combine the populated and empty cases into one scenario table. Keep each row’s expected ordered IDs and profile payloads explicit.

🤖 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/api-core/tests/integration/rack_profile.rs` around lines 79 - 138,
Combine list_rack_profiles_returns_configured_profiles_in_id_order and
list_rack_profiles_returns_empty_list_for_empty_configuration into one
table-driven integration test for ListRackProfiles. Define cases for populated
and empty configurations, with each case explicitly specifying the expected
ordered rack profile IDs and profile payloads, then iterate through the cases
while preserving the existing response assertions.

Source: Coding guidelines

🤖 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 `@docs/manuals/nico-admin-cli/commands/rack/rack-profile-list.md`:
- Around line 14-16: Update the DESCRIPTION section of the rack profile list
command documentation to state that it lists effective runtime-configured
profiles and that these profiles are not persisted rack resources.

---

Nitpick comments:
In `@crates/api-core/tests/integration/rack_profile.rs`:
- Around line 79-138: Combine
list_rack_profiles_returns_configured_profiles_in_id_order and
list_rack_profiles_returns_empty_list_for_empty_configuration into one
table-driven integration test for ListRackProfiles. Define cases for populated
and empty configurations, with each case explicitly specifying the expected
ordered rack profile IDs and profile payloads, then iterate through the cases
while preserving the existing response assertions.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 213f2393-8867-44df-a3da-280b69fc5ddd

📥 Commits

Reviewing files that changed from the base of the PR and between 395a11f and 989d044.

📒 Files selected for processing (17)
  • crates/admin-cli/src/rack/profile/args.rs
  • crates/admin-cli/src/rack/profile/list/args.rs
  • crates/admin-cli/src/rack/profile/list/cmd.rs
  • crates/admin-cli/src/rack/profile/list/mod.rs
  • crates/admin-cli/src/rack/profile/mod.rs
  • crates/admin-cli/src/rack/tests.rs
  • crates/admin-cli/src/rpc.rs
  • crates/api-core/src/api.rs
  • crates/api-core/src/auth/internal_rbac_rules.rs
  • crates/api-core/src/handlers/rack.rs
  • crates/api-core/tests/integration/main.rs
  • crates/api-core/tests/integration/rack_profile.rs
  • crates/rpc/build.rs
  • crates/rpc/proto/forge.proto
  • crates/rpc/src/model/rack_type.rs
  • docs/manuals/nico-admin-cli/commands/rack/rack-profile-list.md
  • docs/manuals/nico-admin-cli/commands/rack/rack-profile.md

Comment thread docs/manuals/nico-admin-cli/commands/rack/rack-profile-list.md Outdated
@poroh
poroh force-pushed the feature/list-rack-profiles branch from 989d044 to f0c75b0 Compare July 31, 2026 15:02
@poroh
poroh marked this pull request as ready for review July 31, 2026 15:08
@poroh
poroh requested review from a team and polarweasel as code owners July 31, 2026 15:08
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-31 15:13:42 UTC | Commit: f0c75b0

@poroh
poroh force-pushed the feature/list-rack-profiles branch from f0c75b0 to 6608d9b Compare July 31, 2026 15:21
@poroh poroh added the rack lifecycle Issues that relate to managing the lifecycle of a full rack (compute, switches and powershelves) label Jul 31, 2026
@aswaroop-nv

Copy link
Copy Markdown
Contributor

Should this also be implemented as a REST API endpoint given that the plan is to move admin operations to REST at some point?

@zhaozhongn

Copy link
Copy Markdown
Contributor

@kfelternv Can you include this for the next batch of REST API/TUI exposure of gRPC API?

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

I know that the manual files are generated, so pretend I put my suggestion in the appropriate source file 😂

Comment thread docs/manuals/nico-admin-cli/commands/rack/rack-profile-list.md Outdated
poroh and others added 2 commits July 31, 2026 15:02
Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
Co-authored-by: Alex Ball <awball@polarweasel.org>
Signed-off-by: Dmitry Poroh <dporoh@pm.me>
@poroh
poroh force-pushed the feature/list-rack-profiles branch from f2ff825 to c54c9f5 Compare July 31, 2026 22:03
Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
@polarweasel
polarweasel self-requested a review July 31, 2026 22:28
@poroh
poroh enabled auto-merge (squash) July 31, 2026 22:29
@poroh
poroh force-pushed the feature/list-rack-profiles branch from 379f775 to 9557bd8 Compare July 31, 2026 23:04
Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
@poroh
poroh force-pushed the feature/list-rack-profiles branch from 9557bd8 to a1ec8dd Compare July 31, 2026 23:14
poroh added 2 commits July 31, 2026 16:22
…rack-profiles

# Conflicts:
#	rest-api/proto/core/gen/v1/nico_nico.pb.go
…rack-profiles

# Conflicts:
#	rest-api/proto/core/gen/v1/nico_nico.pb.go
@poroh
poroh merged commit b2700d5 into NVIDIA:main Aug 1, 2026
123 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rack lifecycle Issues that relate to managing the lifecycle of a full rack (compute, switches and powershelves)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose configured rack profiles through the Rack API

5 participants