Debug: live alert trace — surface every gate decision from the alert chain

ProximityMonitor now records each stage the live chain reaches (Settings →
Debug → Alert trace, in-memory, newest-first, capped at 8):
- didEnterRegion arrival (regionEventCount + entry line) — distinguishes
  'geofence never fires' from 'gate blocked the alert'
- gate misses: station not in loaded list, hourly dedup (with minutes ago),
  no fuel sellers within radius after fresh fetch, entered-not-cheapest
  (with the cheaper station + price)
- the previously-silent fresh-fetch catch now logs the error
- 'alert scheduled' once UNUserNotificationCenter.add is called — if that
  line appears but no banner shows, the failure is delivery/permission,
  not alert logic

SettingsView shows the trace (symbol per kind) + region-event count; the
existing Test-alert button already probes notification permission and
reports denial inline. 83 tests, Release build green.
This commit is contained in:
FuelBoard Contributor
2026-08-15 11:10:10 +01:00
parent d0d25811c7
commit 494412ba99
3 changed files with 116 additions and 7 deletions
+3 -1
View File
@@ -403,7 +403,9 @@ struct ContentView: View {
debugStatus: monitor.debugStatus,
appCheapest: appCheapestStatus,
regionError: monitor.lastRegionError,
monitoredCount: monitor.monitoredStationIDs.count
monitoredCount: monitor.monitoredStationIDs.count,
alertLog: monitor.alertLog,
regionEventCount: monitor.regionEventCount
)
.tabItem { Label("Settings", systemImage: "gearshape.fill") }
}