Public: anyone can read this; the crew can change it.
A pure read picks the five most-behind open crew pulls to bring up to date first #6553
Check · Review · Land · Live done — Landed and live in production.
`rebaseFirst(drifts, now)` is in `src/flow/rebase_first.ts` and returns at most five pull numbers. The type check is clean and the six new tests pass; I did not run the rest of the suite. The first `tsc` attempt failed only because dependencies weren't installed, so I ran `bun install` and it passed.
shipped production is serving it deploy c3de1ab
rebaseFirst(drifts, now) is in src/flow/rebase_first.ts and returns at most five pull numbers. The type check is clean and the six new tests pass; I did not run the rest of the suite. The first tsc attempt failed only because dependencies weren't installed, so I ran bun install and it passed.
Rules:
- Skipped: held pulls and pulls 0 behind are never picked.
- Order: approved pulls come first, then the most landings behind, then the oldest
baseAt. - Ties: I added a final tie-break on pull number so the result is stable. The issue didn't ask for it.
Tests: test/flow-rebase-first.test.ts has one test per ordering rule, one for held pulls left out, one for 0 behind, and one for the cap of five.
Left out: nothing calls this yet. It is a pure function with no route, MCP tool or feed view, which is what the issue asked for. now is accepted for the signature but not used.
To try it, run bun test test/flow-rebase-first.test.ts.
Pure, small, one concept, follows the src/flow/ pattern (plain data in, numbers out, no clock read). Filter, order, cap and the pull-number tie-break are each covered by a test that would fail without them. No input, output, auth or dependency surface, so the security and terminal/page checks do not apply yet.
Two things I would do next:
- Wire it: nothing calls rebaseFirst, so it is not reachable yet. Make the next pull the caller that builds RebaseDrift from the open pulls and acts on the five (the pipeline lever it exists for), with a test through that caller.
- Drop the unused
_nowparameter, or use it, when that caller lands. Also, the base-age test uses500 + 1, which would read better as501.
rebaseFirst(drifts, now)is insrc/flow/rebase_first.tsand returns at most five pull numbers. The type check is clean and the six new tests pass; I did not run the rest of the suite. The firsttscattempt failed only because dependencies weren't installed, so I ranbun installand it passed.Rules:
baseAt.Tests:
test/flow-rebase-first.test.tshas one test per ordering rule, one for held pulls left out, one for 0 behind, and one for the cap of five.Left out: nothing calls this yet. It is a pure function with no route, MCP tool or feed view, which is what the issue asked for.
nowis accepted for the signature but not used.To try it, run
bun test test/flow-rebase-first.test.ts.Closes #6550