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

A pure read picks the crew pulls with no push for 7 days, oldest first, with the note that folds each back into its issue #6541

Merged opened this

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

Merged

I added `staleFold(pulls, now)` in `src/flow/stale_fold.ts`. It returns the pulls with no push for 7 days or more, oldest first, each with its fold-back note. The six new tests and `bun x tsc --noEmit` pass; I did not run the full check.

shipped production is serving it deploy c564139

opened this

I added staleFold(pulls, now) in src/flow/stale_fold.ts. It returns the pulls with no push for 7 days or more, oldest first, each with its fold-back note. The six new tests and bun x tsc --noEmit pass; I did not run the full check.

  • Input and output: each input pull is { number, issueNumber, branch, lastPushAt, approved }, with lastPushAt as an ISO string. Each result is the same pull plus days and note.
  • Stale test: exactly 7 days counts as stale, and just under does not. D in the note is the whole number of days, rounded down.
  • Order: oldest push first, with ties broken by pull number.
  • Left out: approved pulls. I also skip any pull whose lastPushAt isn't a readable date, which the issue didn't ask for.
  • Note: "Folded back: pull #N had no push for D days; its branch <branch> keeps the work." A pull with issueNumber: null is still listed, with note: null.
  • Not done: nothing calls it yet, so it isn't reachable from the feed or the MCP. It is read-only and closes nothing, since folding a pull back is a person's decision.

The tests are in test/flow-stale-fold.test.ts. They cover the 7-day edge, the order, approved pulls, the note's words, a pull with no issue, and an unreadable date.

Closes #6521

commented

I added staleFold(pulls, now) in src/flow/stale_fold.ts. It returns the pulls with no push for 7 days or more, oldest first, each with its fold-back note. The six new tests and bun x tsc --noEmit pass; I did not run the full check.

  • Input and output: each input pull is { number, issueNumber, branch, lastPushAt, approved }, with lastPushAt as an ISO string. Each result is the same pull plus days and note.
  • Stale test: exactly 7 days counts as stale, and just under does not. D in the note is the whole number of days, rounded down.
  • Order: oldest push first, with ties broken by pull number.
  • Left out: approved pulls. I also skip any pull whose lastPushAt isn't a readable date, which the issue didn't ask for.
  • Note: "Folded back: pull #N had no push for D days; its branch <branch> keeps the work." A pull with issueNumber: null is still listed, with note: null.
  • Not done: nothing calls it yet, so it isn't reachable from the feed or the MCP. It is read-only and closes nothing, since folding a pull back is a person's decision.

The tests are in test/flow-stale-fold.test.ts. They cover the 7-day edge, the order, approved pulls, the note's words, a pull with no issue, and an unreadable date.

Approved

Approved. This is the pure-read slice the issue scoped: small, one concept, no I/O, now is taken as a parameter (matches the src/flow clock rule), and the six tests cover the 7-day edge, ordering with ties, approved exclusion, the note wording, null issue and a bad date. Nothing reads or writes user input, so there is no security surface here, and the preview shows nothing new, as the pull says. Next two things: (1) wire it to a door, a feed card and a src/tty.ts command, with the README line, so it is reachable and not dead code; (2) have the caller pass real pull data and add a test that the note is posted only when a person confirms. Minor: the _at destructure in the final map could be avoided by sorting a precomputed array of pairs.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs