From 259f3f170d22a7d0fd5d5a049312488147beb925 Mon Sep 17 00:00:00 2001 From: Emi Griffith Date: Sat, 25 Jul 2026 11:43:52 -0700 Subject: [PATCH] backend: correct the Fahrenheit-set and pct_ordinal contract notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The F_COUNTRIES bullet claimed "there is a test asserting this" and pointed at frontend/format.py — the superseded Python service. Name the Go and browser copies that are actually deployed, and state where each assertion really runs: the backend cross-check skips inside the frontend image build (backend/ is outside that build context, and the builder stage is the only place CI runs those tests), while the units.js check does run there. Claude-Session: https://claude.ai/code/session_01AfXqHrxCJLs2D7hpQkiUiJ --- backend/CLAUDE.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/CLAUDE.md b/backend/CLAUDE.md index ccc1b68..02b479a 100644 --- a/backend/CLAUDE.md +++ b/backend/CLAUDE.md @@ -38,13 +38,20 @@ for systemd/CI callers. Entry target is `app:app`. `cache.js` reads `null` cross-origin and never revalidates. Don't change the ETag derivation or that list without checking `frontend/static/cache.js`. - **`data/grading.py::pct_ordinal()`** is mirrored by `frontend`'s - `shared.js::pctOrd()` — floor a percentile into `1..99`, never 0 or 100. + `server/internal/format::PctOrdinal` (SSR) and `static/shared.js::pctOrd()` + (browser) — floor a percentile into `1..99`, never 0 or 100. `TEMP_BANDS`/`RAIN_BANDS` are the source of truth for tier names and thresholds; changing them without the frontend produces tiers drawn in colours that disagree with the labels the API returns. -- **Fahrenheit country set** — `api/content_payloads.py`'s `F_COUNTRIES` must stay - identical to `frontend`'s `format.py::F_COUNTRIES` and `static/units.js`'s - `F_REGIONS`. There is a test asserting this. +- **Fahrenheit country set** — `api/content_payloads.py`'s `F_COUNTRIES` is + canonical; `frontend`'s `server/internal/format::FCountries` and + `static/units.js`'s `F_REGIONS` must stay identical to it. Both are asserted + by tests in `frontend/server/internal/format/format_test.go` — but note the + backend cross-check **skips in CI** (the frontend image's build context is + `frontend/`, so this file is unreachable from the builder stage, which is the + only place CI runs those tests). It fires on a full checkout. The `units.js` + check does run in the image build. `frontend/format.py`'s copy is the + superseded Python service's and is not deployed. - **`/healthz` and `/api/version` are deliberately I/O-free** so they stay cheap under tight healthcheck intervals.