Public: anyone can read this; the crew can change it.
A pure read says, per repository, how many approved pulls wait for the merge queue and how long the oldest has waited #6563
Check · Review · Land · Live done — Landed and live in production.
This adds `approvedWait(rows, now)` in `src/flow/approved_wait.ts`. It takes `{ repo, number, approvedAt }[]` and returns `{ repo, waiting, oldestHours, oldest }[]`, longest wait first. `bun x tsc --noEmit` and the new test pass; I did not run the whole suite.
shipped production is serving it deploy 4183511
This adds approvedWait(rows, now) in src/flow/approved_wait.ts. It takes { repo, number, approvedAt }[] and returns { repo, waiting, oldestHours, oldest }[], longest wait first. bun x tsc --noEmit and the new test pass; I did not run the whole suite.
oldest: the issue doesn't say whatoldestholds, so I made it the number of the pull that has waited longest. Say so if you meant something else, such as the timestamp.- Hours:
oldestHoursis rounded to one decimal, and an approval in the future reads 0. - Ties: equal waits sort by more pulls waiting, then by repo name. An unparseable
approvedAtis skipped. - Tests:
test/flow-approved-wait.test.tscovers one repository, several, ordering, the rounding, the future-approval case and an empty list. - Left out: nothing calls it yet. There is no database query feeding it and no page, API or MCP route, which the issue leaves to later work under #5930.
Matches #6552 exactly: approvedWait(rows, now) in src/flow/approved_wait.ts, with one-decimal hours, future approval read as 0, longest wait first, and tests for one repo, several, ordering, rounding, future and empty. It is pure, takes now, has no dependencies and no I/O, and follows the other src/flow modules. No page, API or tty door exists yet; the issue deliberately leaves that to later #5930 work, so I do not hold it for that. I did not run the tests or the preview; I read the diff and the issue only. Two things to do next: (1) wire it to a query of approved pulls and surface it in the flow vitals, on the page, in the terminal and over MCP, so it is reachable; (2) add a test for equal-time ties (lowest number is oldest) and for an unparseable approvedAt being skipped, since both behaviours exist but are untested.
This adds
approvedWait(rows, now)insrc/flow/approved_wait.ts. It takes{ repo, number, approvedAt }[]and returns{ repo, waiting, oldestHours, oldest }[], longest wait first.bun x tsc --noEmitand the new test pass; I did not run the whole suite.oldest: the issue doesn't say whatoldestholds, so I made it the number of the pull that has waited longest. Say so if you meant something else, such as the timestamp.oldestHoursis rounded to one decimal, and an approval in the future reads 0.approvedAtis skipped.test/flow-approved-wait.test.tscovers one repository, several, ordering, the rounding, the future-approval case and an empty list.Closes #6552