thermograph/tests
Emi Griffith 956153691a Report the notifier's health by heartbeat, not per-worker threads (#166)
The ops dashboard marked subscription-notifier DOWN ~2/3 of the time after the
notifier was gated to a single leader worker. It judged the daemon by whether
its thread was present on whichever worker answered /api/v2/metrics, but only
the leader runs it — so polls landing on the other two workers saw no thread and
reported DOWN for a perfectly healthy notifier. Per-worker thread checks can't
describe a single-leader daemon, and worse, they could no longer distinguish a
real crash from a normal non-leader.

Report it by liveness instead: the notifier stamps a heartbeat (timestamp +
expected interval) into the shared metrics store each loop iteration, including
once at startup so the dashboard shows it up immediately after a restart. Since
the beat lives in the shared SQLite store, any worker's metrics response carries
it, so the dashboard sees the notifier's health whichever worker it polls.

- metrics.py: both stores record/expose heartbeats (SQLite reuses the meta
  table, so every worker's beats share one file); snapshot() converts each beat
  to a server-computed age so readers needn't reconcile clock skew.
- notify.py: beat at loop start and every wake.
- dashboard.py: judge heartbeat daemons by freshness (up to 2 missed intervals
  before DOWN, with beat age shown); neighbor-warmer keeps its per-worker thread
  check, which is correct since every worker runs it.
- Tests: heartbeat store/snapshot shape + cross-worker sharing; dashboard
  fresh/stale/missing rendering and the unchanged warmer check. 194 passed.

Co-authored-by: root <root@vmi3417050.contaboserver.net>
2026-07-17 13:49:30 +00:00
..
conftest.py Add IndexNow, stable sitemap lastmod, and search-verification meta (#127) 2026-07-16 18:08:09 +00:00
test_api.py Migrate backend dataframe layer from pandas to polars (#90) 2026-07-15 19:07:38 +00:00
test_api_accounts.py Push: surface delivery failures (no longer a silent success) (#157) 2026-07-17 00:12:14 +00:00
test_climate.py Serve stale forecast cache when both Open-Meteo and MET Norway fail (#116) 2026-07-16 05:41:51 +00:00
test_content.py Fix BreadcrumbList JSON-LD: omit unlinked intermediate crumbs (#164) 2026-07-17 13:04:51 +00:00
test_dashboard.py Report the notifier's health by heartbeat, not per-worker threads (#166) 2026-07-17 13:49:30 +00:00
test_grading.py Migrate backend dataframe layer from pandas to polars (#90) 2026-07-15 19:07:38 +00:00
test_grid.py Warm neighbor cells server-side (/cell?neighbors=1) (#51) 2026-07-11 20:47:31 +00:00
test_metrics.py Report the notifier's health by heartbeat, not per-worker threads (#166) 2026-07-17 13:49:30 +00:00
test_notify.py Add PWA + Web Push delivery for weather alerts (#95) 2026-07-15 23:21:06 +00:00
test_places.py Move the suggestion policy into places.py (#45) 2026-07-11 20:00:24 +00:00
test_singleton.py Gate the subscription notifier to one worker (#161) 2026-07-17 12:54:55 +00:00
test_store.py Compare/calendar mobile polish: overflow fix, sheet load button, 6-yr default, country in names (#80) 2026-07-12 06:32:10 +00:00
test_views.py Migrate backend dataframe layer from pandas to polars (#90) 2026-07-15 19:07:38 +00:00