Thermograph monorepo: graded-climate API + SSR frontend + infra, domain-specific containerized deploys
Find a file
Emi Griffith 7989f142a1 Single-source cache identity; shared fetch preamble and cache flow (#43)
The derived store's key/token formats existed in three places — each
endpoint, api_cell's slice assembly, and migrate.py — where any drift
would silently split the cache (endpoints missing rows the bundle wrote,
migrate materializing rows nobody reads). They are now defined once in
views.py (grade_key/calendar_key/day_key/forecast_key, history_token/
recent_token/day_token) and consumed everywhere, with a pinning test so
a format change is always deliberate.

The four data endpoints shared two copy-pasted sequences, now helpers:

- _fetch_history: history (+ optional recent bundle) fetch with upstream
  failures mapped to clean HTTP errors and an empty record to 404.
- _cached_response: If-None-Match 304 / token-valid store replay /
  build + persist + serve, with calendar's dont-persist-placeless rule
  as an explicit flag.

Each endpoint is now its audit run + identity + a build callback (~10
lines); api_day's hourly-token special case moved into day_token. New
tests: identity format pins, rate-limit 503 parametrized across all five
data routes, prefetch=1 never touching upstream (cold 204, warm
history-only slices), and calendar's placeless-payload retry behavior.
2026-07-11 19:49:15 +00:00
tests Single-source cache identity; shared fetch preamble and cache flow (#43) 2026-07-11 19:49:15 +00:00
app.py Single-source cache identity; shared fetch preamble and cache flow (#43) 2026-07-11 19:49:15 +00:00
audit.py Initial commit: app + 2026-07-10 17:29:47 -07:00
climate.py Typo-tolerant location search suggestions (#33) 2026-07-11 15:36:14 +00:00
grading.py Initial commit: app + 2026-07-10 17:29:47 -07:00
grid.py Worldwide coverage: grade any point on Earth (#32) 2026-07-11 15:02:28 +00:00
migrate.py Single-source cache identity; shared fetch preamble and cache flow (#43) 2026-07-11 19:49:15 +00:00
places.py Typo-tolerant location search suggestions (#33) 2026-07-11 15:36:14 +00:00
requirements-dev.txt Add backend test suite; gate direct pushes; serialize LAN deploys (#41) 2026-07-11 19:37:49 +00:00
requirements.txt Initial commit: app + 2026-07-10 17:29:47 -07:00
store.py Fix compare place names (Nominatim burst) + weekly duplicate location name (#29) 2026-07-11 09:03:57 +00:00
views.py Single-source cache identity; shared fetch preamble and cache flow (#43) 2026-07-11 19:49:15 +00:00