backend: correct the Fahrenheit-set and pct_ordinal contract notes
All checks were successful
secrets-guard / encrypted (pull_request) Successful in 5s
PR build (required check) / changes (pull_request) Successful in 8s
shell-lint / shellcheck (pull_request) Successful in 7s
PR build (required check) / validate-observability (pull_request) Has been skipped
PR build (required check) / build-frontend (pull_request) Successful in 1m35s
PR build (required check) / build-backend (pull_request) Successful in 1m47s
PR build (required check) / gate (pull_request) Successful in 2s

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
This commit is contained in:
Emi Griffith 2026-07-25 11:43:52 -07:00
parent b2b56bdc1a
commit 259f3f170d

View file

@ -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 `cache.js` reads `null` cross-origin and never revalidates. Don't change the
ETag derivation or that list without checking `frontend/static/cache.js`. ETag derivation or that list without checking `frontend/static/cache.js`.
- **`data/grading.py::pct_ordinal()`** is mirrored by `frontend`'s - **`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 `TEMP_BANDS`/`RAIN_BANDS` are the source of truth for tier names and
thresholds; changing them without the frontend produces tiers drawn in colours thresholds; changing them without the frontend produces tiers drawn in colours
that disagree with the labels the API returns. that disagree with the labels the API returns.
- **Fahrenheit country set**`api/content_payloads.py`'s `F_COUNTRIES` must stay - **Fahrenheit country set**`api/content_payloads.py`'s `F_COUNTRIES` is
identical to `frontend`'s `format.py::F_COUNTRIES` and `static/units.js`'s canonical; `frontend`'s `server/internal/format::FCountries` and
`F_REGIONS`. There is a test asserting this. `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 - **`/healthz` and `/api/version` are deliberately I/O-free** so they stay cheap
under tight healthcheck intervals. under tight healthcheck intervals.