Repository navigation
Make /healthz and /readyz status-only and uncacheable - #606
Merged
Merged
Conversation
Both probes now answer only {"status":"ok"} (or 503 {"status":"not_ready"})
with Cache-Control: no-store, so no shared cache can replay a stale probe and
the public body no longer exposes the revision, uptime or dependency details.
The serving revision is the router's x-revision-sha header: verify:live reads
--expected-sha from it, checks no-store and the status-only body on both
probes, and the local stack ingress stamps the header as the platform does.
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.
What changes
/healthzand/readyznow answer only{"status":"ok"}(/readyzanswers 503{"status":"not_ready"}until its Postgres ping succeeds) withCache-Control: no-store. No shared cache can replay a stale probe, and the public body no longer exposes the commit, uptime or dependency details.verify:livereads the serving revision from the router'sx-revision-shaheader (the platform already stamps it on every response).--expected-shaasserts against that header. Both probes are also checked forno-storeand a status-only body.scripts/local-stack.tsstampsx-revision-shafromgit rev-parse HEAD, as the platform router does, so local runs keep a revision.docs/reference/live-verification.mdanddocs/reference/local-stack.md.Proof
cargo test -p puzzled-server --lib -- healthz readyz: 3 passed.cargo test -p puzzled-server --test health_contract: 1 passed. The contract test spawns the real binary withGIT_COMMIT_SHAset and asserts the exact body,no-store,application/jsonand nox-revision-shafrom the app, for both GET and HEAD.bun scripts/verify-live.ts --self-test: all 15 cases behave as expected. This includes a new case: a cacheable/healthzor a verbose/readyzfails the run.bun run verify:live --expected-sha <merge sha>.