Skip to content

docs: note the full-pair requirement in fetch_host_primary_interface_mac#2722

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:explored-default-doc-clarity
Jun 23, 2026
Merged

docs: note the full-pair requirement in fetch_host_primary_interface_mac#2722
chet merged 1 commit into
NVIDIA:mainfrom
chet:explored-default-doc-clarity

Conversation

@chet

@chet chet commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What

Doc-clarity follow-up to #2721 (CodeRabbit's one optional chat note there). No behavior change -- a doc comment only.

#2721's doc comment on fetch_host_primary_interface_mac said a declared primary wins "when this report has that NIC." The actual gate (find_interface_id_for_mac) requires a full pair -- the MAC present on a system ethernet interface and a non-empty Redfish interface id. A declared NIC whose id this report hasn't resolved yet falls back to the automatic DPU-PF pick, same as the no-declaration case. This spells that out in the public doc so a reader of the doc alone doesn't expect any in-report MAC to win.

Notes

Part of #2662 (epic #2660).

@copy-pr-bot

copy-pr-bot Bot commented Jun 22, 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 Jun 22, 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: 4f75b501-1ace-4f81-96a1-eb7dde9ce73c

📥 Commits

Reviewing files that changed from the base of the PR and between c645b1f and a098673.

📒 Files selected for processing (1)
  • crates/api-model/src/site_explorer/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/api-model/src/site_explorer/mod.rs

Summary by CodeRabbit

  • New Features
    • Added support for specifying a preferred network interface configuration. The system automatically falls back to default selection logic if the preferred interface is unavailable.

Walkthrough

fetch_host_primary_interface_mac in EndpointExplorationReport gains a new declared_primary: Option<MacAddress> parameter. When a declared MAC is supplied and resolves to a valid system ethernet interface with a non-empty Redfish interface id via find_interface_id_for_mac, the method returns it immediately; otherwise, the existing lowest-PCI DPU host-PF fallback executes unchanged. Method documentation is updated to reflect this precedence.

Changes

Declared Primary MAC Override

Layer / File(s) Summary
fetch_host_primary_interface_mac signature, docs, and early-return logic
crates/api-model/src/site_explorer/mod.rs
Method signature extended with declared_primary: Option<MacAddress>; documentation updated to describe precedence and fallback; early-return branch added that returns the declared MAC when find_interface_id_for_mac resolves it to a non-empty interface id, otherwise delegating to the existing lowest-PCI DPU host-PF selection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • NVIDIA/infra-controller#2690: Introduces declared_primary_mac and primary_interface persistence and propagation in DHCP/promotion flows, which is the origin of the declared-primary concept this PR's override logic depends upon.
  • NVIDIA/infra-controller#2721: Makes the identical change to fetch_host_primary_interface_mac—adding declared_primary: Option<MacAddress> and the find_interface_id_for_mac early-return—indicating a direct predecessor or sibling branch for this PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly references the specific documentation change (full-pair requirement) being made to fetch_host_primary_interface_mac, accurately capturing the primary focus of this documentation-only PR.
Description check ✅ Passed The description comprehensively explains the documentation clarification, contextualizes the change relative to PR #2721, and clearly articulates why the full-pair requirement matters for users reading the public API documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@chet chet marked this pull request as ready for review June 22, 2026 17:08
@chet chet requested a review from a team as a code owner June 22, 2026 17:08

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

🧹 Nitpick comments (1)
crates/site-explorer/tests/site_explorer.rs (1)

2255-2303: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Use a table-driven test and include the unresolved-interface-id fallback case.

This block tests one operation across multiple input variants; please convert it to value_scenarios! (or check_values) and add a case where the declared MAC is present but does not resolve to a non-empty interface id, asserting fallback to the automatic pick.

As per coding guidelines, "Reach for a table whenever two or more tests call the same operation with different inputs" and "Use carbide_test_support::value_scenarios! macro for total operations."

🤖 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/site-explorer/tests/site_explorer.rs` around lines 2255 - 2303, The
test code contains multiple calls to fetch_host_primary_interface_mac with
different input variants that should be refactored using table-driven testing.
Convert this test block to use the value_scenarios! macro from
carbide_test_support to parametrize the different test cases (the automatic pick
case, declared DPU PF case, declared integrated NIC case, and absent MAC case).
Additionally, add a new test case scenario where a declared MAC is present in
the host report but does not resolve to a non-empty interface id, and verify
that it falls back to the automatic pick behavior, as this edge case is
currently missing from the test coverage.

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.

Nitpick comments:
In `@crates/site-explorer/tests/site_explorer.rs`:
- Around line 2255-2303: The test code contains multiple calls to
fetch_host_primary_interface_mac with different input variants that should be
refactored using table-driven testing. Convert this test block to use the
value_scenarios! macro from carbide_test_support to parametrize the different
test cases (the automatic pick case, declared DPU PF case, declared integrated
NIC case, and absent MAC case). Additionally, add a new test case scenario where
a declared MAC is present in the host report but does not resolve to a non-empty
interface id, and verify that it falls back to the automatic pick behavior, as
this edge case is currently missing from the test coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1fba53a3-04e4-4f36-9e74-1ef7747e8b95

📥 Commits

Reviewing files that changed from the base of the PR and between f947966 and c645b1f.

📒 Files selected for processing (3)
  • crates/api-model/src/site_explorer/mod.rs
  • crates/site-explorer/src/lib.rs
  • crates/site-explorer/tests/site_explorer.rs

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 264 6 23 99 6 130
machine-validation-runner 714 34 183 266 35 196
machine_validation 714 34 183 266 35 196
nvmetal-carbide 714 34 183 266 35 196
TOTAL 2412 108 572 903 111 718

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

The doc comment on fetch_host_primary_interface_mac (added with the
declared-primary support) said a declared primary wins "when this report
has that NIC", but the actual gate -- find_interface_id_for_mac -- needs a
full pair: the MAC present on a system ethernet interface AND a non-empty
Redfish interface id. A declared NIC whose id this report has not resolved
yet falls back to the automatic DPU-PF pick, alongside the no-declaration
case. Spell that out so a reader of the doc alone does not expect any
in-report MAC to win. Behavior is unchanged.

Part of NVIDIA#2662 (epic NVIDIA#2660).

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet

chet commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@chet chet force-pushed the explored-default-doc-clarity branch from c645b1f to a098673 Compare June 22, 2026 20:00
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown

@chet chet merged commit 86dd05c into NVIDIA:main Jun 23, 2026
56 checks passed
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.

2 participants