feat(rigs): confirm before overwriting a built-in factory rig

Saving over a currently-loaded factory rig now shows a confirmation dialog
instead of silently replacing the shipped original: Overwrite (destructive),
Save as New Rig… (new id, keeps the original), or Cancel. The pending
follow-up (e.g. the Save & Clear clear step) is threaded through all three
paths.

Adds FactoryRigLibrary.factoryIDs / isFactory(_:) so the UI can tell a
shipped rig from a user rig by id, with a test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 12:42:03 -07:00
parent 4eb1cbdd61
commit bb418ca2e8
3 changed files with 74 additions and 2 deletions
@@ -51,6 +51,16 @@ struct FactoryRigLibraryTests {
}
}
@Test func factoryDetectionRecognisesEveryRigAndRejectsOthers() {
let rigs: [FactoryRig] = FactoryRigLibrary.all
#expect(FactoryRigLibrary.factoryIDs.count == rigs.count)
for rig: FactoryRig in rigs {
#expect(FactoryRigLibrary.isFactory(rig.id), "\(rig.name) not recognised as factory")
}
// A freshly generated id is not a factory rig.
#expect(!FactoryRigLibrary.isFactory(UUID()))
}
// MARK: - Seeding entries
@Test func makeEntriesMatchesCatalogAndIsStable() throws {