Repository navigation
fix(deploy): probes that can say no — readiness reads /readyz, not a literal - #437
Merged
Merged
Conversation
…literal
Every probe on the web-api pod was one a broken pod passed.
`er-server`'s readiness and liveness both pointed at `/healthz`, which is a
static literal (`Json(json!({"status": "ok"}))`) — so a pod whose control
plane was unreachable reported ready and kept taking traffic it could only
500 on. `/readyz` has existed for a while, actually connects to the control
store, and nothing read it; its own doc comment said so. `er-web` was worse:
both its probes hit `/`, the prerendered marketing page, which answers 200
from a container with an unusable environment and an upstream that has not
booted.
That matters now because a blue/green cutover gate is only as good as the
probe it reads. "The new colour is ready" has to mean the new colour can
serve.
- `er-server`: readiness + a new startupProbe read `/readyz`. Liveness KEEPS
`/healthz`, and that split is the point — a liveness probe that fails on a
dependency outage restarts a healthy pod and makes the outage worse.
- `er-web`: readiness + startupProbe read a new `GET /api/healthz`, which
validates the whole env schema and probes its in-pod er-server over
localhost. Liveness keeps `/`, where a static page is exactly the right
answer: the question is whether the node process is wedged.
- The startupProbe is what lets the other two drop `initialDelaySeconds`:
both are disabled until it passes, so the boot — which runs `ensure_schema`
— gets a real budget instead of a guessed delay.
- Readiness carries `failureThreshold: 6`. With one replica, leaving the
Service is a hard 503 at the edge, and `/readyz` times out after 2s, so an
idle dev Aurora (`min_capacity = 0`) resuming would otherwise flip a working
pod out of rotation for the ~15s it takes to wake.
The readiness decision lives in `src/lib/bff/readiness.ts`, not the route
handler. That is the tier rule here — BFF routes are outside the coverage
scope, `src/lib` is the unit tier's remit — and it is what makes the two
branches worth testing reachable: a hang and a refused connection, neither of
which a flow test can produce on demand. Eleven cases, including that the
probe sends no credential and that the body keeps its three keys whatever the
outcome.
Deliberately NOT checked: the erweb database. Both colours share one Postgres,
so failing readiness on it would empty the Service and turn a degraded product
into a hard 503 — the same reason liveness stays a literal.
Two claims this makes actively wrong, corrected here rather than left to
mislead the next reader: the security skill said `/healthz` was the only
anonymous route, and `Chart.yaml` described er-dispatcher as "init-gated on
the API's /healthz" when that Deployment has no init container at all (the
advisory lock in `ensure_schema` replaced the need for one).
Does not change what the control plane costs to run idle: the dispatcher's
claim loop already polls the same database on a 5s idle cap, so nothing could
auto-pause while a namespace is up either way.
Verified: `make check` green (fmt, clippy, doc with -D warnings,
`er-entity verify`, skills-check, workspace tests); `pnpm check` green at 733
tests and 56.8% line coverage against a 48% floor; `helm lint` +
`helm template` + `kubeconform` clean on the default and kind profiles, with
the kind profile correctly rendering no `/api/healthz` since `web.enabled` is
false. The new test was observed FAILING — probe path reverted to `/healthz`
— before being trusted.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
bm/bluegreen-p1-probes
branch
from
November 3, 2026 04:12
c01e172 to
e3e7e02
Compare
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every probe on the
web-apipod was one a broken pod passed.er-server's readiness and liveness both pointed at/healthz, a static literal — so a pod whose control plane was unreachable reported ready and kept taking traffic it could only 500 on./readyzalready existed, already connects to the control store, and nothing read it; its own doc comment said exactly that.er-webwas worse: both probes hit/, the prerendered marketing page, which answers 200 from a container with an unusable environment and an upstream that hasn't booted.This is the first of a stack working toward blue/green for the web API, and it comes first because a cutover gate is only as good as the probe it reads. "The new colour is ready" has to mean the new colour can serve.
What changed
er-server/readyz— connects to the control store/healthz(unchanged)er-web/api/healthz— new/(unchanged)startupProbeis what lets the other two dropinitialDelaySeconds— both are disabled until it passes, so the boot (which runsensure_schema) gets a real budget instead of a guessed delay.failureThreshold: 6. At one replica, leaving the Service is a hard 503 at the edge, and/readyztimes out after 2s — so an idle dev Aurora (min_capacity = 0) resuming would otherwise flip a working pod out of rotation for the ~15s it takes to wake.Where the logic lives, and why
The readiness decision is in
src/lib/bff/readiness.ts, not the route handler. That's the tier rule here — BFF routes sit outside the coverage scope,src/libis the unit tier's remit — and it's what makes the branches worth testing reachable: a hang and a refused connection, neither of which a flow test can produce on demand. Eleven cases, including that the probe sends no credential and that the body keeps its three keys whatever the outcome.Deliberately not checked: the erweb database. Both colours share one Postgres, so failing readiness on it would empty the Service and turn a degraded product into a hard 503 — same reasoning as keeping liveness a literal.
Two stale claims corrected
This PR makes both actively wrong, so they're fixed here rather than left to mislead:
securityskill said/healthzwas the only anonymous route;Chart.yamldescribeder-dispatcheras "init-gated on the API's/healthz" when that Deployment has no init container at all — the advisory lock inensure_schemareplaced the need for one.Does this cost anything to run idle?
No. A reviewer might reasonably worry that probing Aurora every 5s stops dev's
min_capacity = 0cluster auto-pausing. It doesn't change anything: the dispatcher's claim loop already polls the same database on a 5s idle cap, so nothing could pause while a namespace is up either way.Verification
make checkgreen — fmt, clippy,cargo docwith-D warnings,er-entity verify,skills-check, workspace tests.pnpm checkgreen — 733 tests, 56.8% line coverage against a 48% floor.helm lint+helm template+kubeconformclean on the default and kind profiles; the kind profile correctly renders no/api/healthzsinceweb.enabled: false./healthz, confirmed the assertion fires with a useful message.One behaviour change worth knowing as a reviewer: a container whose environment doesn't parse now never becomes ready, where before it started and 500d on first use. With
--atomic --waitthat fails the release instead of appearing to succeed. I checked that all five required vars do reach the container in a provisioned namespace —ERSERVER_OPERATOR_TOKENcomes from theerserversecret via an explicitenv:entry, notenvFrom.🤖 Generated with Claude Code