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

The daily proof also runs once after each release goes live, so a release is proven within minutes, not at the next 24 h tick #15945

opened this

Merged 13d 9h ago, live in production

The daily proof now also runs once after each new release goes live, about three minutes after boot. Before this, a broken release could go unnoticed for up to a day. The daily tick still runs as before.

Notes

opened this

The daily proof now also runs once after each new release goes live, about three minutes after boot. Before this, a broken release could go unnoticed for up to a day. The daily tick still runs as before.

  • When it runs. The duty runner has a new optional hook on a duty, dueNow. It is asked on each tick before the duty's interval has passed. The budget, pause and one-at-a-time rules still apply, and if the hook throws, the runner treats that as "not due". The daily proof answers yes when three things hold: a release is running, no proof run has recorded that release yet, and the process has been up for SETTLE_MS (3 min).
  • What "release" means. It is the running commit in full, or the stamped version when there is no commit. A forge run from source (dev) has no release, so it only gets the daily tick.
  • Crash loops. The check keys on the release, not on boots: once a run records a release, restarts of that same release don't run it again. Each process also tries a given release at most once. So a run that fails before it records anything doesn't retry every minute.
  • Recording and the API. A new migration, 20261123120000-daily-proof-release (pin committed), adds a release column to daily_proof_run. Each run fills it, and GET /api/v1/proof/daily now returns release, which is null for older runs. The duty's row says proved release <short>, and adds "new since the run before" when the release is new.
  • Budget. I raised it from 2 to 24 runs a day and rewrote the reason. Releases land several times a day, so 2 would have stopped most release-triggered runs; a run costs no money, only a minute of reads of the forge's own public pages.

Not done: the release isn't shown on /status or its terminal screen, only in the API. I also didn't edit the API route file, since the answer comes from proofAnswer.

Tests. A new test in test/daily-proof.test.ts drives the real runner through these cases:

  • the first boot runs once;
  • the same release, minutes and hours later, doesn't run;
  • a new release doesn't run before the settle time, then runs exactly once;
  • three restarts of that release don't run;
  • the daily tick still runs a day later.

With the runner change reverted, the new test fails (expected 2 runs, got 1). Another new test checks that the API names the proved release. The existing tests now pass release: null so their expected output stays fixed. Also run and passing:

  • bun scripts/gate.ts --fix, which rewrapped one comment (committed);
  • bun x tsc --noEmit;
  • 14 maintain, schema, migration and status test files (150 pass);
  • the guide and feature-doc tests.

scripts/fast.ts named 2,564 files because the migration reaches nearly everything, so I picked the covering tests myself. The how-to is updated in docs/features/daily-proof.md.

The issue asks for a keep_plan plan; that tool wasn't available in this session, so the issue has no plan on it.

To try it: start a stamped forge with FORGE_URL set. About three minutes after boot, /maintenance shows a daily-proof row with proved release <short>, and /api/v1/proof/daily returns that release. Restarting the same build adds no new run.

🤖 Generated with Claude Code

Closes #15937

commented

The daily proof now also runs once after each new release goes live, about three minutes after boot. Before this, a broken release could go unnoticed for up to a day. The daily tick still runs as before.

  • When it runs. The duty runner has a new optional hook on a duty, dueNow. It is asked on each tick before the duty's interval has passed. The budget, pause and one-at-a-time rules still apply, and if the hook throws, the runner treats that as "not due". The daily proof answers yes when three things hold: a release is running, no proof run has recorded that release yet, and the process has been up for SETTLE_MS (3 min).
  • What "release" means. It is the running commit in full, or the stamped version when there is no commit. A forge run from source (dev) has no release, so it only gets the daily tick.
  • Crash loops. The check keys on the release, not on boots: once a run records a release, restarts of that same release don't run it again. Each process also tries a given release at most once. So a run that fails before it records anything doesn't retry every minute.
  • Recording and the API. A new migration, 20261123120000-daily-proof-release (pin committed), adds a release column to daily_proof_run. Each run fills it, and GET /api/v1/proof/daily now returns release, which is null for older runs. The duty's row says proved release <short>, and adds "new since the run before" when the release is new.
  • Budget. I raised it from 2 to 24 runs a day and rewrote the reason. Releases land several times a day, so 2 would have stopped most release-triggered runs; a run costs no money, only a minute of reads of the forge's own public pages.

Not done: the release isn't shown on /status or its terminal screen, only in the API. I also didn't edit the API route file, since the answer comes from proofAnswer.

Tests. A new test in test/daily-proof.test.ts drives the real runner through these cases:

  • the first boot runs once;
  • the same release, minutes and hours later, doesn't run;
  • a new release doesn't run before the settle time, then runs exactly once;
  • three restarts of that release don't run;
  • the daily tick still runs a day later.

With the runner change reverted, the new test fails (expected 2 runs, got 1). Another new test checks that the API names the proved release. The existing tests now pass release: null so their expected output stays fixed. Also run and passing:

  • bun scripts/gate.ts --fix, which rewrapped one comment (committed);
  • bun x tsc --noEmit;
  • 14 maintain, schema, migration and status test files (150 pass);
  • the guide and feature-doc tests.

scripts/fast.ts named 2,564 files because the migration reaches nearly everything, so I picked the covering tests myself. The how-to is updated in docs/features/daily-proof.md.

The issue asks for a keep_plan plan; that tool wasn't available in this session, so the issue has no plan on it.

To try it: start a stamped forge with FORGE_URL set. About three minutes after boot, /maintenance shows a daily-proof row with proved release <short>, and /api/v1/proof/daily returns that release. Restarting the same build adds no new run.

🤖 Generated with Claude Code

commented

The daily proof now also runs once after each release goes live, besides its daily tick. Each run records which release it proved, and GET /api/v1/proof/daily returns that as release.

When it runs. Duties get an optional dueNow hook (src/maintain/duty.ts), which the runner asks on every tick before the duty's daily interval is up. The budget, pause and one-at-a-time rules in src/maintain/runner.ts still apply, and an error in the hook counts as "not due".

The daily proof says it is due when three things hold:

  • a release is running: the full commit, or the stamped version when there is no commit (a forge run from source has neither and keeps the daily tick only);
  • no run has recorded that release yet;
  • the process has been up for SETTLE_MS (3 minutes), so it is serving.

Runs are keyed on the release, not on boots, so a crash loop proves its release once. Each process also tries a release at most once, so a run that cannot record does not repeat every minute.

What it records. A migration adds a release column to daily_proof_run, pinned as 20261123120000-daily-proof-release. The duty's row says proved release <short>. The API returns release: null for older runs and for forges that know no release.

Budget. It goes from 2 to 24 runs a day, and the stated reason now says a release adds one. Releases land several times a day, so 2 would have blocked most of these runs; each run costs no money, only a minute of reads of the forge's own pages.

Merge with main. Main (#15942) changed the duty to read the forge's own origin in process when no fetcher is given. The merge keeps that in-process read and adds the release logic on top.

Tests. A new test in test/daily-proof.test.ts drives the real runner through these cases:

  • the first boot runs once;
  • the same release, minutes or hours later, does not run;
  • a new release waits out the 3-minute settle time, then runs exactly once;
  • three restarts of that release run nothing;
  • the daily tick still runs a day later.

With the runner change removed, that test fails (2 runs expected, 1 got). Another test reads the release back from the API. The existing tests now pass release: null so their expected output does not depend on the environment.

After the merge, the type check, the gate and the daily-proof, maintain, duty-roster and schema test files all pass (78 tests); before it, 150 tests across 14 files passed. scripts/fast.ts named 2,564 test files because the migration reaches almost everything, so I picked the covering ones myself.

Not done. The release is not shown on /status or its terminal screen yet, only in the API.

Try it. Start a forge with a release stamp and FORGE_URL set. About three minutes after boot, /maintenance shows a daily-proof row saying proved release <short>, and /api/v1/proof/daily returns that release. Restarting the same build adds no run.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs