Skip to content

feat(dashboard): the dashboard's and the GPS's history is kept across restarts - #387

Merged
gx1400 merged 2 commits into
mainfrom
feat/history-file
Oct 26, 2026
Merged

gx1400 merged 2 commits into
mainfrom
feat/history-file

Conversation

@gx1400

@gx1400 gx1400 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Closes #386. The bottom of tonight's stack.

The Dashboard's counters (F1.22) and the GPS statistics (F3.14) were memory-only, so a restart, an update or a crash emptied them. As you chose, they're now kept in a file; SQLite can take its place later.

  • dashboard-history.json in the data folder (on the gateway, its data volume). It's a versioned JSON HistorySnapshot behind an internal IHistoryStore, so a SQLite store can replace FileHistoryStore without touching the dashboard.
  • When it's saved: every 5 minutes (EngineOptions.HistorySaveInterval), as the engine stops, and right after Clear packets, so a restart doesn't bring the cleared counts back. Each save writes .tmp and renames it over the old file.
  • At start: whatever is under 24 hours old is loaded before anything is counted.
    • The time the app was down shows as empty points.
    • "Counting since" keeps the first run's start.
    • An outage still going on when the app stopped ends at the save.
    • "Now" values wait for a new sample.
  • What's kept: DashboardCounters and GpsHistory gain Export/Import. Enum values are stored by name, so reordering an enum can't misread an old file. That covers the minute buckets, the distinct-station rings, per-station tallies (so My view still works), relays, sources, the newest stations, and the GPS minutes, outages and wander origin. A 24-hour file is a few hundred KB at most.
  • A damaged or other-version file is renamed .invalid, and counting starts afresh with a log warning.
  • Tests stay out of real folders. EngineOptions.HistoryFile is set only when the engine is added to a host, so tests that build the engine themselves keep history in memory. HostingTests.EnabledEngineStartsConnectingWithTheHost ran the hosted engine on the real data folder and wrote a history file there during my first run. It now uses a temporary folder; I deleted the stray file and checked that a full run leaves nothing.
  • Specs: F1.22 decision 3 and F3.14 behavior 6 now say history is kept.

Tests (HistoryFileTests, 5):

  • dashboard counts survive a JSON round trip and a restart, including My view;
  • what's over 24 hours old is dropped;
  • GPS history comes back, with an ongoing outage ended and down time empty;
  • a damaged file and a wrong version are set aside, and the save leaves no .tmp;
  • an engine saves on stop and a new engine takes the history up.

… restarts

The counters behind the Dashboard and the GPS statistics were only in
memory, so a restart, an update or a crash emptied them. They're now
saved to dashboard-history.json in the data folder every 5 minutes and
as the engine stops, and taken up at start for whatever is under 24
hours old. Down time shows as empty points; a damaged file is set aside.
As the other generated serializer contexts are: it isn't code anyone
wrote, and it pulled branch coverage under the gate.
@gx1400
gx1400 force-pushed the feat/history-file branch from fc18fcf to 33a82d2 Compare October 26, 2026 10:18
@gx1400
gx1400 merged commit 45dd16f into main Oct 26, 2026
11 checks passed
@gx1400
gx1400 deleted the feat/history-file branch October 26, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard and GPS history kept across restarts

1 participant