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

After a new version boots, the forge runs its smoke check against its own public URL and says on the board, and on the phone once, if the release is unproven #2575

opened this

Merged 48d 8h ago, live in production

A newly booted version now proves itself once against the forge's own public URL, and an unproven release shows up as a card and a page. The type check is clean and the tests I ran pass: the new test/release-prove.test.ts, plus smoke, vitals and notify-causes. I did not run the whole suite.

Notes

opened this

A newly booted version now proves itself once against the forge's own public URL, and an unproven release shows up as a card and a page. The type check is clean and the tests I ran pass: the new test/release-prove.test.ts, plus smoke, vitals and notify-causes. I did not run the whole suite.

What changed

  • src/release/prove.ts (new):
    • On boot, proveRelease does nothing if the stamped version equals the last one recorded. Otherwise it polls the public /healthz until X-Forge-Version matches, then runs the smoke checks in-process.
    • The verdict is stored in FORGE_APP_DATA/release/proof.json, so restarting the same version never reruns it, and nothing loops.
    • If the URL never answers as the new version, it gives up after 10 minutes with "unproven: the public URL never answered as <version>".
  • scripts/smoke.ts: smoke() was already exported. It now takes an injectable fetch and an anonymousBoard option, and the CLI is unchanged.
  • Vitals and pager:
    • A failed proof raises a release cause in src/kernel/vitals.ts. Its sentence reads "Release X is unproven: <first failing check>", and it clears when a later version passes.
    • The cause pager (owned() in src/crew/incidents.ts) now pages release once through the existing pager and posts "Recovered" when it clears.
  • src/main.ts: starts the proof after "forge is up" and logs the result.
  • Tests: a fake fetch covers a pass being recorded, a failure raising the cause once, a restart of the same version not running, a later pass clearing the card, and the 10-minute give-up. I also added release to the owned-causes list in test/notify-causes.test.ts.

Choices to check

  • The card appears on the board as a normal degraded line ("Release X is unproven: …"). It does not carry the literal "needs you: forge" prefix, which only the guard-view verdict uses (kernel/guard_verdict.ts). Say if you want the prefix.
  • The forge has no token for itself. With FORGE_TOKEN unset, /board redirecting to sign-in counts as a pass, via anonymousBoard. With a token set, /board must answer 200 as before.
  • An unstamped (dev) forge proves nothing.
  • A crash mid-proof reruns it on the next boot, since the verdict is only written at the end.
  • Rollback and the release workflow stay with #2283. I did not touch .forgejo/ or charts/.

Try it: run bun test test/release-prove.test.ts. To see it live, boot with FORGE_VERSION=1.2.3. The log line "release proof" shows the verdict, and a failure shows on the admin board strip.

🤖 Generated with Claude Code

Closes #2574

commented

A newly booted version now proves itself once against the forge's own public URL, and an unproven release shows up as a card and a page. The type check is clean and the tests I ran pass: the new test/release-prove.test.ts, plus smoke, vitals and notify-causes. I did not run the whole suite.

What changed

  • src/release/prove.ts (new):
    • On boot, proveRelease does nothing if the stamped version equals the last one recorded. Otherwise it polls the public /healthz until X-Forge-Version matches, then runs the smoke checks in-process.
    • The verdict is stored in FORGE_APP_DATA/release/proof.json, so restarting the same version never reruns it, and nothing loops.
    • If the URL never answers as the new version, it gives up after 10 minutes with "unproven: the public URL never answered as <version>".
  • scripts/smoke.ts: smoke() was already exported. It now takes an injectable fetch and an anonymousBoard option, and the CLI is unchanged.
  • Vitals and pager:
    • A failed proof raises a release cause in src/kernel/vitals.ts. Its sentence reads "Release X is unproven: <first failing check>", and it clears when a later version passes.
    • The cause pager (owned() in src/crew/incidents.ts) now pages release once through the existing pager and posts "Recovered" when it clears.
  • src/main.ts: starts the proof after "forge is up" and logs the result.
  • Tests: a fake fetch covers a pass being recorded, a failure raising the cause once, a restart of the same version not running, a later pass clearing the card, and the 10-minute give-up. I also added release to the owned-causes list in test/notify-causes.test.ts.

Choices to check

  • The card appears on the board as a normal degraded line ("Release X is unproven: …"). It does not carry the literal "needs you: forge" prefix, which only the guard-view verdict uses (kernel/guard_verdict.ts). Say if you want the prefix.
  • The forge has no token for itself. With FORGE_TOKEN unset, /board redirecting to sign-in counts as a pass, via anonymousBoard. With a token set, /board must answer 200 as before.
  • An unstamped (dev) forge proves nothing.
  • A crash mid-proof reruns it on the next boot, since the verdict is only written at the end.
  • Rollback and the release workflow stay with #2283. I did not touch .forgejo/ or charts/.

Try it: run bun test test/release-prove.test.ts. To see it live, boot with FORGE_VERSION=1.2.3. The log line "release proof" shows the verdict, and a failure shows on the admin board strip.

🤖 Generated with Claude Code

commented

I've pushed fixes for all of juniper's points to the same branch. The type check is clean, and the new tests pass along with test/smoke.test.ts and test/release-prove.test.ts. I did not run the full suite.

  • Vitals test: test/vitals-release.test.ts writes release/proof.json under the data dir and covers three cases:
    • With no proof, there is no release cause.
    • A failing proof gives a release cause with the exact sentence, its since, and the /board link.
    • A passing proof clears it.
    • Deleting the proofNeed call in src/kernel/vitals.ts now fails the second case.
  • anonymousBoard test: a new case in test/smoke.test.ts checks that a 302 from /board passes with the option and no token. The same 302 still fails without the option and when a token is given, in this case a wrong one.
  • Smaller points:
    • scripts/smoke.ts now passes fetch alone to waitForVersion.
    • src/release/prove.ts uses checkLine(failures[0]) without the template wrapper.
    • The card's link is now /board instead of /settings/capacity, and the vitals test checks it.
  • Terminal: the terminal's first screen already prints the same cards through forgeNeeds, which maps degraded, so the release card shows there with no extra code. I added a README paragraph saying so and describing how a version proves itself. I did not add a terminal-specific test.
Sign in to join this conversation.

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

Keyboard shortcuts

Docs