refactor(rigs): address external-review findings

- Recall router state in applyState: the lightweight (no-rebuild) recall path
  now positionally applies router branch pedal params and the splitter/merger
  blend, instead of silently dropping them for routed rigs. Test added.
- Simplify first-run seeding: RigLibraryStore.save persists asynchronously
  (best-effort, logged not thrown), so the previous per-entry rollback could
  never fire for a real disk failure. Replaced with an honest best-effort
  save + working-rig fallback, and a comment stating the semantics.
- Move FactoryRigBuild to its own file (one public type per file).
- Document that a router's output master gain is intentionally not persisted,
  matching BoardState's treatment of board master gain.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 13:32:58 -07:00
parent 7dccf596f4
commit 2c970aa344
6 changed files with 78 additions and 40 deletions
@@ -12,6 +12,10 @@
/// selection (and any continuous blend between them); the merger's two levels capture the output mix.
///
/// Persisted as part of ``ShoeGazeState/routers`` so a routed multi-board rig survives save / load.
///
/// > Note: The router's output-stage master gain (`masterGainNode`) is intentionally not captured,
/// > matching the existing behaviour for a plain board's `masterGainNode` in `BoardState` — output
/// > level is treated as a live mix control, not part of the saved rig.
public struct ChainRouterState: Codable, Equatable {
/// Pedals on board A (the first branch), in chain order.