Skip to content

Make /healthz and /readyz status-only and uncacheable - #606

Merged
shtse8 merged 1 commit into
mainfrom
fix/tryit-healthz-nostore
Nov 18, 2026
Merged

shtse8 merged 1 commit into
mainfrom
fix/tryit-healthz-nostore

Conversation

@shtse8

@shtse8 shtse8 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

What changes

  • /healthz and /readyz now answer only {"status":"ok"} (/readyz answers 503 {"status":"not_ready"} until its Postgres ping succeeds) with Cache-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:live reads the serving revision from the router's x-revision-sha header (the platform already stamps it on every response). --expected-sha asserts against that header. Both probes are also checked for no-store and a status-only body.
  • scripts/local-stack.ts stamps x-revision-sha from git rev-parse HEAD, as the platform router does, so local runs keep a revision.
  • Docs updated: docs/reference/live-verification.md and docs/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 with GIT_COMMIT_SHA set and asserts the exact body, no-store, application/json and no x-revision-sha from 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 /healthz or a verbose /readyz fails the run.
  • After deploy: bun run verify:live --expected-sha <merge sha>.

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.
@shtse8
shtse8 enabled auto-merge November 18, 2026 16:26
@shtse8
shtse8 added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 5294540 Nov 18, 2026
15 checks passed
@shtse8
shtse8 deleted the fix/tryit-healthz-nostore branch November 18, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant