M9 — Device diagnostics & debug reporting (connectivity + UPnP desync) #104
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Toggleable per-account device diagnostics: remotely enable debug mode on an account → its phone(s) stream a timeseries of device state → admin timestamp view with copy/export for handing slices off for analysis. Targets two unsolved problem classes: roaming/poor-data recovery and locked-phone UPnP/Sonos desync (prime suspect: Doze killing the 1Hz poll loop).
Server
diagnostic_events+users.debug_mode_enabled.POST /api/diagnostics(gated batch ingest, no-op 204 when off),GET /api/admin/diagnostics(account/device/kind/time-window filters, export-sized paging),/diagnostics/devices,PUT /api/admin/users/{id}/debug-mode.debug_mode_enabledexposed on/api/me.Android
DiagnosticsReportertaps connectivity, server-health, UPnP drops/player-state/route, power (Doze/battery-opt/screen), app fg/bg, plus a heartbeat snapshotting Sonos-vs-local position.DiagnosticsUploaderdrains a Room ring buffer on tick / health-recovery / sign-in — deliberately NOT the MutationQueue so events survive the dead zone being debugged./api/merefresh; per-device OFF switch in Settings. Room schema 6→7.Web admin
/admin/diagnostics: account+device+kind+time-window → chronological timeline, remote debug-mode toggle, Copy-JSON / Download-NDJSON export.Scribe milestone M9 (#119). All three CI lanes green on dev (server 1671, android 1679, web 1684).
🤖 Generated with Claude Code
New diagnostic_events table + per-account users.debug_mode_enabled flag. When an account's flag is on, its client(s) POST a batch timeseries of connectivity / UPnP-sync / power / lifecycle events to /api/diagnostics (no-op 204 when off, kind whitelist mirrors the CHECK constraint). Admin surface: GET /api/admin/diagnostics (optional account/device/kind/ time-window filters, RFC3339-or-epoch-ms, export-sized paging) + a /diagnostics/devices overview + PUT /api/admin/users/{id}/debug-mode to flip an account remotely while a bug is live. debug_mode_enabled is now exposed on /api/me (client gate) and the admin user views. Retention: a 30-day gc-worker sweep (GcPruneDiagnostics), keyed on the server clock so a skewed device clock can't keep rows alive. Refs Scribe M9 (#119), tasks #1172 #1173. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K55iTxn95BtshocgdE1shW