fix(rigs): don't let starter overwrites be reverted by reseeding

External-review findings for 3.1.0:

- A starter rig can no longer be overwritten in place. Saving over a loaded
  starter previously stored the edited content under the rig's fixed factory
  id, so the next starter-catalog update (or Restore Starter Rigs) would
  silently revert it to the shipped version. The confirmation now offers only
  Save as New Rig / Cancel — a starter is managed content, and the player's
  changes are kept as their own rig (a new id) instead.
- restoreStarterRigs advances the seed-version marker only on success, matching
  start(), so a failed manual restore no longer suppresses the next launch's
  automatic catch-up seed.
- CHANGELOG: correct the starter-rig count (18, not 19).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 10:38:26 -07:00
parent fc6ddb8d9a
commit 9873dd258b
3 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ plus a batch of rig-switching and reverb fixes.
### Added
- **19 built-in starter rigs**, seeded into the library on first launch and grouped by
- **18 built-in starter rigs**, seeded into the library on first launch and grouped by
style — **Shoegaze Walls**, **Dreampop**, **Classic**, **Ambient**, and **Experimental**.
A **Mine / Starters** toggle at the top of the rig sidebar switches between your own rigs
and the shipped ones (grouped under category headers); the sidebar opens on whichever
@@ -69,7 +69,9 @@ public enum RigLibraryBootstrap {
/// - Returns: The number of starter rigs written (0 on a build/encode failure).
@discardableResult
public static func restoreStarterRigs(into store: RigLibraryStore) -> Int {
let written: Int = installFactoryRigs(into: store) ?? 0
// Advance the seed marker only on success, mirroring `start()` — a failed restore must not
// suppress the automatic catch-up seed on the next launch.
guard let written: Int = installFactoryRigs(into: store) else { return 0 }
UserDefaults.standard.set(FactoryRigLibrary.seedVersion, forKey: seedVersionKey)
return written
}
@@ -320,7 +320,7 @@ public struct ShoeGazeBuilderView: View {
.background(actionErrorAnchor)
.rigNamePrompt($namePrompt)
.confirmationDialog(
"Overwrite starter rig?",
"Starter rig",
isPresented: Binding(
get: { factoryOverwrite != nil },
set: { presented in if !presented { factoryOverwrite = nil } }
@@ -328,12 +328,9 @@ public struct ShoeGazeBuilderView: View {
titleVisibility: .visible,
presenting: factoryOverwrite
) { request in
Button("Overwrite", role: .destructive) {
persist(
shoeGaze.captureEntry(name: request.entry.name, id: request.entry.id),
then: request.completion
)
}
// A starter rig is managed content: it is refreshed to the shipped version whenever the
// starter catalog updates, so it deliberately cannot be overwritten in place — that would
// silently revert on the next update. The player keeps their changes as a new rig instead.
Button("Save as New Rig…") {
// Defer one runloop hop: presenting the name-entry alert while the confirmation
// dialog is still dismissing can drop the new presentation on some SwiftUI versions.
@@ -342,8 +339,8 @@ public struct ShoeGazeBuilderView: View {
}
Button("Cancel", role: .cancel) { }
} message: { request in
Text("“\(request.entry.name)” is a built-in starter rig. Overwriting replaces it in "
+ "your library. Save as a new rig to keep the original.")
Text("“\(request.entry.name)” is a built-in starter rig and can't be changed in place. "
+ "Save your changes as a new rig to keep them.")
}
}