Skip to content

refactor(bmc/console): adopt style guide rules for pub/module visibility - #4662

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4554
Aug 6, 2026
Merged

refactor(bmc/console): adopt style guide rules for pub/module visibility#4662
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4554

Conversation

@chet

@chet chet commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This adopts the new style guide rules around module visibility introduced in #4522, applying the correct visibility throughout the BMC and console group.

Primary callouts are:

  • Replace unrestricted pub across ssh-console, bmc-explorer, bmc-proxy, ipmi, host-support, redfish, and nvue-client with private, pub(super), pub(crate), or named-ancestor visibility based on actual callers.
  • Keep the BMC explorer and Redfish test-support surfaces public where downstream crate and integration-test callers rely on them.
  • Restrict ssh-console's BMC connection tree to its parent module while keeping frontend messages and vendor types available at the crate boundaries that use them.
  • Make binary entrypoints, configuration internals, implementation types, helper methods, and test utilities visible only where their callers need them.
  • Preserve public library APIs, error surfaces, serialized configuration, test fixtures, and runtime behavior.

Tests updated!

Related issues

This supports #4554.

This supports the updated Rust visibility scoping guidelines in STYLE_GUIDE.md, established in #4522.

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.)

All 208 touched-crate unit and integration tests passed, including the ssh-console integration suite. I also ran:

cargo test --locked --all-features -p carbide-ssh-console -p bmc-explorer -p carbide-bmc-proxy -p carbide-ipmi -p carbide-host-support -p carbide-redfish -p nvue-client
cargo clippy --locked --all-targets --all-features -p carbide-ssh-console -p bmc-explorer -p carbide-bmc-proxy -p carbide-ipmi -p carbide-host-support -p carbide-redfish -p nvue-client --message-format short -- --force-warn unreachable-pub
cargo make format-nightly
cargo make clippy
cargo make carbide-lints
git diff --check

Additional Notes

The initial visibility lint identified 192 overbroad declarations across 40 files. Narrowing those parent items exposed 145 contained fields and helpers whose visibility could move with them; the final 43-file diff tightens 337 declarations. The unrestricted public surfaces left are backed by cross-crate callers, integration-test consumers, or intentional root re-exports.

Local CodeRabbit, read-only Claude, and self-reviews completed over the full diff. All applicable findings are incorporated.

Closes #4554

This adopts the new style guide rules around module visibility introduced in NVIDIA#4522, applying the correct visibility throughout the BMC and console group.

Primary callouts are:
- Replace unrestricted `pub` across `ssh-console`, `bmc-explorer`, `bmc-proxy`, `ipmi`, `host-support`, `redfish`, and `nvue-client` with private, `pub(super)`, `pub(crate)`, or named-ancestor visibility based on actual callers.
- Keep the BMC explorer and Redfish test-support surfaces public where downstream crate and integration-test callers rely on them.
- Restrict ssh-console's BMC connection tree to its parent module while keeping frontend messages and vendor types available at the crate boundaries that use them.
- Make binary entrypoints, configuration internals, implementation types, helper methods, and test utilities visible only where their callers need them.
- Preserve public library APIs, error surfaces, serialized configuration, test fixtures, and runtime behavior.

Tests updated!

This supports NVIDIA#4554.

This supports the updated Rust visibility scoping guidelines in `STYLE_GUIDE.md`, established in NVIDIA#4522.

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet requested a review from a team as a code owner August 6, 2026 07:53
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9f28cd73-d12a-4407-a444-935f7483bec1

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0e11f and d04f4aa.

📒 Files selected for processing (43)
  • crates/bmc-explorer/src/chassis.rs
  • crates/bmc-explorer/src/computer_system.rs
  • crates/bmc-explorer/src/inventories.rs
  • crates/bmc-explorer/src/manager.rs
  • crates/bmc-explorer/src/network_adapter.rs
  • crates/bmc-explorer/tests/integration/common.rs
  • crates/bmc-proxy/src/acl.rs
  • crates/bmc-proxy/src/bmc_proxy.rs
  • crates/bmc-proxy/src/config.rs
  • crates/bmc-proxy/src/main.rs
  • crates/bmc-proxy/src/metrics.rs
  • crates/bmc-proxy/src/net.rs
  • crates/bmc-proxy/src/setup.rs
  • crates/host-support/src/hardware_enumeration/gpu.rs
  • crates/host-support/src/hardware_enumeration/tpm.rs
  • crates/host-support/src/registration.rs
  • crates/ipmi/src/bmc_mock.rs
  • crates/ipmi/src/test_support.rs
  • crates/ipmi/src/tool.rs
  • crates/nvue-client/src/client.rs
  • crates/redfish/src/libredfish/implementation.rs
  • crates/ssh-console/src/bmc/client.rs
  • crates/ssh-console/src/bmc/client_pool.rs
  • crates/ssh-console/src/bmc/connection.rs
  • crates/ssh-console/src/bmc/connection_impl/ipmi.rs
  • crates/ssh-console/src/bmc/connection_impl/mod.rs
  • crates/ssh-console/src/bmc/connection_impl/ssh.rs
  • crates/ssh-console/src/bmc/message_proxy.rs
  • crates/ssh-console/src/bmc/mod.rs
  • crates/ssh-console/src/bmc/pending_output_line.rs
  • crates/ssh-console/src/bmc/vendor.rs
  • crates/ssh-console/src/console_logger.rs
  • crates/ssh-console/src/frontend.rs
  • crates/ssh-console/src/io_util.rs
  • crates/ssh-console/src/main.rs
  • crates/ssh-console/src/metrics.rs
  • crates/ssh-console/src/ssh_cert_parsing.rs
  • crates/ssh-console/src/ssh_server.rs
  • crates/ssh-console/tests/util/ipmi_sim.rs
  • crates/ssh-console/tests/util/metrics.rs
  • crates/ssh-console/tests/util/mod.rs
  • crates/ssh-console/tests/util/ssh_client.rs
  • crates/ssh-console/tests/util/ssh_console_test_helper.rs

Summary by CodeRabbit

  • Refactor
    • Restricted internal APIs and implementation details to their appropriate modules.
    • Reduced exposure of configuration, hardware discovery, networking, proxy, metrics, SSH console, and test-support components.
    • Preserved existing runtime behavior, command-line handling, parsing, networking, and hardware detection behavior.

Walkthrough

The PR narrows public Rust APIs to crate, parent-module, or private visibility across BMC exploration, proxy, host-support, IPMI, Redfish, NVUE, SSH-console, and test-support code. Runtime behavior and method signatures remain unchanged.

Changes

Internal API visibility refactor

Layer / File(s) Summary
BMC explorer visibility
crates/bmc-explorer/src/*.rs, crates/bmc-explorer/tests/integration/common.rs
Exploration types, fields, helpers, model conversions, and test utilities now use crate or private visibility.
Supporting crate visibility
crates/bmc-proxy/src/*.rs, crates/host-support/src/**/*.rs, crates/ipmi/src/*.rs, crates/nvue-client/src/client.rs, crates/redfish/src/libredfish/implementation.rs
Internal configuration, service, hardware, client, and helper APIs now use crate or parent-module visibility.
SSH console runtime visibility
crates/ssh-console/src/**/*.rs
BMC connection, proxy, server, frontend, metrics, logging, IO, certificate, and vendor APIs now use crate or module visibility.
SSH console test-support visibility
crates/ssh-console/tests/util/*.rs
Test modules, fixtures, simulators, assertions, and helper types now use crate or parent-module visibility.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the visibility refactor in the BMC and console modules.
Description check ✅ Passed The description directly explains the visibility changes, affected crates, preserved behavior, and validation performed.
Docstring Coverage ✅ Passed Docstring coverage is 94.94% which is sufficient. The required threshold is 80.00%.
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

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

@chet

chet commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@chet Full review requested for PR #4662.

ᕱᕱ

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 11 minutes.

@chet

chet commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@chet I will perform a full review of PR #4662.

🐇

✅ Action performed

Full review finished.

@chet
chet enabled auto-merge (squash) August 6, 2026 14:34
@chet
chet merged commit 7b7717c into NVIDIA:main Aug 6, 2026
64 checks passed
@chet
chet deleted the gh-issue-4554 branch August 6, 2026 16:40
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.

Tighten BMC and Console Visibility

2 participants