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

The forge computes the "red main" flow alarm (#5930) #6361

Merged opened this

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

Merged

I added `redMainAlarm(db, now)` in `src/flow/alarm_red_main.ts`. It returns `{ fired, since?, says }` and fires when the forge repository's main has been red for 10 minutes or more. The new test file passes and `tsc --noEmit` is clean. I did not run `design-lint` because nothing under `src/web/` changed.

shipped production is serving it deploy 0b2906d

opened this

I added redMainAlarm(db, now) in src/flow/alarm_red_main.ts. It returns { fired, since?, says } and fires when the forge repository's main has been red for 10 minutes or more. The new test file passes and tsc --noEmit is clean. I did not run design-lint because nothing under src/web/ changed.

  • Which repo: it reads the repository named by ownRepoPath(), which is FORGE_SENTINEL_REPO or else trevato/forge.
  • Red since: it counts from the first failed main check after the last green one, not from the latest failure. A main that keeps failing for 25 minutes reads as 25 minutes, not as however long ago the newest red finished.
  • What it says: for example "Main has been red for 25 min: test/standards.test.ts." It names the first failing test the check recorded, or falls back to the check's summary. When it hasn't fired it says "Main is green." or "Main went red N min ago."
  • Checks it counts: it reuses redMain() from src/checks/red_main.ts. A pull's red check, or a check still running, doesn't count as main being red.
  • Tests: test/flow-alarm-red-main.test.ts has six cases:

- no check yet doesn't fire - red for 11 min fires - red for 9 min doesn't - green after an old red doesn't - the streak counts from the first red after the last green - a pull's red check doesn't count

now is passed in, so the tests never use the wall clock.

I did not draw it anywhere; the banner is the separate issue. I touched only that one file and its test.

Closes #6343

commented

I added redMainAlarm(db, now) in src/flow/alarm_red_main.ts. It returns { fired, since?, says } and fires when the forge repository's main has been red for 10 minutes or more. The new test file passes and tsc --noEmit is clean. I did not run design-lint because nothing under src/web/ changed.

  • Which repo: it reads the repository named by ownRepoPath(), which is FORGE_SENTINEL_REPO or else trevato/forge.
  • Red since: it counts from the first failed main check after the last green one, not from the latest failure. A main that keeps failing for 25 minutes reads as 25 minutes, not as however long ago the newest red finished.
  • What it says: for example "Main has been red for 25 min: test/standards.test.ts." It names the first failing test the check recorded, or falls back to the check's summary. When it hasn't fired it says "Main is green." or "Main went red N min ago."
  • Checks it counts: it reuses redMain() from src/checks/red_main.ts. A pull's red check, or a check still running, doesn't count as main being red.
  • Tests: test/flow-alarm-red-main.test.ts has six cases:

- no check yet doesn't fire - red for 11 min fires - red for 9 min doesn't - green after an old red doesn't - the streak counts from the first red after the last green - a pull's red check doesn't count

now is passed in, so the tests never use the wall clock.

I did not draw it anywhere; the banner is the separate issue. I touched only that one file and its test.

Approved

Does what #6343 asked and nothing more: one file, one test file, no dependency, no UI. Nothing draws it, as the issue says, so the usual reach check (feed, MCP, tty) does not apply to this pull. The streak start (first failure after the last green, main-only, pulls excluded) is correct and the tests pass now in. Two things I would do next: (1) add a test for the summary fallback, where the check names no test, because that branch of says is untested. (2) Wire the alarm into the banner and the terminal in the follow-up issue, so a person and an agent can see it. A check that is still running between two reds is also not covered by a test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs