fix(sku): fix v5 SKU upgrade regressions that wedged pre-existing machines - #4207
Open
wminckler wants to merge 2 commits into
Open
fix(sku): fix v5 SKU upgrade regressions that wedged pre-existing machines#4207wminckler wants to merge 2 commits into
wminckler wants to merge 2 commits into
Conversation
…hines Three bugs introduced by NVIDIA#3717 (v5 SKU): 1. v5 generation hard-rejected NVMe drives missing size_mb/pci_path, which are absent on hardware_info records predating the v5 fields. Any machine discovered before the upgrade failed SKU generation and wedged permanently in MatchingSku with no path to recover without a reboot. Generation now includes the drive with whatever fields are present; machines self-heal once hardware re-enumeration populates the new fields. 2. diff_storage_by_model (used when the expected SKU is v4) built its map with a plain HashMap collect, silently clobbering duplicate model keys. A v5 actual SKU has one entry per drive (count=1 each), so two drives of the same model left only one in the map. Compared against a v4 expected with count=2 this produced a false diff, preventing find_matching from ever matching machines against their v4 expected SKUs. Fixed by aggregating counts via and_modify. 3. The graceful degradation in (1) allowed a v5 SKU with fully unconstrained storage entries to be auto-created via generate_missing_sku_for_machine, producing an expected SKU that accepts any drive at any location — weaker than v4 model matching. validate_storage_for_create now rejects v5 entries with no pci_patterns and no size bounds. Also adds a min>max size range check caught by CodeRabbit review. Fixes #6520848 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughV5 NVMe SKU generation now retains incomplete discovery data for downstream validation. SKU persistence validates storage bounds, PCI patterns, and unconstrained entries. Legacy storage comparison aggregates duplicate models, with regression coverage and updated fixture data. ChangesSKU storage handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MachineHardware
participant SKUGenerator
participant SKUPersistence
MachineHardware->>SKUGenerator: provide discovered NVMe fields
SKUGenerator->>SKUPersistence: submit storage entry with optional fields
SKUPersistence->>SKUPersistence: validate storage constraints
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
- Collapse nested if/if-let into a single if-let && guard to satisfy clippy::collapsible_if (caught by CI all-features clippy pass) - Add size bounds and PCI pattern to FULL_SKU_DATA test fixture so it passes the new validate_storage_for_create v5 constraint check; the fixture was a v5 SKU with an unconstrained storage entry, which our new validation correctly rejects Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
wminckler
enabled auto-merge (squash)
July 27, 2026 20:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #3717 introduced three bugs that broke machines on upgrade to v2.1.
Description
Bug 1 — v5 generation hard-failed on pre-existing hardware, wedging machines at
MatchingSkugenerate_sku_from_machine_at_version_5rejected NVMe drives missingsize_mborpci_path, which are absent onhardware_inforecords discovered before #3717. Any unassigned machine hit this on upgrade, propagated the error as aStateHandlerError, and wedged permanently inMatchingSkuwith no recovery path short of a reboot. Generation now includes the drive with whatever fields are present; machines self-heal once hardware re-enumeration populates the new fields.Bug 2 —
diff_storage_by_modelclobbered duplicate models from v5 actual SKUsdiff_storage_by_model(used when the expected SKU is v4) built its map with a plainHashMapcollect, silently dropping duplicate model keys. A v5 actual SKU has one entry per drive (count=1 each), so two drives of the same model left only one entry with count=1. Compared against a v4 expected with count=2, this produced a false diff and preventedfind_matchingfrom ever finding a match for those machines. Fixed by aggregating counts viaand_modify.Bug 3 — graceful degradation allowed unconstrained v5 entries to be auto-created as expected SKUs
The fix for Bug 1 meant
generate_missing_sku_for_machinecould now generate and persist a v5 expected SKU where every storage entry had nopci_patternsand no size bounds — silently accepting any drive at any location, weaker than v4 model matching.validate_storage_for_createnow rejects v5 entries with no constraints. Also adds amin_size_mb > max_size_mbinversion check (caught by CodeRabbit review).The
VerifyingSkupath was unaffected by all three bugs — it generates atexpected_sku.schema_version, so v4 expected SKUs always generated v4 actuals.Related issues
Fixes #6520848
Type of Change
Breaking Changes
Testing
Regression test
v5_actual_matches_v4_expected_by_modelcovers Bug 2. Existing 15 SKU unit tests incrates/api-model/src/sku.rscover Bug 1 and Bug 3 indirectly (generation no longer errors; unconstrained entries are rejected at thecreatelayer). All 16 tests pass.Additional Notes
The three bugs form a chain: Bug 1 wedges unassigned machines; Bug 2 prevents assigned machines from re-matching after upgrade; Bug 3 would have allowed a degraded auto-generated expected SKU to persist once Bug 1 was fixed. All three need to land together.