Skip to content

Use runtime host firmware config in upgrade flows#3061

Merged
rahmonov merged 1 commit into
NVIDIA:mainfrom
rahmonov:consume-firmware-config
Jul 2, 2026
Merged

Use runtime host firmware config in upgrade flows#3061
rahmonov merged 1 commit into
NVIDIA:mainfrom
rahmonov:consume-firmware-config

Conversation

@rahmonov

@rahmonov rahmonov commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Apply DB-backed host firmware config overrides on top of static and metadata.toml firmware catalogs across firmware listing, desired firmware snapshotting, site explorer, host reprovisioning, machine update handling, and preingestion.

Runtime config now participates in version comparison and upgrade selection, while metadata remains the base catalog and DB values take precedence when they overlap.

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

Testing

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

@copy-pr-bot

copy-pr-bot Bot commented Jul 1, 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 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Host firmware settings now support runtime overrides layered on top of the standard firmware catalog.
    • Firmware snapshots used across exploration and upgrades now incorporate per-host stored configuration overrides.
  • Bug Fixes
    • Fixed firmware RPC handling to correctly await async firmware endpoint results.
    • Improved upgrade/preingestion firmware selection to prefer an exact version match, falling back to defaults when needed.
  • Documentation
    • Updated the host firmware configuration endpoint description in the OpenAPI spec.
  • Tests
    • Added integration tests covering merged runtime + catalog behavior and upgrade triggering.

Walkthrough

This PR adds host firmware override support to firmware snapshots, then updates API, explorer, update, and preingestion flows to read DB-backed override snapshots. It also adjusts tests and the OpenAPI description.

Changes

Firmware Override Snapshot Pipeline

Layer / File(s) Summary
Model, DB, and snapshot merge logic
crates/api-model/src/firmware.rs, crates/api-db/src/host_firmware_config.rs, crates/firmware/src/config.rs, crates/firmware/src/tests/config.rs
HostFirmwareConfig is added, DB rows store that type, snapshot creation applies override merges, and tests cover merge behavior and runtime/default selection.
API firmware handlers and response shaping
crates/api-core/src/api.rs, crates/api-core/src/handlers/firmware.rs, crates/api-core/src/tests/host_firmware_config.rs, rest-api/openapi/spec.yaml
Firmware RPC handlers become async, use effective snapshots backed by host overrides, and preserve optional explicit-start semantics through merge and response mapping; API call sites, tests, and the OpenAPI description are updated.
Site explorer override snapshot
crates/api-core/src/handlers/site_explorer.rs, crates/site-explorer/src/lib.rs
SiteExplorer and endpoint enrichment now load host firmware overrides from the database and use override-aware snapshots.
Machine update, controller, and preingestion flows
crates/api-core/src/machine_update_manager/host_firmware.rs, crates/machine-controller/src/handler.rs, crates/preingestion-manager/Cargo.toml, crates/preingestion-manager/src/lib.rs, crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
Refresh, upgrade, and preingestion flows switch to DB-backed firmware snapshots, refresh on host config changes, and select continuation firmware by exact final version or default fallback.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Api as api::api.rs
  participant Handler as handlers::firmware
  participant DB as api-db::host_firmware_config
  participant FirmwareConfig

  Client->>Api: request
  Api->>Handler: get_desired_firmware_versions(self, request).await
  Handler->>DB: list_configs(...)
  DB-->>Handler: host firmware configs
  Handler->>FirmwareConfig: create_snapshot_with_overrides(configs)
  FirmwareConfig-->>Handler: FirmwareConfigSnapshot
  Handler-->>Api: entries
  Api-->>Client: response
Loading
sequenceDiagram
  participant Manager as preingestion-manager
  participant DB as api-db::host_firmware_config
  participant FirmwareConfig
  participant Selection as select_firmware_for_artifact_continuation

  Manager->>DB: list_configs(db)
  DB-->>Manager: host firmware configs
  Manager->>FirmwareConfig: create_snapshot_with_overrides(configs)
  FirmwareConfig-->>Manager: FirmwareConfigSnapshot
  Manager->>Selection: select by final_version or default
  Selection-->>Manager: selected firmware entry
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% 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 describes the main change: runtime host firmware config is used in upgrade flows.
Description check ✅ Passed The description matches the changeset and accurately summarizes DB-backed runtime config overrides across upgrade-related flows.
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.

@rahmonov

rahmonov commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 1, 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.

@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: 2

🧹 Nitpick comments (3)
crates/api-db/src/host_firmware_config.rs (1)

113-145: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use impl DbReader for these read-only helpers.

list, list_configs, and summary do not mutate state, but these &mut PgConnection signatures force downstream callers to open and commit transactions just to read. Accepting impl DbReader here would remove that boilerplate and let pool-backed callers stay out of transactions. As per coding guidelines, crates/api-db/**/*.rs: "Prefer accepting impl DbReader as a connection in read-only database functions to allow callers to pass a PgPool and avoid transaction boilerplate."

🤖 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-db/src/host_firmware_config.rs` around lines 113 - 145, The
read-only helpers in host_firmware_config currently force mutable PgConnection
access, which makes callers use unnecessary transactions. Update list,
list_configs, and summary to accept impl DbReader instead of &mut PgConnection,
and keep their query logic the same so pool-backed callers can invoke them
without transaction boilerplate.

Source: Coding guidelines

crates/preingestion-manager/src/lib.rs (1)

3113-3141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a table-driven test for the selector cases.

These two tests call the same operation with different inputs; consolidate them with value_scenarios! or check_values. As per coding guidelines, “Use table-driven test style when writing tests in Rust.”

🤖 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/preingestion-manager/src/lib.rs` around lines 3113 - 3141, The two
tests around select_firmware_for_artifact_continuation are duplicating the same
setup and assertion pattern, so consolidate them into a table-driven test.
Refactor the cases into a single parameterized test using value_scenarios! or
check_values, keeping the existing scenarios for the final-version preference
and default fallback while varying only the requested version and expected
selected version.

Source: Coding guidelines

crates/api-core/src/handlers/firmware.rs (1)

87-98: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the repeated snapshot-building block into a shared helper.

The begin-txn → list_configs → commit → create_snapshot_with_overrides sequence in effective_host_firmware_snapshot is duplicated nearly verbatim in crates/api-core/src/handlers/site_explorer.rs (inline in refresh_endpoint_report), crates/site-explorer/src/lib.rs (firmware_config_snapshot), and crates/preingestion-manager/src/lib.rs (PreingestionManagerStatic::firmware_config_snapshot) — four independent copies with three different names. Any future change (error handling, isolation level, filtering by vendor) has to be applied consistently in all four places, which is easy to miss.

Consider hoisting this into a single function (e.g. on FirmwareConfig in carbide-firmware, or a free function in api-db) that takes a PgPool/impl DbReader plus the base FirmwareConfig/Arc<FirmwareConfig> and returns the effective snapshot, then have all four call sites delegate to it.

🤖 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/src/handlers/firmware.rs` around lines 87 - 98, The begin-txn
→ list_configs → commit → create_snapshot_with_overrides flow is duplicated
across effective_host_firmware_snapshot, refresh_endpoint_report,
firmware_config_snapshot, and
PreingestionManagerStatic::firmware_config_snapshot. Extract that
snapshot-building logic into one shared helper (for example on FirmwareConfig or
as a free function in api-db) that accepts a DB reader/pool plus the base
FirmwareConfig/Arc<FirmwareConfig> and returns the effective
FirmwareConfigSnapshot, then update all four call sites to delegate to it.
🤖 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 `@crates/firmware/src/config.rs`:
- Around line 296-299: The runtime override merge in the Firmware config update
is overwriting explicit_start_needed even when the override omits it, which
clears the base catalog value. Update the override handling around the cur_model
assignment in the config merge path to use tri-state semantics (for example,
Option<bool>) so only a present value updates explicit_start_needed and omission
preserves the existing value. Keep the behavior consistent with the other merged
fields in the same block and the override application logic that feeds
cur_model.

In `@crates/preingestion-manager/src/lib.rs`:
- Around line 519-539: The host firmware lookup in find_fw_info_for_host is
bypassing the snapshot’s full model resolution logic by only using
endpoint.report.model(), which can miss matches stored in the explicit
report.model field. Update this method to reuse
FirmwareConfigSnapshot::find_fw_info_for_host (or the same model-selection logic
it uses) after obtaining the snapshot from firmware_config_snapshot, so
vendor/model matching behaves consistently with the snapshot’s lookup semantics.

---

Nitpick comments:
In `@crates/api-core/src/handlers/firmware.rs`:
- Around line 87-98: The begin-txn → list_configs → commit →
create_snapshot_with_overrides flow is duplicated across
effective_host_firmware_snapshot, refresh_endpoint_report,
firmware_config_snapshot, and
PreingestionManagerStatic::firmware_config_snapshot. Extract that
snapshot-building logic into one shared helper (for example on FirmwareConfig or
as a free function in api-db) that accepts a DB reader/pool plus the base
FirmwareConfig/Arc<FirmwareConfig> and returns the effective
FirmwareConfigSnapshot, then update all four call sites to delegate to it.

In `@crates/api-db/src/host_firmware_config.rs`:
- Around line 113-145: The read-only helpers in host_firmware_config currently
force mutable PgConnection access, which makes callers use unnecessary
transactions. Update list, list_configs, and summary to accept impl DbReader
instead of &mut PgConnection, and keep their query logic the same so pool-backed
callers can invoke them without transaction boilerplate.

In `@crates/preingestion-manager/src/lib.rs`:
- Around line 3113-3141: The two tests around
select_firmware_for_artifact_continuation are duplicating the same setup and
assertion pattern, so consolidate them into a table-driven test. Refactor the
cases into a single parameterized test using value_scenarios! or check_values,
keeping the existing scenarios for the final-version preference and default
fallback while varying only the requested version and expected selected version.
🪄 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: 03ddd07b-4db0-45aa-adb3-0e089ae64b1f

📥 Commits

Reviewing files that changed from the base of the PR and between 6ec3ac9 and 77eb3c0.

📒 Files selected for processing (14)
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/firmware.rs
  • crates/api-core/src/handlers/site_explorer.rs
  • crates/api-core/src/machine_update_manager/host_firmware.rs
  • crates/api-core/src/tests/host_firmware_config.rs
  • crates/api-db/src/host_firmware_config.rs
  • crates/firmware/src/config.rs
  • crates/firmware/src/tests/config.rs
  • crates/machine-controller/src/handler.rs
  • crates/preingestion-manager/src/lib.rs
  • crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
  • crates/site-explorer/src/lib.rs
  • rest-api/docs/index.html
  • rest-api/openapi/spec.yaml
💤 Files with no reviewable changes (1)
  • rest-api/openapi/spec.yaml

Comment thread crates/firmware/src/config.rs
Comment thread crates/preingestion-manager/src/lib.rs Outdated
@rahmonov rahmonov force-pushed the consume-firmware-config branch 2 times, most recently from f9f9ffc to 4877f1d Compare July 2, 2026 10:05
@rahmonov rahmonov marked this pull request as ready for review July 2, 2026 10:06
@rahmonov rahmonov requested a review from a team as a code owner July 2, 2026 10:06
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 2, 2026

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-02 10:08:46 UTC | Commit: 4877f1d

@rahmonov rahmonov force-pushed the consume-firmware-config branch from 4877f1d to 1755a42 Compare July 2, 2026 10:12

@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 (2)
crates/api-core/src/handlers/firmware.rs (1)

317-336: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Needless clone on a dead-write fallback path.

In the existing.unwrap_or_else(...) fallback (Lines 321-327), vendor and model (via .clone()) are set, only to be unconditionally overwritten by the exact same patch.vendor/patch.model two lines later (Lines 329-330) — regardless of whether existing was Some or None. The .clone() on Line 323 is therefore pure waste on the create path.

Since HostFirmwareConfig now derives Default (see crates/api-model/src/firmware.rs), this can be simplified to drop the redundant fields and the clone:

♻️ Proposed simplification
-    let mut runtime_config = existing.unwrap_or_else(|| HostFirmwareConfig {
-        vendor: patch.vendor,
-        model: patch.model.clone(),
-        components: HashMap::new(),
-        explicit_start_needed: None,
-        ordering: Vec::new(),
-    });
+    let mut runtime_config = existing.unwrap_or_default();
 
     runtime_config.vendor = patch.vendor;
     runtime_config.model = patch.model;

This assumes bmc_vendor::BMCVendor implements Default (flagged for verification on the HostFirmwareConfig struct definition).

🤖 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/src/handlers/firmware.rs` around lines 317 - 336, The
fallback path in merge_host_firmware_config_patch is doing a needless clone and
dead write: vendor and model are initialized from patch only to be overwritten
immediately after. Simplify the HostFirmwareConfig construction in the
existing.unwrap_or_else branch by relying on HostFirmwareConfig::default (or
otherwise removing vendor/model from the fallback), then keep the later
assignments to runtime_config.vendor and runtime_config.model as the single
source of truth. Verify BMCVendor supports Default before using the
default-based initialization.

Source: Coding guidelines

crates/site-explorer/src/lib.rs (1)

2185-2185: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider tracking latency for the new DB-backed snapshot fetch.

Every other DB-touching phase in update_explored_endpoints (load, preallocate, interface_load, build_index, plan, delete_stale, probe, persist, remediate) is wrapped with metrics.record_phase_latency(...). This new firmware_config_snapshot().await? call is not, leaving a blind spot if the host_firmware_config query becomes slow.

♻️ Suggested addition
+        let fw_snapshot_start = Instant::now();
         let fw_config_snapshot = Arc::new(self.firmware_config_snapshot().await?);
+        metrics.record_phase_latency("update_explored_endpoints_fw_snapshot", fw_snapshot_start.elapsed());
🤖 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/src/lib.rs` at line 2185, The new firmware config
snapshot fetch in update_explored_endpoints is not being timed like the other
DB-backed phases, so wrap the firmware_config_snapshot() await in
metrics.record_phase_latency just as is done for load, preallocate,
interface_load, build_index, plan, delete_stale, probe, persist, and remediate.
Use the existing metrics and update_explored_endpoints flow to ensure the
fw_config_snapshot step is recorded consistently for latency tracking.
🤖 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/api-core/src/handlers/firmware.rs`:
- Around line 317-336: The fallback path in merge_host_firmware_config_patch is
doing a needless clone and dead write: vendor and model are initialized from
patch only to be overwritten immediately after. Simplify the HostFirmwareConfig
construction in the existing.unwrap_or_else branch by relying on
HostFirmwareConfig::default (or otherwise removing vendor/model from the
fallback), then keep the later assignments to runtime_config.vendor and
runtime_config.model as the single source of truth. Verify BMCVendor supports
Default before using the default-based initialization.

In `@crates/site-explorer/src/lib.rs`:
- Line 2185: The new firmware config snapshot fetch in update_explored_endpoints
is not being timed like the other DB-backed phases, so wrap the
firmware_config_snapshot() await in metrics.record_phase_latency just as is done
for load, preallocate, interface_load, build_index, plan, delete_stale, probe,
persist, and remediate. Use the existing metrics and update_explored_endpoints
flow to ensure the fw_config_snapshot step is recorded consistently for latency
tracking.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bd42e9bb-12cf-460f-8a79-8cdcc31e46ae

📥 Commits

Reviewing files that changed from the base of the PR and between 77eb3c0 and 4877f1d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/firmware.rs
  • crates/api-core/src/handlers/site_explorer.rs
  • crates/api-core/src/machine_update_manager/host_firmware.rs
  • crates/api-core/src/tests/host_firmware_config.rs
  • crates/api-db/src/host_firmware_config.rs
  • crates/api-model/src/firmware.rs
  • crates/firmware/src/config.rs
  • crates/firmware/src/tests/config.rs
  • crates/machine-controller/src/handler.rs
  • crates/preingestion-manager/Cargo.toml
  • crates/preingestion-manager/src/lib.rs
  • crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
  • crates/site-explorer/src/lib.rs
  • rest-api/docs/index.html
  • rest-api/openapi/spec.yaml
✅ Files skipped from review due to trivial changes (2)
  • rest-api/openapi/spec.yaml
  • crates/preingestion-manager/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (9)
  • crates/api-core/src/handlers/site_explorer.rs
  • crates/api-core/src/api.rs
  • crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
  • crates/firmware/src/tests/config.rs
  • crates/firmware/src/config.rs
  • crates/preingestion-manager/src/lib.rs
  • crates/api-core/src/machine_update_manager/host_firmware.rs
  • crates/api-core/src/tests/host_firmware_config.rs
  • crates/machine-controller/src/handler.rs

@github-actions

github-actions Bot commented Jul 2, 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 272 5 27 89 7 144
machine-validation-runner 769 25 209 278 36 221
machine_validation 769 25 209 278 36 221
machine_validation-aarch64 769 25 209 278 36 221
nvmetal-carbide 769 25 209 278 36 221
TOTAL 3354 105 863 1207 151 1028

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

Apply DB-backed host firmware config overrides on top of static and
metadata.toml firmware catalogs across firmware listing, desired firmware
snapshotting, site explorer, host reprovisioning, machine update handling,
and preingestion.

Runtime config now participates in version comparison and upgrade selection,
while metadata remains the base catalog and DB values take precedence when
they overlap.
@rahmonov rahmonov force-pushed the consume-firmware-config branch from 1755a42 to ac61712 Compare July 2, 2026 10:51

@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: 2

🧹 Nitpick comments (1)
crates/api-core/src/handlers/firmware.rs (1)

1194-1268: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate these merge variants into table-driven tests.

The optional-field merge cases exercise the same operation with different inputs/expectations. A check_cases table would keep the new Option<bool> semantics easier to extend and audit.

As per coding guidelines, Rust tests should prefer table-driven style using carbide-test-support scenarios or explicit check_cases / check_values.

🤖 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/src/handlers/firmware.rs` around lines 1194 - 1268, The new
merge tests for merge_host_firmware_config_patch duplicate the same
optional-field behavior across separate cases, so consolidate them into a
table-driven test. Refactor the three test functions around
merge_host_firmware_config_preserves_optional_fields_when_omitted,
merge_host_firmware_config_updates_optional_fields_when_present, and
merge_host_firmware_config_keeps_omitted_explicit_start_absent_on_create into a
single check_cases or check_values style test that enumerates inputs and
expected Option<bool> outcomes. Keep the existing helpers test_firmware,
test_patch, test_component, and test_entry, but drive them from a scenario table
to match the Rust test style guidelines.

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 `@crates/api-core/src/handlers/firmware.rs`:
- Line 744: The config response in firmware handling is collapsing “unset” into
false by using unwrap_or(false), which hides whether there is a DB override or
not. Update the response shape in firmware.rs (and the associated config
model/handler path) so explicit_start_needed preserves None for stored config
responses, or add presence metadata and only default to false in effective
inventory views. Make sure any API/schema changes stay compatible with existing
clients and clearly distinguish unset from an explicit false.
- Around line 99-104: `list_host_firmware` still ignores the deserialized
request, so it bypasses the standard core API request logging path. Update the
`list_host_firmware` handler to log the request by calling `log_request_data`
with the incoming `rpc::ListHostFirmwareRequest` before continuing with
`effective_host_firmware_snapshot`, matching the pattern used by other core API
handlers and keeping the request argument available for safe logging.

---

Nitpick comments:
In `@crates/api-core/src/handlers/firmware.rs`:
- Around line 1194-1268: The new merge tests for
merge_host_firmware_config_patch duplicate the same optional-field behavior
across separate cases, so consolidate them into a table-driven test. Refactor
the three test functions around
merge_host_firmware_config_preserves_optional_fields_when_omitted,
merge_host_firmware_config_updates_optional_fields_when_present, and
merge_host_firmware_config_keeps_omitted_explicit_start_absent_on_create into a
single check_cases or check_values style test that enumerates inputs and
expected Option<bool> outcomes. Keep the existing helpers test_firmware,
test_patch, test_component, and test_entry, but drive them from a scenario table
to match the Rust test style guidelines.
🪄 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: b9100067-22a7-4801-9be1-e9893e96c4b0

📥 Commits

Reviewing files that changed from the base of the PR and between 1755a42 and ac61712.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/firmware.rs
  • crates/api-core/src/handlers/site_explorer.rs
  • crates/api-core/src/machine_update_manager/host_firmware.rs
  • crates/api-core/src/tests/host_firmware_config.rs
  • crates/api-db/src/host_firmware_config.rs
  • crates/api-model/src/firmware.rs
  • crates/firmware/src/config.rs
  • crates/firmware/src/tests/config.rs
  • crates/machine-controller/src/handler.rs
  • crates/preingestion-manager/Cargo.toml
  • crates/preingestion-manager/src/lib.rs
  • crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
  • crates/site-explorer/src/lib.rs
  • rest-api/docs/index.html
  • rest-api/openapi/spec.yaml
💤 Files with no reviewable changes (1)
  • rest-api/openapi/spec.yaml
🚧 Files skipped from review as they are similar to previous changes (13)
  • crates/preingestion-manager/Cargo.toml
  • crates/api-core/src/api.rs
  • crates/api-core/src/handlers/site_explorer.rs
  • crates/preingestion-manager/tests/integration/host_bmc_firmware.rs
  • crates/site-explorer/src/lib.rs
  • crates/machine-controller/src/handler.rs
  • crates/api-model/src/firmware.rs
  • crates/firmware/src/config.rs
  • crates/api-db/src/host_firmware_config.rs
  • crates/api-core/src/tests/host_firmware_config.rs
  • crates/api-core/src/machine_update_manager/host_firmware.rs
  • crates/firmware/src/tests/config.rs
  • crates/preingestion-manager/src/lib.rs

Comment thread crates/api-core/src/handlers/firmware.rs
Comment thread crates/api-core/src/handlers/firmware.rs
@rahmonov rahmonov merged commit 0d5452b into NVIDIA:main Jul 2, 2026
119 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