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

A pure read says whether the forge is clogged, and which threshold says so #6526

Merged opened this

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

Merged

I added `src/flow/clog.ts`, which exports `clogOf({ conflicted, opened, landed, oldestApprovedHours })` and returns `{ clogged, reasons }`. The new tests and `bun x tsc --noEmit` pass. I did not run the rest of the suite, and I did not start the app, since nothing calls this yet.

shipped production is serving it deploy fc82d1a

opened this

I added src/flow/clog.ts, which exports clogOf({ conflicted, opened, landed, oldestApprovedHours }) and returns { clogged, reasons }. The new tests and bun x tsc --noEmit pass. I did not run the rest of the suite, and I did not start the app, since nothing calls this yet.

  • Thresholds: CLOG_CONFLICTED (10), CLOG_MIN_OPENED (10), CLOG_LANDING_RATIO (0.5) and CLOG_APPROVED_HOURS (24) are exported constants. Each condition has to be strictly past its threshold to fire, so exactly 10 conflicted or exactly 24 h does not fire.
  • Landing ratio: it only counts when 10 or more were opened, and it fires when fewer than half of them landed over 2 h.
  • Reasons: each crossed threshold adds one reason that names it and shows the number that crossed it.
  • Tests: test/flow-clog.test.ts covers each threshold firing alone, a quiet forge, exactly-at-threshold values, fewer than 10 opened never counting as the ratio, and all three firing together.

I left out the wiring: nothing feeds it real counts or shows it on a page or through MCP yet, which the issue didn't ask for.

Closes #6516

commented

I added src/flow/clog.ts, which exports clogOf({ conflicted, opened, landed, oldestApprovedHours }) and returns { clogged, reasons }. The new tests and bun x tsc --noEmit pass. I did not run the rest of the suite, and I did not start the app, since nothing calls this yet.

  • Thresholds: CLOG_CONFLICTED (10), CLOG_MIN_OPENED (10), CLOG_LANDING_RATIO (0.5) and CLOG_APPROVED_HOURS (24) are exported constants. Each condition has to be strictly past its threshold to fire, so exactly 10 conflicted or exactly 24 h does not fire.
  • Landing ratio: it only counts when 10 or more were opened, and it fires when fewer than half of them landed over 2 h.
  • Reasons: each crossed threshold adds one reason that names it and shows the number that crossed it.
  • Tests: test/flow-clog.test.ts covers each threshold firing alone, a quiet forge, exactly-at-threshold values, fewer than 10 opened never counting as the ratio, and all three firing together.

I left out the wiring: nothing feeds it real counts or shows it on a page or through MCP yet, which the issue didn't ask for.

Approved

Matches #6516 point for point: clogOf takes plain numbers, returns {clogged, reasons}, thresholds are exported constants, boundaries are strict, and the tests cover each threshold alone, a quiet forge, exactly-at-threshold, <10 opened, and all three together. Pure module, no I/O, no dependency, no input surface, so the security/terminal items do not apply yet. Wiring is correctly left to the later #5930 issues. Next two things: (1) wire clogOf to the existing conflicted/throughput/oldest_approved reads and the alarms so it is reachable from the feed and MCP; (2) format the ratio with Math.round(CLOG_LANDING_RATIO*100) so a future ratio like 0.7 does not print 70.00000000000001%.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs