Skip to content

test(bmc): consolidate vendor ownership#4074

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4069
Jul 24, 2026
Merged

test(bmc): consolidate vendor ownership#4074
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4069

Conversation

@chet

@chet chet commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Canonical BMC vendor rules were spread across direct owners, wrapper tests, duplicate compute-tray adapters, and repeated integration assertions. This moves each matrix beside the production code it verifies, removes proven copies and unused helpers, and fills the vendor boundaries that had no direct coverage.

Related issues

Closes #4069.

Part of #3914.

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

  • Post-rebase cargo llvm-cov union across the nine focused package/filter invocations -- 44 passed

  • cargo make format-nightly

  • cargo make clippy

  • cargo make carbide-lints

  • Independent diff review -- no code findings

  • Local CodeRabbit review -- no findings

  • Local Claude review -- no correctness or compile defects

Additional Notes

Ownership and duplicate control

  • bmc-vendor now owns complete parsing, DMI classification, display, Pascal-case, and retained predicate tables.
  • Two byte-identical BMCVendor -> ComputeTrayVendor functions become one exhaustive From implementation beside ComputeTrayVendor.
  • API-model retains one delegation row and each missing-data fallback instead of repeating the owner's DMI matrix.
  • SSH's five overlapping config, round-trip, and serde entries become two owner tables plus one detection table.
  • Four repeated integration assertions are removed only from secondary cases; representative vendor assertions remain for each distinct hardware route.
  • Six unused selected functions and one never-constructed error variant are removed instead of receiving artificial tests.
  • The live Redfish converter remains in production and now has a complete 16-row table; site-explorer calls it when populating endpoint exploration reports.
  • The developer guide drops its reference to the removed TLS helper in the same change, so it does not describe an API that no longer exists.

Coverage

The measurements select the production vendor owners and adapters across bmc-vendor, API-model, component-manager, SSH-console, BMC-explorer, Redfish, and API-core.

Checkpoint Functions Lines Regions Focused executions
Original 10/30 76/213 100/264 38
Converted 10/24 76/182 100/227 36
Expanded 24/24 182/182 227/227 44

The converted checkpoint preserves every covered production line and region while duplicate/dead production removal reduces the selected denominator by six functions, 31 lines, and 37 regions. The expanded tables then add 106 covered lines and 127 covered regions, reaching every selected production function, line, and region.

The final expanded union was rerun after rebasing onto b01a70adf, which already contains #4030, and produced the same 24/24 function, 182/182 line, and 227/227 region totals.

Move canonical vendor matrices beside their production owners and replace the duplicated compute-tray adapters with one exhaustive conversion.

Trim wrapper and integration assertions to their own responsibilities, remove unused helpers, and cover previously untested parsing, transport, and adapter branches.

NVIDIA#4069
Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet requested review from a team and polarweasel as code owners July 24, 2026 04:27
@coderabbitai

coderabbitai Bot commented Jul 24, 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: 7585dd77-f855-4327-8f17-25c766b6a605

📥 Commits

Reviewing files that changed from the base of the PR and between e3363ef and f74ff94.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • crates/api-core/src/handlers/component_manager.rs
  • crates/api-core/src/handlers/firmware.rs
  • crates/api-model/src/hardware_info.rs
  • crates/api-model/src/machine/mod.rs
  • crates/bmc-explorer/Cargo.toml
  • crates/bmc-explorer/src/hw/mod.rs
  • crates/bmc-explorer/tests/integration/bluefield3_explore.rs
  • crates/bmc-explorer/tests/integration/powershelf_explore.rs
  • crates/bmc-vendor/Cargo.toml
  • crates/bmc-vendor/src/lib.rs
  • crates/component-manager/Cargo.toml
  • crates/component-manager/src/compute_tray_manager.rs
  • crates/component-manager/src/core_compute_manager.rs
  • crates/machine-controller/src/handler/maintenance.rs
  • crates/redfish/src/libredfish/conv.rs
  • crates/ssh-console/src/bmc/vendor.rs
  • docs/development/new_hardware_support.md
💤 Files with no reviewable changes (2)
  • crates/bmc-explorer/tests/integration/powershelf_explore.rs
  • crates/bmc-explorer/tests/integration/bluefield3_explore.rs

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency of BMC vendor classification across machine, Redfish, compute tray, and SSH console workflows.
    • Vendor parsing now trims surrounding whitespace and rejects invalid/blank values.
    • When hardware/DMI details are missing, vendor now reliably falls back to Unknown.
  • Breaking Changes
    • Removed legacy public BMC vendor helper methods from the public API.
  • Documentation
    • Updated hardware vendor parsing guidance.
  • Tests
    • Expanded unit and integration coverage for vendor mapping, serialization, and detection.

Walkthrough

The change consolidates BMC vendor parsing and classification tests, centralizes BMC-to-compute-tray conversion, adds adapter coverage, removes duplicated vendor assertions, and refactors SSH vendor serialization and detection tests.

Changes

Canonical vendor contracts

Layer / File(s) Summary
Canonical vendor behavior and classification tests
crates/bmc-vendor/src/lib.rs, crates/api-model/..., crates/api-core/src/handlers/firmware.rs, docs/development/...
BMC vendor predicates and parsing tests are expanded, while DMI delegation, missing-data fallback, trimmed firmware input, and parsing guidance are updated.
Machine vendor delegation
crates/api-model/src/machine/mod.rs
Machine tests verify vendor detection from DMI data and the unknown fallback when hardware information is absent.

Compute-tray conversion

Layer / File(s) Summary
Shared BMC-to-compute-tray mapping
crates/component-manager/..., crates/component-manager/Cargo.toml
A From<BMCVendor> implementation maps supported vendors to ComputeTrayVendor and maps unsupported variants to Unknown, with table-driven coverage.
Endpoint integration
crates/api-core/src/handlers/component_manager.rs, crates/machine-controller/src/handler/maintenance.rs
Compute-tray endpoints derive their vendor directly from machine.bmc_vendor() and remove duplicated local mapping helpers.
Redfish adapter coverage
crates/component-manager/src/core_compute_manager.rs
Tests cover supported compute-tray to Redfish vendor mappings and unmapped Nvidia/unknown cases.

Hardware and Redfish adapters

Layer / File(s) Summary
Hardware and Redfish vendor tables
crates/bmc-explorer/src/hw/mod.rs, crates/redfish/src/libredfish/conv.rs, crates/bmc-explorer/Cargo.toml
Tests cover all hardware-type vendor mappings and Redfish-to-BMC vendor conversions.
Explorer integration assertions
crates/bmc-explorer/tests/integration/*
Integration tests replace repeated report-vendor assertions with checks for Ethernet interfaces, endpoint type, machine setup status, synthesized systems, and aggregated power state.

SSH vendor boundaries

Layer / File(s) Summary
Detection and serialization test consolidation
crates/ssh-console/src/bmc/vendor.rs
The unused missing-DMI error variant is removed, and tests consolidate config-string mapping, TOML serialization validation, and host/DPU vendor detection scenarios.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR leaves the four vendor predicate helpers in place; the issue explicitly asked to remove them, but the diff only shows from_tls_issuer and is_lenovo_ami removed. Remove the unused predicate helpers from bmc-vendor, or document why they must stay, then align tests with the intended canonical surface.
Docstring Coverage ⚠️ Warning Docstring coverage is 59.09% 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 is concise and matches the main refactor: consolidating BMC vendor ownership and tests.
Description check ✅ Passed The description is on-topic and accurately describes the vendor-owner refactor and test consolidation.
Out of Scope Changes check ✅ Passed The diff stays focused on vendor ownership, adapter consolidation, tests, and related docs/deps; no unrelated feature work stands out.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

Copy link
Copy Markdown

@chet

chet commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review, thanks!

@chet
chet enabled auto-merge (squash) July 24, 2026 04:37
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@chet: I’ll perform a complete review of the PR, including the refactoring’s correctness, test coverage, duplicate-removal safety, and maintainability.

🐇🔍

✅ Action performed

Full review finished.

@chet
chet merged commit 5f4f9f7 into NVIDIA:main Jul 24, 2026
63 checks passed
@chet
chet deleted the gh-issue-4069 branch July 24, 2026 05:32
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.

test(bmc): consolidate vendor ownership

2 participants