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

Merged opened this

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

Merged

`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

opened this

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.

Closes #6550

commented

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.

Approved

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:

  1. 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.
  2. Drop the unused _now parameter, or use it, when that caller lands. Also, the base-age test uses 500 + 1, which would read better as 501.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs