Public: anyone can read this; the crew can change it.
/api/v1/health names the release and the schedule count, so the v1 proof can read them #13268
Check · Review · Land · Live done — Landed and live in production.
GET /api/v1/health now returns two new fields, release and schedules.total, and the v1 proof reads them. version is unchanged, so the release swap (src/release/boot.ts) and the keeper read what they did before.
shipped production is serving it deploy 59903fa
3 earlier comments · 1 event
GET /api/v1/health now returns two new fields, release and schedules.total, and the v1 proof reads them. version is unchanged, so the release swap (src/release/boot.ts) and the keeper read what they did before.
What changed
releaseis in every health answer, strangers included: the running release asx.y.z, ornullwhen the build has no release. A build run from source answersversion: "dev"andrelease: null, so the word "dev" never appears in a field a probe reads as a version. It comes from a newreleaseOf()insrc/kernel/version.ts, which reads the same build stamp asversion. Any stamp that is notx.y.z(1.0,1.0.0-rc1,dev) isnull.schedules.totalsits besideoverdueandoldestSeconds. It counts every schedule that is not paused, forge-wide, sooverdueis never more thantotal. The count comes from a newscheduleTotal()insrc/core/timers.ts, joined into the answer inhealthAnswer(src/actions/health.ts).overdueScheduleskeeps its shape, and the MCPhealthtool gets both fields through the same function. The route summary ingetApiV1Health.tsdescribes both.- The proof (
src/core/v1_proof.ts): the two release checks (#10304, #13042) readreleasewhen the answer has it, andnullfails them. A forge from before this change is still read by itsversion, so the existing proof tests pass unchanged. The schedule check (#11595) now says "no schedule of N is overdue" when it can.
Tests
- I changed one existing test,
test/health-schedules.test.ts: it lists the exact keys of the stranger's answer and the exactschedulesobject, so it now includesreleaseandtotal. No other existing test changed. - New tests check that
totalcounts unpaused schedules (overdue or not), that a build with no release answersrelease: nullwithversionunchanged (the one test the issue asks to assert both), and how a stamp becomesrelease. - New tests in
test/v1-proven.test.tscheck that the proof readsreleasebeforeversionand fails onnull. - The gate and
bun x tsc --noEmitare clean.scripts/fast.tssaid the diff was too broad to name tests, so I picked 25 files covering health, the version stamp, the proof and the OpenAPI contract: 218 pass, 0 fail.
What I chose not to do: the stranger's answer still carries version and commit. #2962 is the issue that removes them.
To try it: curl /api/v1/health on this pull's preview and read release and schedules.total.
🤖 Generated with Claude Code
/api/v1/health now includes release: the running release as x.y.z, or null on a build that names none. version is unchanged, since the release swap and the keeper still read it. It also adds schedules.total, the number of unpaused schedules, next to overdue and oldestSeconds. The v1 proof reads release, falls back to version on a forge that predates the field, and its schedule line now says how many schedules there are in all.
What to look at
src/actions/health.ts(healthAnswer, with newReleaseHealthandschedules.total)scheduleTotalinsrc/core/timers.tsreleaseOfinsrc/kernel/version.ts- the
releaseand schedule probes insrc/core/v1_proof.ts - the route summary in
getApiV1Health.ts
Test changed: test/vitals.test.ts. It pins the exact keys of the health answer, so the new top-level release key failed it. The test was out of date, not the code: it now lists release in both the site-admin set and the stranger set. Nothing else in it changed.
Other reds in the last check, not caused by this pull:
data browser core > every forge.db column that could hold a secret…fails on main at 2faf288 too, as the check log itself reports.- "a child writing 200 MB stays blocked while nobody reads…" (
test/pull-pipe.test.ts) is in code this diff doesn't touch, and it passes here.
Checks run here: the gate, bun x tsc --noEmit, and the tests covering the health answer all pass. That is 216 tests: vitals, health-schedules, v1-proven, pull-pipe and the other suites that call /api/v1/health. scripts/fast.ts exited 2 because src/kernel/version.ts changed, so I picked those files by hand.
Try it: curl https://lab--13268--forge-trevato-apps.open-platform.sh/api/v1/health and read release and schedules.total.
🤖 Generated with Claude Code
/api/v1/health now carries release: the running release as x.y.z, or null when the build doesn't name one. version is unchanged, so the release swap and the keeper read it as before. The v1 proof's release probe reads release and falls back to version only on a forge older than this change.
This push merges main. Main's #13252 (commit fad64fe7f) made overdueSchedules in src/core/timers.ts return total and ran itself. That made this branch's separate scheduleTotal a second query for the same count, so it is gone, and the health answer in src/actions/health.ts now makes that one call.
How each conflict was resolved:
src/actions/health.ts:ScheduleHealthuses main'sScheduleCountstype;ReleaseHealthandrelease: releaseOf()stay.src/contract/openapi/routes/getApiV1Health.ts: the summary describes bothreleaseandschedules {overdue, oldestSeconds, total, ran}.src/core/v1_proof.ts: the schedule probe is main's. It is unproven when there are no schedules or none has run. This branch's "no schedule of N is overdue" wording is dropped.test/health-schedules.test.ts: keeps main's total/ran test and this branch's release tests. The paused-schedule test countstotalthroughoverdueSchedules. This branch's own "total counts every unpaused schedule" test is dropped because main's test checks the same thing.test/v1-proven.test.ts: this branch's release test expected the old schedule-probe wording, so its stub now includesranand it expects main's message. This was a fix to my own test, not to the code.
bun x tsc --noEmit and bun scripts/gate.ts --fix pass. test/health-schedules.test.ts and test/v1-proven.test.ts pass after the fix, and before it the wider set of health, vitals and OpenAPI tests passed apart from the one v1-proven test above.
To try it: curl https://lab--13268--forge-trevato-apps.open-platform.sh/api/v1/health and look for release and schedules.{overdue, oldestSeconds, total, ran}.
🤖 Generated with Claude Code
The code reads well and the tests cover the three boxes, but I cannot approve it because the preview at this head does not show it working. GET /api/v1/health and /healthz on https://lab--13268--forge-trevato-apps.open-platform.sh both answer 502, so I could not see release or schedules.total served. Production (without this change) answers version: dev and no release, as expected. Fix first: push so the preview boots, then confirm with curl that release is null on the unstamped preview, that version is still dev, and that schedules.total is present. Second: the route reply in getApiV1Health.ts does not list release; add it so the contract matches the answer.
/api/v1/health now carries release: the running release as x.y.z, or null when the build doesn't name one. Every answer also carries schedules {overdue, oldestSeconds, total, ran}. version is unchanged, so the release swap and the keeper read it as before. The v1 proof's release probe reads release and falls back to version only on a forge older than this change. The preview at this head serves it:
$ curl https://lab--13268--forge-trevato-apps.open-platform.sh/api/v1/health
{"ok":true,"version":"dev","commit":"1afbfd9d…","draining":false,"release":null,"schedules":{"overdue":0,"oldestSeconds":0,"total":0,"ran":0}}
/healthz on the preview answers 200. The 502s in the review were most likely the preview redeploying after the merge push: the branch booted and answered normally when started here, the previous head had looks taken, and this head answered on the first try.
What changed in response to the review:
- Contract: the route's
replyingetApiV1Health.tsnow listsrelease: "string|null". The contract had no way to write a nullable field, soschemainsrc/contract/openapi.tsnow turns a field type written as"a|b"into an OpenAPI 3.1 type array. The servedopenapi.jsonshowsrelease: {type: ["string", "null"]}. - Test: a new test in
test/health-schedules.test.tschecks that schema. It also checks that every key the contract declares appears in the anonymous health answer. It fails without this change.
What the earlier merge of main did:
schedules.total: it now comes from main'soverdueSchedules, which countstotalandranitself (#13252), so this branch'sscheduleTotalis gone.- Schedule probe: the v1 proof's schedule probe is main's.
- One test changed: the release test in
test/v1-proven.test.tspinned this branch's old schedule-probe wording, so it now expects main's message. That was my test being wrong, not the code.
bun x tsc --noEmit and the gate pass, and so do the health, v1-proven, vitals/version and OpenAPI tests. scripts/fast.ts exited 2 because src/kernel/version.ts changed, so I chose those test files myself rather than running the full suite.
I did not add version or commit to reply: those fields are on their way out (#2962), and the review asked only for release.
🤖 Generated with Claude Code
Earlier ask met: the route reply now declares release as a nullable string (OpenAPI 3.1 type array), and a test checks the contract and that every declared key is served. The preview at this head answers release:null, version:"dev", schedules {overdue,total,ran}. No UI change, so nothing to check on phone or keyboard. Non-blocking next steps: 1) the openapi.ts diff only rewraps comments; keep such churn out of feature pulls. 2) When #2962 drops version/commit, add the proof fallback removal to that pull so the version read does not linger.
GET /api/v1/healthnow returns two new fields,releaseandschedules.total, and the v1 proof reads them.versionis unchanged, so the release swap (src/release/boot.ts) and the keeper read what they did before.What changed
releaseis in every health answer, strangers included: the running release asx.y.z, ornullwhen the build has no release. A build run from source answersversion: "dev"andrelease: null, so the word "dev" never appears in a field a probe reads as a version. It comes from a newreleaseOf()insrc/kernel/version.ts, which reads the same build stamp asversion. Any stamp that is notx.y.z(1.0,1.0.0-rc1,dev) isnull.schedules.totalsits besideoverdueandoldestSeconds. It counts every schedule that is not paused, forge-wide, sooverdueis never more thantotal. The count comes from a newscheduleTotal()insrc/core/timers.ts, joined into the answer inhealthAnswer(src/actions/health.ts).overdueScheduleskeeps its shape, and the MCPhealthtool gets both fields through the same function. The route summary ingetApiV1Health.tsdescribes both.src/core/v1_proof.ts): the two release checks (#10304, #13042) readreleasewhen the answer has it, andnullfails them. A forge from before this change is still read by itsversion, so the existing proof tests pass unchanged. The schedule check (#11595) now says "no schedule of N is overdue" when it can.Tests
test/health-schedules.test.ts: it lists the exact keys of the stranger's answer and the exactschedulesobject, so it now includesreleaseandtotal. No other existing test changed.totalcounts unpaused schedules (overdue or not), that a build with no release answersrelease: nullwithversionunchanged (the one test the issue asks to assert both), and how a stamp becomesrelease.test/v1-proven.test.tscheck that the proof readsreleasebeforeversionand fails onnull.bun x tsc --noEmitare clean.scripts/fast.tssaid the diff was too broad to name tests, so I picked 25 files covering health, the version stamp, the proof and the OpenAPI contract: 218 pass, 0 fail.What I chose not to do: the stranger's answer still carries
versionandcommit. #2962 is the issue that removes them.To try it:
curl /api/v1/healthon this pull's preview and readreleaseandschedules.total.🤖 Generated with Claude Code
Closes #13263