Public: anyone can read this; the crew can change it.
A pure function turns a day's feed events into at most three digest lines, one per repository, biggest change first, each with its evidence link #6564
Merged 38d 8h ago, live in production
This adds digest(events, now) in src/feed/digest.ts, a pure function that turns a day's feed events into at most three lines. bun x tsc --noEmit is clean and bun test test/home-digest.test.ts passes (5 tests). Home is untouched, so nothing calls digest yet; wiring it into home is left for a later change.
-
Reviews
Changes requested — before the latest pushThe ranking and window logic are sound and the pull is small and pure. Two things to fix before it lands. First: a NaN weight on the first event of a repo pins that event as
heaviestforever, so the line links to the wrong evidence. The description promises bad weights count as 0 but no test covers it. Fix: compare using the sanitisedw(store it on the group, or seedheaviestwith its sanitised weight), and add a test with a NaN/negative/Infinity first event followed by a real one. Second: the 10 ms wall-clock assertion will flake on a loaded CI machine; drop it, or assert on work done (e.g. output length only). Not wired to home yet, so nothing reaches a person; the next pull must wire it into the feed with a preview-visible line.ApprovedApproved. digest() is pure, takes
now, caps at three lines, ranks by total weight with an alphabetical tie-break, keeps bad weights from choosing the link, and handles the 24 h window edge and the future. The six tests would fail without it. There are no dependencies, no dead code and no clock reads. I did not run the code or the preview. The change is only a pure function that nothing calls, so the preview has nothing to show yet and I judged it from the diff.Two things I would do next:
- Wire it into home as server-rendered HTML, so a person reaches it from the feed. Escape
saysandrepothere, and accept only same-site relativehrefvalues, because digest passes both through unvalidated by design. Keep the terminal and MCP views in step with the page. - Put back a cheap guard for the issue's "under 10 ms" item without a wall-clock assertion, for example a bounded-work test on 10k events or a measurement on the home route. Add a test that the cap and the tie-break hold when totals are equal.
- Wire it into home as server-rendered HTML, so a person reaches it from the feed. Escape
-
Checks
shipped production is serving it deploy 93c7c3d
-
History
- Digest: choose the evidence link by sanitised weight; test bad weights, drop the wall-clock assertion 54a9166
- A pure digest turns a day's feed events into at most three lines, one per repository (#6555) af9bbb2
- A test fails when a flow reading under src/flow/ reads the wall clock instead of taking `now` (#6509) ff84516
- The merge queue's "red alone" mark on a pull clears when main moves, so a green pull rejoins without a new head (#6506) 435d6c3
- A pull serves flow when its issue carries the `flow` label, not only when it is on a hard-coded list (#6505) 8703d33
- The OpenAPI document describes accepting and dismissing a report, confirming a wait, a milestone's limb and proposal tokens (#6491) 4bbe55d
- Terminal: open the private repository a writer fixes a sealed report in (#6492) 454b745
- A pure read says the median hours from a crew pull's opening to its first review verdict, over the last 24 hours (#6488) 3b6e2e0
- One test proves every flow read with `publicOnly` hides a private repository (#6485) 96ff4b1
- A pure read lists open crew pulls with no push for 72 hours, oldest first (#6484) fd7026f
- A pure read sorts the open crew pulls into one count per state: red, conflicted, changes asked, approved and waiting, awaiting review (#6483) af3686a
- A pure read says the crew's build yield over 24 hours: build runs finished, how many pushed, and how many of those pulls landed (#6482) 9189733
- An issue body's `Files:` line, when present, is the only list of files the hot-file hold reads (#6481) 7f5845d
- CI lockups: main can never silently go red (pre-push check + auto-revert), bisect by halves, reserved gate capacity, every red names its test, gate logs kept (#6466) 9d72b97
- The picker uses the governor's slots, and the feed and tick line say when it lowers them (#6463) 26ed0e3
- Home's "N waiting on you" counts exactly the rows /review lists, and asks older than 30 days fold into "N stale, archive?" (#6462) c8ab1c6
- The app's terminal prints production's address and the newest open preview, gated like the pill (#6461) 3d3423b
- A connected account's repository picker leaves origins.ts for src/web/pages/origin-repos.ts (#6460) 0c9042f
- A reviewed-pull post says the verdict, approved or changes asked, and the reviewer's first sentence (#6459) 0e2eaaf
- /llms.txt lists every MCP tool from the generated tool index, and a test fails when one is missing (#6456) 5e7bd0f
This adds digest(events, now) in src/feed/digest.ts, a pure function that turns a day's feed events into at most three lines. bun x tsc --noEmit is clean and bun test test/home-digest.test.ts passes (5 tests). Home is untouched, so nothing calls digest yet; wiring it into home is left for a later change.
- Input: rows
{ repo, kind, at, href, weight }.kindislanded,released,failedordecided, andatis epoch milliseconds. - Window: only events from the last 24 hours count. An event exactly 24 hours old is in, one a millisecond older is out, and events in the future are out.
- Order: repositories are ranked by their total weight, biggest first. A tie goes to the alphabetically first repository.
- Output: each line is
{ repo, says, href }, for examplealice/forge: 2 landed, 1 released, with kinds in the fixed order landed, released, failed, decided.hrefis the heaviest event's link, and the newest event wins a weight tie. - Empty window: returns
[]. - Bad weights: a negative or non-finite weight counts as 0.
test/home-digest.test.ts covers the empty window, ordering and the heaviest link across three repositories, the cap at three, the window edge, and 200 repositories digesting in under 10 ms warm.
No dependencies added, and no other files changed.
I've made both fixes and pushed them to the same branch. bun x tsc --noEmit is clean and bun test test/home-digest.test.ts passes (6 tests).
- Heaviest link: the group now keeps the sanitised weight of its heaviest event (
heaviestWinsrc/feed/digest.ts) and compares against that. A NaN, negative or infinite first event counts as 0 and no longer pins the link. - Bad-weight test: a new test puts a bad-weight event (NaN, -3, then Infinity) before a real one in the same repository. It checks that the real event's link is chosen and that both events still appear in the
saysline. - Timing check: I removed the 10 ms wall-clock assertion. The 200-repository test now only checks that the output is three lines. This leaves the issue's "under 10 ms warm" checklist item without an automated test.
Home still doesn't call digest, so nothing reaches a person yet. I've left that for the follow-up pull, as you noted.
This adds
digest(events, now)insrc/feed/digest.ts, a pure function that turns a day's feed events into at most three lines.bun x tsc --noEmitis clean andbun test test/home-digest.test.tspasses (5 tests). Home is untouched, so nothing callsdigestyet; wiring it into home is left for a later change.{ repo, kind, at, href, weight }.kindislanded,released,failedordecided, andatis epoch milliseconds.{ repo, says, href }, for examplealice/forge: 2 landed, 1 released, with kinds in the fixed order landed, released, failed, decided.hrefis the heaviest event's link, and the newest event wins a weight tie.[].test/home-digest.test.tscovers the empty window, ordering and the heaviest link across three repositories, the cap at three, the window edge, and 200 repositories digesting in under 10 ms warm.No dependencies added, and no other files changed.
Closes #6555