From 9873dd258bf31846e3e31a4735f61bc69cbbcc84 Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Thu, 13 Aug 2026 10:38:26 -0700 Subject: [PATCH] fix(rigs): don't let starter overwrites be reverted by reseeding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CHANGELOG.md | 2 +- .../LyrebirdShoeGazeUI/RigLibraryBootstrap.swift | 4 +++- .../LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift | 15 ++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 599b643..e64b66b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Sources/LyrebirdShoeGazeUI/RigLibraryBootstrap.swift b/Sources/LyrebirdShoeGazeUI/RigLibraryBootstrap.swift index f64bf5a..bfd33e9 100644 --- a/Sources/LyrebirdShoeGazeUI/RigLibraryBootstrap.swift +++ b/Sources/LyrebirdShoeGazeUI/RigLibraryBootstrap.swift @@ -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 } diff --git a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift index 9900a3e..d5b01cf 100644 --- a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift +++ b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift @@ -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.") } }