From 0f6f1ece3b2cbb890cf590182960a78a371c1a54 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 1 Mar 2026 20:09:10 -0600 Subject: [PATCH] store: Decision: Auto-sync on dashboard mount when all entities stale >24h --- ...ard-mount-when-all-entities-stal-346c5a.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 graph/decisions/decision-auto-sync-on-dashboard-mount-when-all-entities-stal-346c5a.md diff --git a/graph/decisions/decision-auto-sync-on-dashboard-mount-when-all-entities-stal-346c5a.md b/graph/decisions/decision-auto-sync-on-dashboard-mount-when-all-entities-stal-346c5a.md new file mode 100644 index 00000000000..ac9abb328e2 --- /dev/null +++ b/graph/decisions/decision-auto-sync-on-dashboard-mount-when-all-entities-stal-346c5a.md @@ -0,0 +1,32 @@ +--- +id: 346c5a34-3fed-44ff-832a-b0c9eb42ca88 +type: decision +title: "Decision: Auto-sync on dashboard mount when all entities stale >24h" +tags: [sba-scouting, rust, sync, dashboard, decision, auto-sync] +importance: 0.6 +confidence: 0.8 +created: "2026-03-02T02:09:10.166132+00:00" +updated: "2026-03-02T02:09:10.166132+00:00" +--- + +# Auto-Sync on Dashboard Mount: Design Decision + +## Context +sba-scouting Rust TUI — dashboard screen loads sync statuses from the DB on mount. + +## Decision +After sync statuses load (in `SyncStatusesLoaded` handler), automatically trigger a full sync if ALL entity types (teams, players, transactions) have `last_sync` older than 24 hours OR have never been synced. + +## Rationale +- Avoids stale data on first launch of the day without requiring manual user action +- "All entities" check prevents partial re-sync when only one type is fresh +- Only fires on dashboard mount (when statuses load), not on every navigation to dashboard + +## Implementation +- Check fires in `DashboardState::handle_message()` inside the `SyncStatusesLoaded` arm +- Required adding `settings: &Settings` parameter to `handle_message()` to pass to `trigger_sync()` +- Standings use a separate `standings_cache` table with their own refresh mechanism — they do NOT participate in this check + +## Scope Limits +- Does not affect standings cache +- Does not re-trigger if user navigates away and back (statuses only load once on mount)