claude-memory/graph/decisions/decision-auto-sync-on-dashboard-mount-when-all-entities-stal-346c5a.md
2026-03-01 20:21:02 -06:00

69 lines
2.5 KiB
Markdown

---
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:21:01.979645+00:00"
relations:
- target: 3a2ec27f-99ac-463f-a451-f99fe8fb1136
type: RELATED_TO
direction: outgoing
strength: 0.68
edge_id: f5e85e8d-acfa-4eda-8ca4-ddd5cd005849
- target: 39379120-896b-46cd-befa-b83d09d7556b
type: RELATED_TO
direction: outgoing
strength: 0.73
edge_id: 373fbb71-c49c-4558-8fc2-52eb877e64b0
- target: 62ee21e8-2b56-4d38-a73d-47e2724f08c6
type: BUILDS_ON
direction: outgoing
strength: 0.73
edge_id: 285800e7-a6b0-4cf2-b017-91b209ef61bd
- target: 77c0b897-4124-432f-84de-700ff82dcde1
type: RELATED_TO
direction: outgoing
strength: 0.8
edge_id: fbf4a323-421b-4964-ba27-bffd66df6d69
- target: d75e2afd-8348-4fe6-9ea1-731604505aa6
type: FOLLOWS
direction: incoming
strength: 0.8
edge_id: ec429a7a-f8ec-452e-a8ab-0defc5d5ca9f
- target: 1d64c80d-61ec-434f-902a-3a511e2b92c2
type: BUILDS_ON
direction: outgoing
strength: 0.7
edge_id: aca4887b-3c88-443d-b7d1-fc137d414832
- target: e1fad787-7de7-4f62-afb7-6df2ffdea1ed
type: RELATED_TO
direction: outgoing
strength: 0.65
edge_id: bbed0cf1-0bb9-4479-97f5-41b0dc40c63b
---
# 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)