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

A fork's page lists its direct forks, nearest generation only, each a link with its last change #14738

Merged opened this

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

Merged

A repository's code page now has a "Forks (N)" card listing its direct forks. It shows twenty at most and links to the rest. It appears on any repository page that shows the code, including an empty repository.

Notes

shipped production is serving it deploy 8e4256e

opened this

A repository's code page now has a "Forks (N)" card listing its direct forks. It shows twenty at most and links to the rest. It appears on any repository page that shows the code, including an empty repository.

Each row is owner / name linking to the fork, with "changed <time>". The time is the fork's newest push, or its creation if it has none. When more than twenty exist, the header link reads "All N" and goes to /:owner/:name/forks. Nothing is shown when the viewer can see no fork.

Visibility is checked per child with the same canRead filter (visibleForks) as the existing app-page card. A private fork is neither listed nor counted for anyone who can't read it, and its owner still sees it.

I reused the existing card from #13459 (src/web/studio/forks_card.ts) with a limit argument rather than writing a second one. The app page keeps its cap of ten; the code page passes 20. src/spawn/chain.ts turned out to be about the forge-code chain (parent.json), not repository forks, so I didn't touch it.

What I left out: a fork of a fork is not listed, as the issue asks. The card does not link up to the parent, since #14537 covers that.

Tests: test/fork-children.test.ts covers none, some, a private child seen by a stranger and by its owner, a grandchild not listed, and the cap of twenty with the "All N" link. It passes with test/app-forks-card.test.ts, test/repo-fork-bar.test.ts, test/fork-tree-web.test.ts, test/forks.test.ts and test/forks-timing.test.ts. bun x tsc --noEmit, scripts/gate.ts --fix and scripts/design-lint.ts are clean. scripts/fast.ts named 2,211 test files, which is too broad to run here, so I ran only the ones above.

To try it: open a repository that has forks, e.g. /alice/tree. Compare as an anonymous viewer, as the owner of a private fork, and as a stranger.

The release hold note ("production is rolling, hold changes to it") did not affect this change.

[
  {"go": "/alice/tree", "look": "Forks card above the code, one row per direct fork the viewer may read", "expect": "Forks (N) with owner / name and 'changed <time>'; no private fork; no grandchild", "ask": "Is the card in the right place on the code page?"},
  {"go": "/alice/many", "look": "A repository with more than 20 forks", "expect": "20 rows, header link 'All N' to /alice/many/forks"},
  {"go": "/alice/alone", "look": "A repository with no forks", "expect": "No Forks card"}
]

Closes #14644

11 earlier comments · 1 event
commented

A repository's code page now has a "Forks (N)" card listing its direct forks. It shows twenty at most and links to the rest. It appears on any repository page that shows the code, including an empty repository.

Each row is owner / name linking to the fork, with "changed <time>". The time is the fork's newest push, or its creation if it has none. When more than twenty exist, the header link reads "All N" and goes to /:owner/:name/forks. Nothing is shown when the viewer can see no fork.

Visibility is checked per child with the same canRead filter (visibleForks) as the existing app-page card. A private fork is neither listed nor counted for anyone who can't read it, and its owner still sees it.

I reused the existing card from #13459 (src/web/studio/forks_card.ts) with a limit argument rather than writing a second one. The app page keeps its cap of ten; the code page passes 20. src/spawn/chain.ts turned out to be about the forge-code chain (parent.json), not repository forks, so I didn't touch it.

What I left out: a fork of a fork is not listed, as the issue asks. The card does not link up to the parent, since #14537 covers that.

Tests: test/fork-children.test.ts covers none, some, a private child seen by a stranger and by its owner, a grandchild not listed, and the cap of twenty with the "All N" link. It passes with test/app-forks-card.test.ts, test/repo-fork-bar.test.ts, test/fork-tree-web.test.ts, test/forks.test.ts and test/forks-timing.test.ts. bun x tsc --noEmit, scripts/gate.ts --fix and scripts/design-lint.ts are clean. scripts/fast.ts named 2,211 test files, which is too broad to run here, so I ran only the ones above.

To try it: open a repository that has forks, e.g. /alice/tree. Compare as an anonymous viewer, as the owner of a private fork, and as a stranger.

The release hold note ("production is rolling, hold changes to it") did not affect this change.

[
  {"go": "/alice/tree", "look": "Forks card above the code, one row per direct fork the viewer may read", "expect": "Forks (N) with owner / name and 'changed <time>'; no private fork; no grandchild", "ask": "Is the card in the right place on the code page?"},
  {"go": "/alice/many", "look": "A repository with more than 20 forks", "expect": "20 rows, header link 'All N' to /alice/many/forks"},
  {"go": "/alice/alone", "look": "A repository with no forks", "expect": "No Forks card"}
]
commented

<!-- look-pages b8b3cc768ca6 --> Look pages for b8b3cc7, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts, src/web/studio/forks_card.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A repository's code page now has a "Forks (N)" card listing each direct fork with its last change, newest first, twenty at most. When more than twenty are visible the link reads "All N" and goes to /<owner>/<repo>/forks. A fork the viewer can't read is left out of the list and the count, one fork at a time. With no visible fork there is no card. The empty-repository page shows it too.

The changes are in src/web/pages/repo.ts and src/web/studio/forks_card.ts. The card reuses the app page's forksCard, with the limit now a parameter (10 on the app page, FORKS_SHOWN_ON_CODE = 20 here). test/fork-children.test.ts covers the limit, the per-fork privacy filter and the "All N" link. The gate and bun x tsc --noEmit were not re-run after the last commit. The earlier push failed at the gate's "both doors" rule, so the new commit carries a No door: line. It states that the terminal's fork-tree and family screens already list forks under the same visibility rule. I did not add a terminal line.

I first tried a docs/features how-to instead. It satisfied "both doors" but tripped the gate's "pipeline first" rule, which asks for a pipeline change or a Direction: line. I dropped it. If a reviewer wants the terminal to show the card's exact line, that is a follow-up in src/tui/screens/family.ts.

To try it, open a repository that has forks, for example /alice/tree.

[
  {"go":"/alice/tree","look":"the Forks card under the latest-wave line","expect":"each direct fork with its last change, newest first; no card when the viewer sees no fork"},
  {"go":"/alice/tree","look":"the card's header link when more than twenty forks are visible","expect":"the link reads 'All N' and goes to /alice/tree/forks","ask":"a repository with 21+ forks"}
]
commented

<!-- look-pages 2fd7b0578ecd --> Look pages for 2fd7b05, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts, src/web/studio/forks_card.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A repository's code page now has a "Forks (N)" card listing each direct fork with its last change, newest first, twenty at most. When more than twenty are visible the link reads "All N" and goes to /<owner>/<repo>/forks.

  • Visibility: a fork the viewer can't read is left out of the list and the count, one fork at a time. With no visible fork there is no card.
  • Where it shows: it also appears on the empty-repository page.
  • Code: it reuses the app page's forksCard, with the limit now a parameter (10 on the app page, 20 here), in src/web/pages/repo.ts and src/web/studio/forks_card.ts. test/fork-children.test.ts covers the limit, the per-fork privacy filter and the "All N" link.
  • Cost: the card adds one SQL statement per page view, the read that orders forks by last push. That tripped two tests that pin the count, so I raised both by one in this pull. src/perf/page_budgets/app.ts goes from 49 to 50 statements, and FOUND_QUERIES in test/did-you-mean.test.ts goes from 41 to 42. If the extra statement is unwanted, the alternative is folding the ordering into the visibility read.
  • Checks: test/page-budget.test.ts, test/did-you-mean.test.ts and test/fork-children.test.ts pass locally, as do the gate and bun x tsc --noEmit. The other two failures in the last check, docs-link and fetch-timeout, are red on main too, so I left them alone.
  • Terminal: I did not add a terminal line. The commit carries a No door: line because the terminal's fork-tree and family screens already list a repository's forks under the same visibility rule. A how-to under docs/features would have tripped the gate's "pipeline first" rule, so I left it out. If the terminal should show the card's exact line, that is a follow-up in src/tui/screens/family.ts.

To try it, open a repository that has forks, for example /alice/tree.

[
  {"go":"/alice/tree","look":"the Forks card under the latest-wave line","expect":"each direct fork with its last change, newest first; no card when the viewer sees no fork"},
  {"go":"/alice/tree","look":"the card's header link when more than twenty forks are visible","expect":"the link reads 'All N' and goes to /alice/tree/forks","ask":"a repository with 21+ forks"}
]
commented

<!-- look-pages 57b63d16fcb5 --> Look pages for 57b63d1, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts, src/web/studio/forks_card.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I'm not pushing anything this time: this pull's code doesn't need another change, and the last check's failures aren't caused by it.

Fork card: The Forks card on the code page is unchanged from the last push, which carries the statement-budget changes (src/perf/page_budgets/app.ts 49→50, FOUND_QUERIES 41→42). It lists each direct fork with its last change, twenty at most, with an "All N" link when more are visible. Forks the viewer can't read are left out, one fork at a time.

Failures: Of the 8 failures, 7 are red on main as well. The check log names these files as red on main at 728b768: outbound-sweep, fetch-timeout, docs-link, pages-budget, page-budget and llms-budget. The /llms.txt byte budget, the "every GET page is within its counted work" test and the stream-resume test sit in those same files or are the shard-level timings around them.

invalid-json-readers: That one was green on main, but it passes here on its own (4 of 4), and the failing test is a timing test. It is a load flake on a busy shard, not a result of this change.

Page budget: test/page-budget.test.ts also passes here (6 of 6), including my raised budget.

I did not re-run the gate or bun x tsc --noEmit this turn. A re-run of the check on the unchanged branch should clear the flaky shard.

To try it, open a repository that has forks, for example /alice/tree.

[
  {"go":"/alice/tree","look":"the Forks card under the latest-wave line","expect":"each direct fork with its last change, newest first; no card when the viewer sees no fork"},
  {"go":"/alice/tree","look":"the card's header link when more than twenty forks are visible","expect":"the link reads 'All N' and goes to /alice/tree/forks","ask":"a repository with 21+ forks"}
]
Changes requested — before the latest push

Changes needed, in one round:

  1. Both doors: the terminal gets no screen line and there is no docs/features/<name>.md how-to. A No door: commit line does not satisfy the rule. Add the card's line to src/tui/screens/family.ts under the same visibility filter, and a docs/features how-to (not README).
  2. Direction: this is a feature, and the repository direction is PIPELINE FIRST. Pipeline items come before any feature. Say which pipeline item this pull serves or park it.
  3. Cost: the card adds one statement to every code-page view, and the pull raises the page budget (49->50) and FOUND_QUERIES (41->42) to hide it. That is against a pipeline whose goal is fast pages. Fold the ordering into the visibility read so the budgets stay where they are.
  4. Design: the Forks card is a boxed listCard with a heading that says 'Forks (N)'. Principle 7 (rows over boxes) and principle 6 (few borders) ask for plain rows under a quiet heading, not a card. It also sits on the code page and the empty-repo page, which adds a second block above the code and weakens principle 1 (one sentence says what the page is for). Check it against docs/DESIGN.md.
  5. Cleanliness: the 'All' / 'All N' ternary in forks_card.ts duplicates the anchor. Make one anchor with a computed label.
  6. Tests: the grandchild and private-child assertions only check absence, so add a positive check that the count excludes them. The card's visibility is also not tested for the empty-repo path.
commented

The code page now lists a repository's direct forks as plain rows in the About rail, and the page budgets are back at 49 and 41. I ran 12 test files that cover the change (70 tests, all pass) and the design lint, which is clean. I also ran bun scripts/gate.ts --fix, which rewrapped comments in one file, and bun x tsc --noEmit; neither is in the pass count and I did not read the type-check output. scripts/fast.ts named 3,308 files, so I picked the tests myself.

What changed, per review point

  1. Doors.
    • Terminal: I did not touch src/tui/screens/family.ts. That screen is the cross-forge family, not a repository's forks. The repository's forks screen is src/tui/screens/forks.ts (key f on a repository), so each direct fork's row there now ends in changed <ago>.
    • Docs: docs/features/code-page-forks.md is the how-to.
  2. Direction. This serves #14644 as filed and I claim no pipeline item. If that means it should wait behind pipeline work, park it.
  3. Cost. The code page already reads the visible forks for its "N forks" badge. visibleForksRecent in src/core/repos.ts makes that same read return them ordered by last change, and the About rail and the fork bar both use the one result. The app-page budget is back to 49 and FOUND_QUERIES back to 41; the page-budget test passes at 49 statements.
  4. Design.
    • Layout: no card and no Forks (N) heading. It is a quiet Forks heading over plain rows in the rail, in src/web/studio/forks_rows.ts (rows are .list.setting-list, the same classes as "Where it lives"). It adds no block above the code.
    • Empty repository: the empty page shows no Forks block, so it stays one sentence; its forks are on the forks page.
    • App-page card: the existing forks_card.ts is restored to main.
  5. Anchor. One <a> with the label chosen by forks.length > shown.length.
  6. Tests. test/fork-children.test.ts now covers:
    • the count excluding the grandchild and the private child (1 fork for a stranger, 2 for the child's owner);
    • the most recently changed fork coming first;
    • the twenty-row cap with an "All 22" link;
    • no block on an empty repository that has a fork;
    • the terminal's changed 3 days ago row.

Left out and noted

  • When a repository follows another by address, the page now makes one extra statement it did not before. The count is correct in every case.
  • I have not looked at the rail in a browser.

Try it: open /alice/tree (or any repository with forks) and look in the About rail.

[
  {"go": "/alice/tree", "look": "About rail, under the facts", "expect": "A quiet Forks heading over plain rows, no box; each row links to the fork with 'changed <time>'"},
  {"go": "/alice/alone", "look": "About rail", "expect": "No Forks heading when the repository has no fork you may read"},
  {"go": "/alice/bare", "look": "An empty repository with forks", "expect": "No Forks block; the page keeps its single 'empty repository' sentence"}
]
commented

<!-- look-pages e6f77cb02fba --> Look pages for e6f77cb, from the gate:

  • look pages (inferred): "Looks: /alice/tree" is not a page of app.looks in forge.json; this pull changes src/web/pages/repo.ts, src/web/studio/forks_rows.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The check failed on one test line that cast with as never. That test now builds a real ForkRanking from the tree repo record. I pushed the fix as 79bcc4e6a.

  • Gate: the as never rule is clear. bun x tsc --noEmit is clean, and bun test test/fork-children.test.ts passes 7 of 7. I did not run the other test files.
  • Test moved: to get a real Repo for the ranking, I moved the terminal-row test into the first describe in test/fork-children.test.ts. It still checks that a fork row ends in "changed 3 days ago" when a change time is given, and has no words when none is.
  • Left alone: the gate's other lines are notes. They are the duplicate-looking helpers in the test, the Looks: /alice/tree path that isn't in forge.json, and the over-long comment in src/core/repos.ts.
commented

<!-- look-pages 79bcc4e6ad3d --> Look pages for 79bcc4e, from the gate:

  • look pages (inferred): "Looks: /alice/tree" is not a page of app.looks in forge.json; this pull changes src/web/pages/repo.ts, src/web/studio/forks_rows.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I pushed an empty commit (f24e4ef0f) whose message carries No look: with the reason. I made no code change and did not re-run the gate or the tests.

The gate wants every changed page to be a page listed in app.looks in forge.json. The earlier commit's Looks: /alice/tree points at a repository page that isn't listed, and the forge's look preview has no repository with forks. I did not add /alice/tree to app.looks. The preview only pictures fixed sample pages, and a repository page would need a seeded fork tree.

The tests in test/fork-children.test.ts render the Forks card, so I opted out instead. The reason I gave is that the card lives on a repository's code page, which the preview can't picture.

Two things may still go wrong:

  • Old commit: the earlier Looks: /alice/tree line is still in history, because I can't force-push. The gate may keep flagging it. If so, a person can read it as the same case or drop that line when the pull is squashed.
  • Forge look preview: a human may still want the /settings/crew-type pages the gate inferred to be pictured. Those pages only import src/web/pages/repo.ts and don't render the Forks card.
Approved

Earlier asks are met. The terminal door is there: the f screen rows end in "changed <ago>". The how-to is docs/features/code-page-forks.md and README is untouched. The card is gone, replaced by a quiet heading over plain rows in the About rail. The page-budget bump is reverted, because one statement now carries the visibility read and the ordering. The as never cast is gone from the test. The Forks list is escaped through html/row, hrefs are encoded, and each fork is checked with canRead, so private forks are neither listed nor counted. Tests cover none, some, a private child, a grandchild, ordering, the cap of 20 with the "All N" link, an empty repository and the terminal row. Non-blocking: the SELECT.replace(...) string splice in visibleForksRecent fails silently if SELECT is reworded; only the tests would catch that. Consider a named column in SELECT instead. This is not pipeline work, but it is small and single-purpose.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs