fix(rigs): refresh stale starters on update; tab follows current rig

- Seeding now (re)installs every starter by stable id, so a corrected rig
  definition replaces the stale copy already in a library (save upserts by
  id, keeping its position) — user rigs untouched. Bumped seedVersion to 2
  so existing libraries pick up the two-board Garcia rig (the old router
  version showed "No board at index 0" because the builder UI renders boards,
  not routers, and the stale entry was never refreshed). "Restore Starter
  Rigs" likewise refreshes all starters, not just missing ones.
- The Mine/Starters toggle now opens on the group containing the currently
  loaded rig (Starters when a factory rig like Garcia is active, else Mine),
  and follows the selection when the current rig changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 17:57:57 -07:00
parent 132515b4cd
commit 5decdd8693
3 changed files with 50 additions and 53 deletions
@@ -70,10 +70,11 @@ extension ChainRouter {
@MainActor
public enum FactoryRigLibrary {
/// Catalog seed version. Bump this whenever new factory rigs are added so first-run catch-up
/// seeding re-runs on already-populated libraries and installs the newly-shipped starters. Never
/// re-adds a rig the user has since deleted at the *same* version — the marker only advances.
public static let seedVersion: Int = 1
/// Catalog seed version. Bump this whenever the shipped starter rigs change — new rigs added, or
/// an existing rig's definition corrected — so launch catch-up re-runs on already-populated
/// libraries and refreshes every starter to its current form. Within a single version the marker
/// only advances once, so a starter the user deletes stays deleted until the next bump.
public static let seedVersion: Int = 2
/// Stable ids of every built-in rig, for detecting whether a library entry is a factory rig.
///