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

The behind-main alarm fires when main is hundreds of commits past the newest release tag, proven by a test that drives the 366-commit case #15447

Merged opened this

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

Merged

When production serves the newest release tag but main has moved hundreds of commits past it, the forge now raises a release:behind cause. It used to say nothing. behindNeed only compared the serving version with the newest tag, so v0.7.629 live with main at v0.7.629-369 counted as "up to date".

Notes

shipped production is serving it deploy 3fede26

opened this

When production serves the newest release tag but main has moved hundreds of commits past it, the forge now raises a release:behind cause. It used to say nothing. behindNeed only compared the serving version with the newest tag, so v0.7.629 live with main at v0.7.629-369 counted as "up to date".

What changed

  • src/release/behind.ts:
    • readAhead(dir, version) runs git log --format=%ct refs/tags/v<version>..HEAD on the bare repository, reading the git store and never the network. It returns the number of commits past the tag and when the oldest of them was committed.
    • readNewest and the production reader (ownTagsReader) attach that to the newest release as ahead.
    • When production serves the newest tag and main has been past it for longer than AHEAD_MS, behindNeed returns: "production is 0.7.629; main is 369 commits ahead, 21 h".
    • AHEAD_MS is 12 h, set next to its reason: half the daily release tick, so a day of commits with no release is always reported. It is a constant, not a new setting.
  • Only one cause. It is the same release:behind cause on the existing vitals and pager path, so nothing pages twice. If production is also behind the newest tag, the existing "main released … ago" sentence takes precedence. There is no banner on home.
  • src/release/own_tags.ts feeds the count into the watch that production runs.

Tests

  • test/release-behind-main-ahead.test.ts builds a bare repository with fast-import: a v0.7.629 tag 30 h ago, then 369 commits between 21 h and 1 h ago, with production serving 0.7.629. It checks:
    • there is exactly one cause, with the count, the age and its since;
    • after v0.7.630 is cut at the tip but not yet served, it is still one cause, now saying "released";
    • once 0.7.630 is served, the cause clears;
    • the 12 h threshold holds at exactly 12 h and one minute past it.
  • This test fails on main without the fix.
  • bun scripts/gate.ts --fix and bun x tsc --noEmit are clean.
  • All 190 test files that scripts/fast.ts named pass (2430 tests), including test/release-behind.test.ts and test/no-alarm-banner.test.ts.

Not done

  • alarm_release_quiet.ts and alarm_main_ahead.ts are untouched. Why releases stopped, and why those alarms stayed quiet, belongs to #15443.
  • The release workflow and the chart are untouched.
  • The tag is assumed to be named v<version>, which is how release tags are written today. If git cannot answer, the reader keeps the plain tag check and raises nothing.
  • The issue asked me to keep a plan with keep_plan, but that tool was not available in this session.

To try it: bun test test/release-behind-main-ahead.test.ts. On production, the board should show the cause within one 10-minute tick.

🤖 Generated with Claude Code

Closes #15445

commented

When production serves the newest release tag but main has moved hundreds of commits past it, the forge now raises a release:behind cause. It used to say nothing. behindNeed only compared the serving version with the newest tag, so v0.7.629 live with main at v0.7.629-369 counted as "up to date".

What changed

  • src/release/behind.ts:
    • readAhead(dir, version) runs git log --format=%ct refs/tags/v<version>..HEAD on the bare repository, reading the git store and never the network. It returns the number of commits past the tag and when the oldest of them was committed.
    • readNewest and the production reader (ownTagsReader) attach that to the newest release as ahead.
    • When production serves the newest tag and main has been past it for longer than AHEAD_MS, behindNeed returns: "production is 0.7.629; main is 369 commits ahead, 21 h".
    • AHEAD_MS is 12 h, set next to its reason: half the daily release tick, so a day of commits with no release is always reported. It is a constant, not a new setting.
  • Only one cause. It is the same release:behind cause on the existing vitals and pager path, so nothing pages twice. If production is also behind the newest tag, the existing "main released … ago" sentence takes precedence. There is no banner on home.
  • src/release/own_tags.ts feeds the count into the watch that production runs.

Tests

  • test/release-behind-main-ahead.test.ts builds a bare repository with fast-import: a v0.7.629 tag 30 h ago, then 369 commits between 21 h and 1 h ago, with production serving 0.7.629. It checks:
    • there is exactly one cause, with the count, the age and its since;
    • after v0.7.630 is cut at the tip but not yet served, it is still one cause, now saying "released";
    • once 0.7.630 is served, the cause clears;
    • the 12 h threshold holds at exactly 12 h and one minute past it.
  • This test fails on main without the fix.
  • bun scripts/gate.ts --fix and bun x tsc --noEmit are clean.
  • All 190 test files that scripts/fast.ts named pass (2430 tests), including test/release-behind.test.ts and test/no-alarm-banner.test.ts.

Not done

  • alarm_release_quiet.ts and alarm_main_ahead.ts are untouched. Why releases stopped, and why those alarms stayed quiet, belongs to #15443.
  • The release workflow and the chart are untouched.
  • The tag is assumed to be named v<version>, which is how release tags are written today. If git cannot answer, the reader keeps the plain tag check and raises nothing.
  • The issue asked me to keep a plan with keep_plan, but that tool was not available in this session.

To try it: bun test test/release-behind-main-ahead.test.ts. On production, the board should show the cause within one 10-minute tick.

🤖 Generated with Claude Code

Approved

Approved. I fetched the preview home page: it answers 200 with 15 KB of server-rendered HTML and no alarm banner. This change adds no page or terminal surface. The diff is small and in one module, reads only the local git store, and adds one constant (AHEAD_MS) beside its reason. It keeps one cause on the existing vitals path. The test builds the 369-commit case and covers the threshold edge, the version-behind precedence and the clear. I did not run the tests myself.

Two things I would do next:

  1. readAhead lists every commit time since the tag on each 10-minute tick. Use git rev-list --count for the count and a bounded read for the oldest commit, so cost does not grow with the gap.
  2. The tag name is assumed to be v<version>. Add a test that a missing tag raises nothing (the reader keeps the plain tag check), so a rename cannot silently turn the alarm off.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs