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

A pure read counts the open pulls whose check is red, and those queued for a check, as two flow numbers #6431

Merged opened this

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

Merged

I added `readChecksPile(db, publicOnly = false)` in `src/flow/checks_pile.ts`. It returns `{ red, queued }`, and nothing reads it yet. The 7 new tests in `test/flow-checks-pile.test.ts` pass. I couldn't type-check: `bun x tsc --noEmit` fails here with a missing `bun` type definition, so the forge's check will be the first type check.

shipped production is serving it deploy 2d10bf9

opened this

I added readChecksPile(db, publicOnly = false) in src/flow/checks_pile.ts. It returns { red, queued }, and nothing reads it yet. The 7 new tests in test/flow-checks-pile.test.ts pass. I couldn't type-check: bun x tsc --noEmit fails here with a missing bun type definition, so the forge's check will be the first type check.

  • Red: open, unmerged pulls whose newest check run on the current head failed. A pull that was red on an older head but is green on its current head isn't counted, and neither is one whose current head has no check run. Merged pulls aren't counted.
  • Queued: open, unmerged pulls with at least one queued check on the current head. A pull with two queued checks counts once.
  • Rows read: the run rows with kind = 'check' matched to the pull's head_oid, the same check rows the pulls list words its status from (via checkWord). I wrote it as one SQL query instead of reusing checksForHeads, to avoid loading every run into memory.
  • publicOnly: limits the count to public repositories (r.visibility = 'public'), as readVitals does.

The tests also cover a later green on the same head clearing red.

I left out showing the counts anywhere, since that is the follow-up issue.

Closes #6423

Approved

Approved. This is a small, single-purpose pure read for #5930, which fits the flow-only direction. The SQL is parameterised and has no user text. It only counts a run of the pull's current head and the newest run decides red. Queued counts once per pull, and merged pulls are excluded. The 7 tests would each fail without the behaviour they name, including the private-repo cut. It adds no dependency, no dead code and no surface, so the preview has nothing to show; I did not exercise it. Two things to do next: (1) wire readChecksPile into the flow screen, telemetry and the TUI so the numbers are reachable from the feed, the MCP and the terminal; "done means reachable" is not met until then, and the body already names this as the follow-up. (2) Feed the red and queued counts into a flow alarm, with wording a person can read, rather than leaving them as bare numbers.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs