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

A pure read says the time to land: the median and the slowest hours from a pull's opening to its landing over the last 24 h #6447

Merged opened this

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

Merged

`readLeadTime(db, now, publicOnly)` is now in `src/flow/lead_time.ts`. It returns `{ landed, medianHours, maxHours }` for pulls merged into their repository's default branch in the last 24 hours. Both hours are null when nothing landed. The six new tests pass. I didn't get a type check: `bun x tsc --noEmit` stopped with "Cannot find type definition file for 'bun'", and I didn't look into why.

shipped production is serving it deploy d5b2fe2

opened this

readLeadTime(db, now, publicOnly) is now in src/flow/lead_time.ts. It returns { landed, medianHours, maxHours } for pulls merged into their repository's default branch in the last 24 hours. Both hours are null when nothing landed. The six new tests pass. I didn't get a type check: bun x tsc --noEmit stopped with "Cannot find type definition file for 'bun'", and I didn't look into why.

  • How it reads: one SQL query returns each landed pull's hours, sorted. SQLite has no median, so the median is worked out in code: the middle value, or the average of the middle two when the count is even.
  • publicOnly: it uses the same visibility rule as readVitals.
  • Tests: test/flow-lead-time.test.ts covers the four cases from the issue (three pulls, a non-default branch left out, one older than 24 hours left out, publicOnly hiding private repositories). It also covers the empty case and the even-count median.
  • Left out: nothing calls it yet, as the issue asks. I did not touch vitals, the MCP or any page.

Closes #6442

commented

readLeadTime(db, now, publicOnly) is now in src/flow/lead_time.ts. It returns { landed, medianHours, maxHours } for pulls merged into their repository's default branch in the last 24 hours. Both hours are null when nothing landed. The six new tests pass. I didn't get a type check: bun x tsc --noEmit stopped with "Cannot find type definition file for 'bun'", and I didn't look into why.

  • How it reads: one SQL query returns each landed pull's hours, sorted. SQLite has no median, so the median is worked out in code: the middle value, or the average of the middle two when the count is even.
  • publicOnly: it uses the same visibility rule as readVitals.
  • Tests: test/flow-lead-time.test.ts covers the four cases from the issue (three pulls, a non-default branch left out, one older than 24 hours left out, publicOnly hiding private repositories). It also covers the empty case and the even-count median.
  • Left out: nothing calls it yet, as the issue asks. I did not touch vitals, the MCP or any page.
Approved

Matches #6442 exactly: one SQL read, the same publicOnly and default-branch rule as readVitals, null hours when none landed, and tests for the median, the non-default branch, the 24 h cutoff and publicOnly. It adds no route, tool or page, so there is nothing to look at in the preview or the screenshots. Nothing reads it yet, as the issue asks. Next two things: (1) wire it into vitals and the KPI words once the follow-ups land, so it is reachable from the page, the MCP and src/tty.ts; (2) add a case for a pull with merged_at earlier than created_at, to pin the Math.max(0) clamp.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs