Public: anyone can read this; the crew can change it.

Health tells a stranger only ok and draining #16604

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

StrangerHealth in src/actions/health.ts is now { ok, draining }. Signed out, /api/v1/health and /health return only ok, draining, release and schedules. A caller sending the probe or signed in to an account still gets version and commit.

Notes

shipped production is serving it deploy d5add18

opened this

StrangerHealth in src/actions/health.ts is now { ok, draining }. Signed out, /api/v1/health and /health return only ok, draining, release and schedules. A caller sending the probe or signed in to an account still gets version and commit.

Probe callers checked first. Every caller that reads version or commit from health already sends x-forge-probe, so none needed changing:

  • swap: startRelease, called from checks/landing.ts, keeper/swapper.ts (through keeper/wire.ts) and release/rollback.ts
  • boot: release/boot.ts
  • launch: release/launch.ts, which has its own copy of the probe code
  • release proof: release/prove.ts and the keeper's probes

Two other readers only use ok or release: snapshot/boot.ts and core/v1_proof.ts. release stays in the stranger's answer because the v1 proof reads it (#13263).

Other code that read version or commit off a stranger's answer:

  • forgeLines in src/tui/screens/system.ts now prints forge · serving for a stranger instead of the version and commit.
  • The discovery check in scripts/forge-compat-lab/driver.ts now requires a boolean ok from health, and takes the version from /api/v1/version when health gives none.

Tests:

  • New in test/health.test.ts: a stranger, or a wrong probe value, gets exactly the four keys on both paths; the real probe gets the running version and commit.
  • test/vitals.test.ts and test/health-schedules.test.ts now expect the stranger shape.
  • These tests were wrong under the new rule, because they expected a stranger to see version or commit. Each now reads them with the probe or a member token: test/health-schedules.test.ts (#13263 case), test/version.test.ts, test/status-page.test.ts, test/app-release-15497.test.ts.
  • test/tui-system.test.ts now expects the stranger's line forge · serving.

Not done:

  • The commit is still public on /status and /llms.txt, so this change makes health say less but doesn't hide the commit. Making it secret would be a separate issue.
  • I didn't edit the OpenAPI text for the route ("a stranger is told little"); it's still accurate.
  • No new functions, so there was nothing to check with scripts/similar.ts or reuse.
  • I didn't update the plan on the issue: the keep_plan and estimate tools weren't available in this session.

Checks: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts named 2754 test files, far too many to run here, so I ran the 89 test files that read health (822 tests, 0 failures, 1 skipped) and the release swap, boot, launch and rollback suites.

To try: curl $URL/api/v1/health signed out shows { ok, draining, release, schedules }. With a token, or the x-forge-probe header, it also includes version and commit.

🤖 Generated with Claude Code

Closes #16262

commented

StrangerHealth in src/actions/health.ts is now { ok, draining }. Signed out, /api/v1/health and /health return only ok, draining, release and schedules. A caller sending the probe or signed in to an account still gets version and commit.

Probe callers checked first. Every caller that reads version or commit from health already sends x-forge-probe, so none needed changing:

  • swap: startRelease, called from checks/landing.ts, keeper/swapper.ts (through keeper/wire.ts) and release/rollback.ts
  • boot: release/boot.ts
  • launch: release/launch.ts, which has its own copy of the probe code
  • release proof: release/prove.ts and the keeper's probes

Two other readers only use ok or release: snapshot/boot.ts and core/v1_proof.ts. release stays in the stranger's answer because the v1 proof reads it (#13263).

Other code that read version or commit off a stranger's answer:

  • forgeLines in src/tui/screens/system.ts now prints forge · serving for a stranger instead of the version and commit.
  • The discovery check in scripts/forge-compat-lab/driver.ts now requires a boolean ok from health, and takes the version from /api/v1/version when health gives none.

Tests:

  • New in test/health.test.ts: a stranger, or a wrong probe value, gets exactly the four keys on both paths; the real probe gets the running version and commit.
  • test/vitals.test.ts and test/health-schedules.test.ts now expect the stranger shape.
  • These tests were wrong under the new rule, because they expected a stranger to see version or commit. Each now reads them with the probe or a member token: test/health-schedules.test.ts (#13263 case), test/version.test.ts, test/status-page.test.ts, test/app-release-15497.test.ts.
  • test/tui-system.test.ts now expects the stranger's line forge · serving.

Not done:

  • The commit is still public on /status and /llms.txt, so this change makes health say less but doesn't hide the commit. Making it secret would be a separate issue.
  • I didn't edit the OpenAPI text for the route ("a stranger is told little"); it's still accurate.
  • No new functions, so there was nothing to check with scripts/similar.ts or reuse.
  • I didn't update the plan on the issue: the keep_plan and estimate tools weren't available in this session.

Checks: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts named 2754 test files, far too many to run here, so I ran the 89 test files that read health (822 tests, 0 failures, 1 skipped) and the release swap, boot, launch and rollback suites.

To try: curl $URL/api/v1/health signed out shows { ok, draining, release, schedules }. With a token, or the x-forge-probe header, it also includes version and commit.

🤖 Generated with Claude Code

Approved

Signed out, the preview's /api/v1/health and /health answer only ok, draining, release and schedules. The probe and signed-in paths keep version and commit, and the tests cover both. The TUI stranger line and the compat-lab driver were updated to match. Next two things: (1) the commit is still public on /status and /llms.txt, so decide in a follow-up whether that is intended; (2) add a short line to the OpenAPI health description saying version and commit go to the probe and signed-in callers only.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs