Commit fd27dff
committed
health: /healthz reports live state, one payload on every backend
Production verification could not answer "is the geo denylist actually in
force?" from outside. The control board and the public policy showcase
both showed seven countries denied while every request was served 200,
and the only surfaces that could have settled it — the boot log and the
token-gated operator panel — need credentials a verification pass does
not have. So the probe now carries what it takes to tell.
Adds two fields:
app — WHICH satellite answered. `build` says which commit; on a fleet
where several hosts share a template and a hostname can be
repointed between services, those are different questions.
geo — {configured, denied}. Counts and flags only, never the country
codes: they are already public on /showcase/policy-panel, but a
health endpoint is not where anyone should learn policy.
FIXES TWO INHERITED DEFECTS found while adding them.
1. THE PAYLOAD WAS A SNAPSHOT. register_health_route computed it ONCE at
registration and the route closed over that dict. Harmless while every
field was static (ok/backend/dash_version/build never change for a
running process) and silently wrong the moment one is not — the route
is registered at run.py:566 and configure_geo runs ~150 lines later,
so the first version of this diagnostic reported the guardrail
UNCONFIGURED on a host where it is configured. The diagnostic lying in
exactly the situation it exists for. Now built per request.
2. FASTAPI HAD ITS OWN PAYLOAD. lib/asgi_routes.py constructed
HealthResponse independently and never called health_payload, so a
FastAPI deployment silently lacked `build` — and cd.yml's build-match
wait polls /healthz for precisely that field. It would have fallen
into the "predates the build field" warning path forever, verifying
whichever release happened to be serving rather than the one it
shipped. That is the muicharts defect the wait was written to prevent,
reintroduced by backend. Both backends now render from one function;
HealthResponse only types it for Swagger.
Three tests pin it: the app identity, that a live configure_geo change is
reflected (the snapshot regression), and that country codes never appear
in the body.
600 passed / 1 skipped (flask); 597 / 4 (fastapi); flake8 clean.1 parent 519a777 commit fd27dff
3 files changed
Lines changed: 130 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
56 | 70 | | |
57 | 71 | | |
58 | 72 | | |
| |||
102 | 116 | | |
103 | 117 | | |
104 | 118 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
35 | 63 | | |
36 | 64 | | |
37 | 65 | | |
| |||
41 | 69 | | |
42 | 70 | | |
43 | 71 | | |
44 | | - | |
45 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
46 | 80 | | |
47 | 81 | | |
48 | 82 | | |
49 | 83 | | |
50 | 84 | | |
51 | | - | |
| 85 | + | |
52 | 86 | | |
53 | 87 | | |
54 | 88 | | |
55 | 89 | | |
56 | 90 | | |
57 | | - | |
| 91 | + | |
58 | 92 | | |
59 | 93 | | |
60 | 94 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
0 commit comments