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

The v1 proof reads production's schedules with no account: one public line says the oldest overdue schedule, and the probe passes on it #12515

Merged opened this

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

Merged

The v1 proof's #11595 probe now reads overdue schedules from a public answer, so it no longer comes back unproven for a stranger. The issue assumed GET /api/v1/telemetry/home was public, but production answers it with 401 to anyone without an account (it needs a signed-in user who holds telemetry access).

Notes

shipped production is serving it deploy d73d768

opened this

The v1 proof's #11595 probe now reads overdue schedules from a public answer, so it no longer comes back unproven for a stranger. The issue assumed GET /api/v1/telemetry/home was public, but production answers it with 401 to anyone without an account (it needs a signed-in user who holds telemetry access). The field therefore goes on GET /api/v1/health, which anyone may read and which is already no-store. That also means the issue's caching risk doesn't arise: no cached answer changes.

What changed

  • src/core/timers.ts: new overdueSchedules(db, now) returns {overdue, oldestSeconds}. A schedule counts as overdue when it is not paused and was due more than 5 minutes ago (OVERDUE_AFTER_MS, the same slack the old probe allowed). oldestSeconds is the age of the most overdue one, 0 when none is. It is one COUNT/MIN query on the existing timer_due index.
  • src/actions/health.ts: every health answer carries schedules — the stranger's, the signed-in reader's, the probe's and the admin's. It holds counts only: no owner, repository, app or schedule name.
  • src/contract/openapi/routes/getApiV1Health.ts: the summary describes the field, and reply now lists ok, draining and schedules.
  • scripts/v1-proven.ts: the #11595 probe reads /api/v1/health.

- It passes when nothing is overdue. - It fails naming the count and the age, e.g. 2 schedule(s) overdue, the oldest by 3 h 12 min (new ageWords helper). - It is unproven only when the field is absent or malformed.

  • --schedules owner/name removed from the script: nothing reads it any more. docs/features/v1-proven.md is updated to match.

Tests

  • New test/health-schedules.test.ts: it runs a real server with one never-fired schedule.

- It checks that a schedule within the 5-minute slack doesn't count, that one past it counts with the right age, and that a paused one doesn't count. - It checks that the stranger's answer has exactly commit, draining, ok, schedules, version. - It checks that the answer's text contains no owner, repository, app, schedule name or path.

  • test/v1-proven.test.ts: rewritten for the new source, covering pass, fail with the age wording, unproven when the field is missing or malformed, and network errors.
  • test/vitals.test.ts: I changed this existing test on purpose. Its key lists for the stranger's and admin's health answers pinned the old shape, and they now include schedules. Stranger answers get one more field than #2917 allowed; it carries counts only.

Checks

  • bun scripts/gate.ts and bun x tsc --noEmit are clean.
  • scripts/fast.ts exited 2 (diff too broad to name), so I picked the tests myself: every file touching health or timers, plus the v1-proven and OpenAPI suites. 889 pass, 1 skipped, 0 fail.
  • I didn't keep a plan on the issue: no keep_plan tool was available in this run.

What I left alone: /api/v1/telemetry/home is still private, and I didn't add a public schedule list per repository.

Try it: curl <preview>/api/v1/health with no token shows schedules, and bun scripts/v1-proven.ts <preview> prints pass #11595 when nothing is overdue.

🤖 Generated with Claude Code

Closes #12512

3 earlier comments
commented

The v1 proof's #11595 probe now reads overdue schedules from a public answer, so it no longer comes back unproven for a stranger. The issue assumed GET /api/v1/telemetry/home was public, but production answers it with 401 to anyone without an account (it needs a signed-in user who holds telemetry access). The field therefore goes on GET /api/v1/health, which anyone may read and which is already no-store. That also means the issue's caching risk doesn't arise: no cached answer changes.

What changed

  • src/core/timers.ts: new overdueSchedules(db, now) returns {overdue, oldestSeconds}. A schedule counts as overdue when it is not paused and was due more than 5 minutes ago (OVERDUE_AFTER_MS, the same slack the old probe allowed). oldestSeconds is the age of the most overdue one, 0 when none is. It is one COUNT/MIN query on the existing timer_due index.
  • src/actions/health.ts: every health answer carries schedules — the stranger's, the signed-in reader's, the probe's and the admin's. It holds counts only: no owner, repository, app or schedule name.
  • src/contract/openapi/routes/getApiV1Health.ts: the summary describes the field, and reply now lists ok, draining and schedules.
  • scripts/v1-proven.ts: the #11595 probe reads /api/v1/health.

- It passes when nothing is overdue. - It fails naming the count and the age, e.g. 2 schedule(s) overdue, the oldest by 3 h 12 min (new ageWords helper). - It is unproven only when the field is absent or malformed.

  • --schedules owner/name removed from the script: nothing reads it any more. docs/features/v1-proven.md is updated to match.

Tests

  • New test/health-schedules.test.ts: it runs a real server with one never-fired schedule.

- It checks that a schedule within the 5-minute slack doesn't count, that one past it counts with the right age, and that a paused one doesn't count. - It checks that the stranger's answer has exactly commit, draining, ok, schedules, version. - It checks that the answer's text contains no owner, repository, app, schedule name or path.

  • test/v1-proven.test.ts: rewritten for the new source, covering pass, fail with the age wording, unproven when the field is missing or malformed, and network errors.
  • test/vitals.test.ts: I changed this existing test on purpose. Its key lists for the stranger's and admin's health answers pinned the old shape, and they now include schedules. Stranger answers get one more field than #2917 allowed; it carries counts only.

Checks

  • bun scripts/gate.ts and bun x tsc --noEmit are clean.
  • scripts/fast.ts exited 2 (diff too broad to name), so I picked the tests myself: every file touching health or timers, plus the v1-proven and OpenAPI suites. 889 pass, 1 skipped, 0 fail.
  • I didn't keep a plan on the issue: no keep_plan tool was available in this run.

What I left alone: /api/v1/telemetry/home is still private, and I didn't add a public schedule list per repository.

Try it: curl <preview>/api/v1/health with no token shows schedules, and bun scripts/v1-proven.ts <preview> prints pass #11595 when nothing is overdue.

🤖 Generated with Claude Code

commented

The health answer now counts overdue schedules. GET /api/v1/health gains schedules: {overdue, oldestSeconds}, which is readable with no token. A schedule is overdue when it is unpaused and more than five minutes (OVERDUE_AFTER_MS, the firing loop's slack) past its due time. The v1 proof's #11595 probe reads this number from production without an account (#12512).

The latest commit only rewraps two doc comments to fit the gate's 100-column rule. They are in src/core/timers.ts (OVERDUE_AFTER_MS) and test/health-schedules.test.ts (arm), and no behaviour changes. bun scripts/gate.ts, bun x tsc --noEmit and bun test test/health-schedules.test.ts (3 pass) are green here.

Try it: curl $PREVIEW/api/v1/health with no token, and read schedules. Then bun scripts/v1-proven.ts $PREVIEW should print pass for #11595.

🤖 Generated with Claude Code

commented

The health answer now includes the forge's overdue schedules. Strangers get them too, with no account: GET /api/v1/health returns schedules: {overdue, oldestSeconds}. That's the count of unpaused schedules more than five minutes past due, plus the age in seconds of the oldest (0 when there are none). It is counts only and names no app or repository. The v1 proof's #11595 probe (scripts/v1-proven.ts) now reads this field instead of needing an account.

Where the count is read. overdueSchedules is in src/core/timers.ts. Only the new healthAnswer in src/actions/health.ts calls it, and only the /api/v1/health route and the MCP health tool use healthAnswer. readHealth is back to how it is on main. That matters because the asks pages, home and the forge view also call readHealth and never show schedules. When the count lived in readHealth, each of them made one extra SQL read. That pushed /api/v1/asks to 62 reads against its pages-budget line of 61, and the forge view to 261 against its bound of 260. No budget line was raised.

Tests changed. test/vitals.test.ts now expects the schedules key in both the admin and stranger answers. test/v1-proven.test.ts is updated for the probe's new read. test/health-schedules.test.ts is new and covers the count and the stranger's answer.

What ran. bun scripts/gate.ts and bun x tsc --noEmit are clean. These files pass (72 tests, 0 failures): pages-budget, api-forge-view, explore-rank, health-schedules, vitals, v1-proven, forge-needs-one-list and health-broken. test/spawn-stranger-cell.test.ts skips in this sandbox because it needs a cell, so it was not run here. It doesn't read health. explore-rank passes here on this branch and is likely a timing flake.

To try it: curl $PREVIEW/api/v1/health with no token shows schedules, and bun scripts/v1-proven.ts $PREVIEW prints pass #11595.

🤖 Generated with Claude Code

commented

The health answer (GET /api/v1/health and the MCP health tool) now reports overdue schedules as counts only, schedules: { overdue, oldestSeconds }, and anyone can read it without signing in. The v1 proof's #11595 probe (scripts/v1-proven.ts) reads that field instead of needing an account.

Changes

  • src/core/timers.ts: overdueSchedules counts the unpaused schedules due more than five minutes ago (OVERDUE_AFTER_MS) and gives the age in seconds of the oldest. The answer names no app, repository or schedule.
  • src/actions/health.ts: healthAnswer adds those counts to readHealth. Only the API and MCP health routes call it, so the other places that read health for its status don't run the extra query.
  • src/contract/openapi/routes/getApiV1Health.ts: the API contract describes the new field.

Earlier red check: this branch has been brought up to date with main. Two test files were counted against this pull, and both pass on the updated branch:

  • In test/scaffold.test.ts, the sign-in test spawns the app and talks to it on 127.0.0.1. The check log shows "egress refused: 127.0.0.1" around that failure, and nothing in this diff touches the scaffold or sign-in.
  • test/snapshot-repositories.test.ts was not on the old branch: the check ran main's newer copy of it. Its "a bundle that runs out of time" test passes on the updated branch.

No code or tests changed for the check. Two snapshot-encryption tests in that file can't run in this sandbox, because they need a loopback connection it blocks. The forge's check runs them. bun scripts/gate.ts, bun x tsc --noEmit, and test/health-schedules.test.ts, test/v1-proven.test.ts and test/vitals.test.ts (39 pass) are green.

To try it: curl $PREVIEW/api/v1/health with no token returns schedules, and bun scripts/v1-proven.ts $PREVIEW should print pass #11595.

🤖 Generated with Claude Code

Approved

Clean. The preview answers /api/v1/health with schedules {overdue, oldestSeconds}, counts only. The query is one COUNT/MIN, and only the health route and the MCP tool pay for it. Tests cover the overdue case, the slack, paused schedules, the stranger key set and the no-names check. The probe passes, fails naming the age, or is unproven when the field is absent. Box 1 names telemetry/home, but that route is private to strangers, so the field is on the public health answer; I count that as met in intent. Nit, not blocking: the last paragraph of docs/features/v1-proven.md has one over-long line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs