fix(cloud): prevent Cmd-Y picker crashes from duplicate machines
Merged
AU
10d ago+29+29+01234567890123456789-3-3-0123456789
Summary
- Deduplicate Cloud machine IDs before rendering the New Machine Base picker.
- Prevent duplicate SwiftUI picker identities during a live nightly refresh while Cmd-Y opens the sheet.
Testing
git diff --check- Added
NewMachineModelTests.sourceRefreshDeduplicatesMachineIDs(hosted Swift test required for execution).
Changelog
- Fixed Cmd-Y crashing when overlapping Cloud refreshes briefly return duplicate machine IDs.
Impact map
- Source of truth:
NewMachineModel.applySourceMachines. - Direct caller:
NewMachineSheetPresentercache refresh path; all New Machine entrypoints share this model. - Cross-surface effects: Base picker receives one stable row per machine ID; first occurrence wins.
- Residual risk: full macOS test execution is delegated to CI.
Mergeability
- Conflict-only gate: pending PR creation.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes the Cmd-Y New Machine Base picker crashing when overlapping Cloud refreshes briefly return duplicate machine IDs, and keeps the picker inside the sheet when the cache holds many machines.
- Deduplicates machine IDs in
NewMachineModel.applySourceMachinesso each ID maps to one stable row, with the first occurrence winning. - Constrains the Base picker frame so a long machine list no longer widens the sheet.
- Freezes the sheet's initial size during presentation so a mid-animation cache refresh can't resize the window from inside AppKit's constraint pass.
Mergeability
- Base SHA:
7e315c5acbf1aab0e0a87e8e0011be69d848684d - Head SHA:
14b2b8043a8ca0758aa427c8c716ffc92c2ed4ce - Conflict-only gate: PASS (
91914df8173fa67cc08dde20864d08336ac508ff), no conflicted paths
Summary by CodeRabbit
- Bug Fixes
- Duplicate source machines are now shown only once, with the first entry’s name retained.
- The base image picker now uses the available sheet width, preventing cached machines from making the sheet wider.