Skip to content

fix(rest-api): keep ExpectedMachine BMC IPs synchronized#3701

Open
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3696
Open

fix(rest-api): keep ExpectedMachine BMC IPs synchronized#3701
chet wants to merge 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3696

Conversation

@chet

@chet chet commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

REST's ExpectedMachine view now follows BMC IP changes made directly through Core on the normal inventory pass. Setting, changing, or clearing an address no longer needs a same-value REST PATCH to update the REST view.

Primary callouts are:

  • UpdateExpectedMachinesInDB now passes BmcIpAddress through Core-originated creates and includes it in existing-record comparisons.
  • Core-reported addresses use ExpectedMachineDAO.Update; removals use ExpectedMachineDAO.Clear, with the clear and accompanying update sharing one per-machine transaction.
  • Tests cover create, set, change, clear, preservation of the REST-only Name, and rollback when the accompanying update fails.

Tests added!

This supports #3696

REST's `ExpectedMachine` view now follows BMC IP changes made directly through Core on the normal inventory pass. Setting, changing, or clearing an address no longer needs a same-value REST PATCH to update the REST view.

Primary callouts are:

- `UpdateExpectedMachinesInDB` now passes `BmcIpAddress` through Core-originated creates and includes it in existing-record comparisons.
- Core-reported addresses use `ExpectedMachineDAO.Update`; removals use `ExpectedMachineDAO.Clear`, with the clear and accompanying update sharing one per-machine transaction.
- Tests cover create, set, change, clear, preservation of the REST-only `Name`, and rollback when the accompanying update fails.

Tests added!

This supports NVIDIA#3696

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet requested a review from a team as a code owner July 17, 2026 22:47
@coderabbitai

coderabbitai Bot commented Jul 17, 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: 332aaa4a-6228-4d09-9a0c-746b3a3c74ed

📥 Commits

Reviewing files that changed from the base of the PR and between 0e59cee and e6996ab.

📒 Files selected for processing (2)
  • rest-api/workflow/pkg/activity/expectedmachine/expectedmachine.go
  • rest-api/workflow/pkg/activity/expectedmachine/expectedmachine_test.go

Summary by CodeRabbit

  • Bug Fixes
    • Expected machine records now properly reconcile BmcIpAddress from inventory during creation and updates.
    • BmcIpAddress is cleared in the database when inventory no longer reports it.
    • Updates are now performed transactionally to reduce inconsistencies; if a related per-record update fails, previously stored values (including BMC IP and name) are preserved.

Walkthrough

UpdateExpectedMachinesInDB now synchronizes BmcIpAddress during ExpectedMachine creation and reconciliation, clears omitted values transactionally, and tests rollback behavior when reconciliation fails.

Changes

ExpectedMachine BMC IP reconciliation

Layer / File(s) Summary
Reconciliation and transactional updates
rest-api/workflow/pkg/activity/expectedmachine/expectedmachine.go
Creation and update comparisons now include BmcIpAddress; omitted inventory values are explicitly cleared within a database transaction.
BMC IP reconciliation tests
rest-api/workflow/pkg/activity/expectedmachine/expectedmachine_test.go
Tests cover creation, updates, clearing, preservation of Name, and rollback after a per-record reconciliation failure.

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

Possibly related issues

  • NVIDIA/infra-controller issue 3696 — Directly addresses ExpectedMachine BMC IP synchronization across creation, update, clearing, and transactional rollback.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: synchronizing ExpectedMachine BMC IPs in REST.
Description check ✅ Passed The description is directly aligned with the code changes and test coverage in this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ll perform a complete re-review of #3701, including the synchronization, transactionality, and regression coverage changes.

🐇🔍

✅ Action performed

Full review finished.

@github-actions

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-17 22:52:47 UTC | Commit: e6996ab

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.

1 participant