fix(rest-api): allow clearing an ExpectedMachine BMC IP address#3678
fix(rest-api): allow clearing an ExpectedMachine BMC IP address#3678chet wants to merge 1 commit into
Conversation
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-3678.docs.buildwithfern.com/infra-controller |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Summary by CodeRabbit
WalkthroughExpectedMachine PATCH handling now distinguishes omitted, non-empty, empty, and explicit ChangesExpectedMachine BMC IP semantics
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant APIClient
participant UpdateExpectedMachineHandler
participant ExpectedMachineSQLDAO
participant UpdateExpectedMachineWorkflow
APIClient->>UpdateExpectedMachineHandler: PATCH bmcIpAddress null
UpdateExpectedMachineHandler->>ExpectedMachineSQLDAO: Clear BmcIpAddress
ExpectedMachineSQLDAO-->>UpdateExpectedMachineHandler: Return cleared record
UpdateExpectedMachineHandler->>UpdateExpectedMachineWorkflow: Execute update workflow
UpdateExpectedMachineWorkflow-->>APIClient: Return updated ExpectedMachine
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.44.1)rest-api/docs/index.htmlast-grep timed out on this file Comment |
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-07-17 18:20:20 UTC | Commit: 59680ce |
`ExpectedMachine` PATCH requests can now clear `bmcIpAddress` with an explicit `null`, while omission still leaves the existing address alone. Individual and batch updates both send the resulting value through the existing Core workflow. Primary callouts are: - `APIExpectedMachineUpdateRequest` now preserves omitted versus explicit `null`, and empty strings remain invalid. - `ExpectedMachineDAO.UpdateMultiple` groups sparse batch updates by field set so one row can't clear fields another row omitted. - The OpenAPI contract and generated SDK/docs document the set/omit/clear behavior. Tests added! This supports NVIDIA#3630 Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@rest-api/openapi/spec.yaml`:
- Around line 21510-21512: Add an allowlist entry to
oasdiff-breaking-changes-ignore.txt for the
ExpectedMachineUpdateRequest.bmcIpAddress minLength change, covering both PATCH
endpoint usages. Keep the existing OpenAPI validation unchanged so empty strings
remain rejected.
🪄 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: c1392df9-4ecf-4001-bcb6-eef3d0216e13
⛔ Files ignored due to path filters (1)
rest-api/sdk/standard/model_expected_machine_update_request.gois excluded by!rest-api/sdk/standard/model_*.go
📒 Files selected for processing (8)
rest-api/api/pkg/api/handler/expectedmachine.gorest-api/api/pkg/api/handler/expectedmachine_test.gorest-api/api/pkg/api/model/expectedmachine.gorest-api/api/pkg/api/model/expectedmachine_test.gorest-api/db/pkg/db/model/expectedmachine.gorest-api/db/pkg/db/model/expectedmachine_test.gorest-api/docs/index.htmlrest-api/openapi/spec.yaml
ExpectedMachinePATCH requests can now clearbmcIpAddresswith an explicitnull; omitting it still preserves the configured address. This works for individual and batch updates and forwards the cleared state through the existing Core workflow.The request model now keeps presence separate from value, and mixed batch updates are grouped by exact field set so one row cannot clear fields another row omitted. The OpenAPI contract and generated artifacts document the set/omit/clear behavior.
Related issues
This supports #3630
Type of Change
Breaking Changes
Testing
Additional Notes
cargo make format-nightlycargo make clippycargo make carbide-lintsgo test -p 1 ./api/...go test -p 1 ./db/...golangci-lint