Widget diagnostics: beacon from makeEntry (keychain + relay) + app diagnostics section

The small-widget skeleton survived four resolution fixes; instrument the
widget instead of guessing. Every makeEntry now writes its entry state
(intent type, location source, station count, fuel, sort, favourites flag,
first station) to a keychain beacon (app-readable) and fire-and-forgets a
GET to the relay's /api/v1/widget-diag so its access log records whether a
widget timeline actually runs in the extension and what it produced.
Settings → Debug gains a Widget Diagnostics section: the keychain beacon +
the installed-widget inventory from WidgetCenter. Relay gains the
/api/v1/widget-diag route (204, log-only).
This commit is contained in:
FuelBoard Contributor
2026-08-13 19:52:12 +01:00
parent 4d35b08533
commit 335a9751dc
3 changed files with 90 additions and 0 deletions
+12
View File
@@ -696,4 +696,16 @@ struct FuelStore {
UserDefaults(suiteName: appGroupSuite)?.set(value, forKey: service)
writeKeychain(data: Data(value.utf8), service: service)
}
// Widget diagnostics beacon the widget extension writes its last
// makeEntry state here (keychain survives on free SideStore accounts where
// the app-group container isn't provisioned); the app's Debug section
// reads it to see whether a widget timeline ran and what it produced.
static func saveWidgetDiag(_ json: String) {
saveString(json, service: "widget.diag")
}
static func loadWidgetDiag() -> String? {
loadString(service: "widget.diag")
}
}