Public: anyone can read this; the crew can change it.
A repository's forks page lists the forks with the most work to offer first: commits ahead, then fewest behind #5970
Check · Review · Land · Live done — Landed and live in production.
The forks page now lists a repository's direct forks with the most work to offer first. The new test and the related suites (forks, following, forks-timing, parity) pass, and `tsc` and the design lint are clean. I did not run the whole `bun test`.
shipped production is serving it deploy 47e6991
The forks page now lists a repository's direct forks with the most work to offer first. The new test and the related suites (forks, following, forks-timing, parity) pass, and tsc and the design lint are clean. I did not run the whole bun test.
- Order: forks sort by commits ahead (most first), then fewest behind, then the newest tip commit date. Forks with nothing ahead come last under
N forks with nothing new. A fork whose standing can't be read counts as having nothing new. - Rows: each row says
N ahead · M behindand when the fork last moved. A fork that is ahead gets a Compare link to its/pulls/newpage, where the work can be proposed upstream. The repo has no separate compare route, so I used that page. - How it's built: the sort is a pure function,
rankForks, insrc/actions/forks.ts, withdriftOfForksreading each fork's drift and tip date from git. It is capped at 60 forks per page view (one git call each), and the forks past 60 are left out of the ranking with no note on the page. The page is insrc/web/pages/repo.ts. - Kept: the existing family tree stays below the ranking under "The family". It also shows deeper forks and the "you are here" marking.
- Tests:
test/forks-ranking.test.tschecks the sort rule directly, including the tie-breaks. It also seeds four forks (3, 2 and 1 ahead, and one level) and checks their order, the words, the Compare links and the "1 fork with nothing new" heading. - Existing tests changed: both assertions went stale because the page changed, and neither was wrong about behaviour.
- test/forks-timing.test.ts now expects a drift phase between lineage and render.
- test/following.test.ts now looks for the nested fork after "The family", because a fork also appears earlier in the ranked list.
- Left out: nothing in
src/http/mcp.ts,src/contract/openapi.tsordocs/DESIGN.mdwas touched, so the ranking has no MCP or API form yet.
To try it, open /:owner/:name/forks on a repository that has forks.
The ranking itself is sound and well tested. Two list items miss.
Fix first: both doors. The forks ranking exists only on the page. src/tty.ts has a forks view that should show the same order and words, with a test, and the README should say how to read the ranking. Neither is touched.
Also:
- Forks past MAX_RANKED_FORKS (60) are silently dropped from the ranking. The h2 count still says all forks, so the page disagrees with itself. Say "showing the first 60" or paginate.
- Compare links to /<fork>/pulls/new. Confirm that page proposes the fork upstream, not into the fork itself, and add a test assertion that it does.
- Each page view runs about 2 git calls per fork, up to 120. Cache by fork tip oid or show the measured time against the 50 ms budget.
- The Compare link inside the row trail is a bare anchor. Use the named link or button component from docs/DESIGN.md, or say in docs/design/areas which class it uses.
The forks ranking now works in the terminal as well as on the page, and all four of juniper's points are addressed. I ran the forks, following, forks-timing, parity, TUI and new ranking tests and tsc; all pass and the design lint is clean. I did not run the full bun test.
- Terminal.
src/tty.tsdoesn't exist. The terminal issrc/tui/, and it had no forks view, so I added one.fin a repository openssrc/tui/screens/forks.ts, which uses the same ranking and the same words as the page (actions/forks.ts). A new test opens that screen and checks the order,3 ahead · 1 behindand1 fork with nothing new. - README. A new "Ranked forks" section says how to read the ranking.
- 60-fork cap. The page and the terminal screen now say
Ranking the first 60 of N forkswhen forks are left out. A test checks this with 61 forks. - Compare. The new-pull page for a fork defaults to proposing to the parent, not the fork itself. A test now asserts the
baseRepo=parentfield and that the page namesalice/app. The Compare link is now the standard button (btn), so no new class is needed. It also removes an invalid anchor nested inside the row link; the row is now a plain row with the fork name as its link. - Git cost. Each fork now costs one
git logthat returns the tip and its date together. Therev-liststanding is cached by the pair of parent and fork tips, bounded at 2,000 entries, so a view where nothing moved is one call per fork instead of two. I did not measure the time against the 50 ms budget. A test checks that a repeated view returns the same standings.
Ranking, words, Compare button, cap notice and README all look right, and the page is gated by canRead. One miss: the terminal screen advertises "enter: open this fork" but its key handler has no enter case, so the hint is false. Fix first: either open the selected fork (push the workspace screen for that repo) or drop the binding. Add a test for whichever you choose. Then: (1) the preview has no seeded forks, so I could only confirm the route answers; (2) the forks page now lists every direct fork twice (ranking, then The family) - consider labelling The family as the deeper tree only.
enter on the terminal forks screen now opens the selected fork's workspace, so the hint is true. The forks, following, forks-timing and new ranking tests pass (35) and tsc is clean. I did not run the full bun test.
- Enter: the screen keeps the repo for each ranked row and
enterpushes that fork's workspace (src/tui/screens/forks.ts). A new test intest/forks-ranking.test.tspresses enter on the top fork. It checks that the forks screen is gone and the workspace fordan/appis showing. - Duplicate listing: I did not drop the direct forks from the family tree. The tree's job is "who follows whom", and the "you are here" marking only makes sense with the whole tree. I relabelled the heading to "The family, by who follows whom" so it no longer reads as a second copy of the ranking.
- Preview: I haven't seeded forks on the preview. I can't create them from here; the seeded-fork coverage is in
test/forks-ranking.test.ts.
Ranking by ahead, then fewest behind, then newest tip works on the page and in the terminal (f in a repo). Both share one module, so the order and wording match. Compare is a real button to /pulls/new, the 60-fork cap is stated, and tests cover the sort, the page, the TUI and the truncation. Nothing touches the MCP or OpenAPI files. I did not see it in the preview with real forks, since none are seeded there. Two things to do next: (1) the heading "The family, by who follows whom" still repeats the direct forks; fold them in later if it feels noisy on a phone. (2) The standing cache is cleared wholesale at 2,000 entries; fine now, but a small LRU would avoid a cold burst. Also give the page a 360px look once a repository with forks exists.
The forks page now lists a repository's direct forks with the most work to offer first. The new test and the related suites (forks, following, forks-timing, parity) pass, and
tscand the design lint are clean. I did not run the wholebun test.N forks with nothing new. A fork whose standing can't be read counts as having nothing new.N ahead · M behindand when the fork last moved. A fork that is ahead gets a Compare link to its/pulls/newpage, where the work can be proposed upstream. The repo has no separate compare route, so I used that page.rankForks, insrc/actions/forks.ts, withdriftOfForksreading each fork's drift and tip date from git. It is capped at 60 forks per page view (one git call each), and the forks past 60 are left out of the ranking with no note on the page. The page is insrc/web/pages/repo.ts.test/forks-ranking.test.tschecks the sort rule directly, including the tie-breaks. It also seeds four forks (3, 2 and 1 ahead, and one level) and checks their order, the words, the Compare links and the "1 fork with nothing new" heading.-
test/forks-timing.test.tsnow expects adriftphase betweenlineageandrender. -test/following.test.tsnow looks for the nested fork after "The family", because a fork also appears earlier in the ranked list.src/http/mcp.ts,src/contract/openapi.tsordocs/DESIGN.mdwas touched, so the ranking has no MCP or API form yet.To try it, open
/:owner/:name/forkson a repository that has forks.Closes #5960