fix(flow): preserve expected component descriptions - #4713
Conversation
Signed-off-by: Patrice Breton <pbreton@nvidia.com>
|
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. |
|
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 selected for processing (3)
Summary by CodeRabbit
WalkthroughThe mirror now carries Core descriptions into normalized machine, NVSwitch, and power-shelf components. Reconciliation manages the reserved description entry, preserves unrelated metadata, persists updates, and clears removed descriptions. Unit and database-backed tests cover the lifecycle. ChangesExpected description synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review. |
|
✅ 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/flow/internal/scheduler/jobs/inventorysync/expected_mirror_component.go`:
- Line 446: Update the inventory reconciliation update logic around the
description column so it never replaces the complete stored JSONB map with the
stale snapshot value. Use an atomic JSONB expression against the database column
to update only expected_description, deleting that key when Core clears it,
while preserving unrelated runtime metadata such as nvos_ip. Add an interleaving
integration test covering a runtime metadata update during reconciliation.
🪄 Autofix
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: d60ad4bc-7b8c-4fd8-8cab-313b65fbe667
📒 Files selected for processing (3)
rest-api/flow/internal/scheduler/jobs/inventorysync/expected_mirror_component.gorest-api/flow/internal/scheduler/jobs/inventorysync/expected_mirror_component_test.gorest-api/flow/internal/scheduler/jobs/inventorysync/expected_mirror_db_test.go
Signed-off-by: Patrice Breton <pbreton@nvidia.com>
|
@coderabbitai full review. |
|
✅ Action performedFull review finished. |
Summary
Preserve Core descriptions for
ExpectedMachine,ExpectedSwitch, andExpectedPowerShelfwhen Flow mirrors expected inventory.The Core-owned value is stored under the reserved
expected_descriptionkey so expected reconciliation can create, update, or clear it without replacing runtime- or operator-owned description entries.Fixes #4353.
Root cause
The Core API detail models already exposed descriptions, but the Flow normalization and persistence paths omitted them. Consequently, new mirrored components lost their descriptions and existing components never received description changes.
The description column is also shared with runtime metadata such as the NVSwitch
nvos_ip, so replacing the entire JSON map would have caused data loss.Changes
ExpectedMachine,ExpectedSwitch, andExpectedPowerShelf.expected_descriptionkey.expected_descriptionwhen Core clears the value.Validation
make test-flowgo vet ./flow/internal/scheduler/jobs/inventorysyncgit diff --checkThe full Flow suite was rerun after rebasing onto current upstream
main.Note
This is an attempt at fully automated issue resolution using Codex.