Skip to content

refactor(lifecycle): adopt style guide rules around pub/module visibility - #4663

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

refactor(lifecycle): adopt style guide rules around pub/module visibility#4663
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4553

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 lifecycle-controller crates.

Primary callouts are:

  • Replace 224 overbroad declarations across Machine-a-tron, Site Explorer, Machine Controller, State Controller, Preingestion Manager, and Machine Validation with private, pub(super), or pub(crate) visibility based on actual callers.
  • Keep cross-crate controller contracts and explicit integration-test support public where their callers still need them.
  • Scope internal state processors, handlers, metrics, simulator helpers, and test fixtures to their actual modules.
  • Remove an unused State Controller test field exposed during dead-code cleanup.
  • Leave the generated Machine Controller declarations owned by VSC-01 unchanged and preserve runtime behavior.

Tests updated!

Related issues

This supports #4553.

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

The targeted unit, integration, and doc-test suites for all six crates passed. I also ran:

make core/tests TEST_ARGS="-p carbide-machine-a-tron -p carbide-site-explorer -p carbide-machine-controller -p state-controller -p carbide-preingestion-manager -p carbide-machine-validation"
cargo make format-nightly
cargo make clippy
cargo make carbide-lints
cargo clippy --locked --all-targets --all-features -p carbide-machine-a-tron -p carbide-site-explorer -p carbide-machine-controller -p state-controller -p carbide-preingestion-manager -p carbide-machine-validation -- --force-warn unreachable-pub
git diff --check

Additional Notes

The initial compiler-backed visibility inventory identified 224 overbroad declarations across these six crates. The final 28-file diff resolves every tracked-source finding. The only remaining warnings are two generated Machine Controller declarations that are owned by VSC-01 and excluded from this issue.

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

Closes #4553

…lity

This adopts the new style guide rules around module visibility introduced in NVIDIA#4522, applying the correct visibility throughout the lifecycle-controller crates.

Primary callouts are:
- Replace 224 overbroad declarations across Machine-a-tron, Site Explorer, Machine Controller, State Controller, Preingestion Manager, and Machine Validation with private, `pub(super)`, or `pub(crate)` visibility based on actual callers.
- Keep cross-crate controller contracts and explicit integration-test support public where their callers still need them.
- Scope internal state processors, handlers, metrics, simulator helpers, and test fixtures to their actual modules.
- Remove an unused State Controller test field exposed during dead-code cleanup.
- Leave the generated Machine Controller declarations owned by VSC-01 unchanged and preserve runtime behavior.

Tests updated!

This supports NVIDIA#4553.

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 08:22
@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 complete review of PR #4663.

🐇 ✅

✅ Action performed

Full review finished.

@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: e3ba7d64-c657-40f1-8942-8c44850540fe

📥 Commits

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

📒 Files selected for processing (28)
  • crates/machine-a-tron/src/bmc_mock_wrapper.rs
  • crates/machine-a-tron/src/config.rs
  • crates/machine-a-tron/src/dhcp_wrapper.rs
  • crates/machine-a-tron/src/dpu_machine.rs
  • crates/machine-a-tron/src/host_machine.rs
  • crates/machine-a-tron/src/machine_fsm.rs
  • crates/machine-a-tron/src/machine_state_machine.rs
  • crates/machine-a-tron/src/machine_utils.rs
  • crates/machine-a-tron/src/power_shelf_fsm.rs
  • crates/machine-a-tron/src/switch_fsm.rs
  • crates/machine-controller/src/handler/dpf.rs
  • crates/machine-controller/src/handler/helpers.rs
  • crates/machine-controller/src/handler/maintenance.rs
  • crates/machine-controller/src/handler/power.rs
  • crates/machine-controller/tests/integration/env.rs
  • crates/machine-validation/src/machine_validation.rs
  • crates/preingestion-manager/src/errors.rs
  • crates/preingestion-manager/src/metrics.rs
  • crates/preingestion-manager/tests/integration/common.rs
  • crates/site-explorer/src/boot_order_tracker.rs
  • crates/site-explorer/src/credentials.rs
  • crates/site-explorer/src/endpoint_lock.rs
  • crates/site-explorer/src/managed_host.rs
  • crates/site-explorer/src/metrics.rs
  • crates/site-explorer/src/redfish.rs
  • crates/site-explorer/tests/integration/env.rs
  • crates/state-controller/src/controller/processor.rs
  • crates/state-controller/src/tests.rs

Summary by CodeRabbit

  • Refactor
    • Reduced the visibility of internal components and interfaces across machine management, validation, exploration, state control, and test modules.
    • Improved encapsulation by limiting access to implementation details within their intended scope.
    • Runtime behavior, workflows, and existing functionality remain unchanged.

Walkthrough

The pull request narrows Rust visibility across internal crates. Public types, functions, methods, fields, constants, and test helpers now use pub(super), pub(crate), or private visibility. Runtime behavior remains unchanged.

Changes

Internal visibility scope

Layer / File(s) Summary
Machine orchestration visibility
crates/machine-a-tron/src/*
Machine models, lifecycle methods, FSMs, DHCP helpers, utilities, state-machine APIs, and mock wrappers use narrower visibility.
Machine controller visibility
crates/machine-controller/src/handler/*, crates/machine-controller/tests/integration/env.rs
Handler entry points, helper traits, power and maintenance APIs, and integration-test builders use pub(super).
Preingestion and validation visibility
crates/preingestion-manager/src/*, crates/preingestion-manager/tests/integration/common.rs, crates/machine-validation/src/machine_validation.rs
Internal result types, metrics fields, integration helpers, and validation constants are no longer broadly exported.
Site explorer visibility
crates/site-explorer/src/*, crates/site-explorer/tests/integration/env.rs
Credential, Redfish, endpoint-lock, managed-host, boot-order, metrics, and test-environment APIs use narrower visibility.
State controller visibility
crates/state-controller/src/controller/processor.rs, crates/state-controller/src/tests.rs
The processor entry point and test-only state-controller types, fields, and persistence helpers use private or restricted visibility.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the visibility refactor across lifecycle-controller crates.
Description check ✅ Passed The description directly explains the visibility changes, affected crates, preserved behavior, and completed validation.
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 merged commit d301b6d into NVIDIA:main Aug 6, 2026
64 checks passed
@chet
chet deleted the gh-issue-4553 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 Lifecycle Controller Visibility

2 participants