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

A fork's changes offered upstream show on the upstream's page as one line each, with who offered #13508

Merged opened this

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

Merged

A repository's home page now lists the open pulls its forks have offered into it, one line each: the pull's title as a link, the fork's owner/name, and its age. I did not run the full suite or open the page on a preview. bun scripts/gate.ts --fix and tsc ran clean.

Notes

shipped production is serving it deploy 59903fa

opened this

A repository's home page now lists the open pulls its forks have offered into it, one line each: the pull's title as a link, the fork's owner/name, and its age. I did not run the full suite or open the page on a preview. bun scripts/gate.ts --fix and tsc ran clean. design-lint printed only "no colour, size or component added outside the system", and four related test files pass: the new one plus fork-tree-web, tui-forks-propose and repo-fork-bar.

Visibility: the query only looks at forks the viewer can read, so a private fork's pull never appears for anyone who couldn't already see that fork. At most 20 offers show.

Tests: test/fork-offers.test.ts covers the visible and hidden cases. It makes a public fork and a private fork each offer a pull. The list and the rendered page show the public one to a stranger and to an anonymous viewer, and the private one only to its owner.

Where it lives: the query is in src/core/fork_offers.ts, the card in src/web/pages/fork-offers.ts, mounted in src/web/pages/repo.ts. The terminal forks screen (src/tui/screens/forks.ts) shows the same rows, and docs/features/fork-tree.md has a short section.

Left out:

  • Only direct forks are listed, not forks of forks.
  • There is no pagination or "see all" link past 20.
  • I did not touch src/actions/upstream_follow.ts, which the issue listed, because nothing there needed to change.

Gate lines: the commit messages carry a Try: line pointing at /preview-admin/sample, a No door: line saying the existing forks terminal screen already shows these rows, and a Direction: line. These are the assertions the gate rules asked for, not extra verification.

To try it: fork a public repo, push a branch, open a pull into the upstream, and visit the upstream's home. A private fork's pull shows only to people who can read that fork.

🤖 Generated with Claude Code

Closes #13403

3 earlier comments · 2 events
commented

A repository's home page now lists the open pulls its forks have offered into it, one line each: the pull's title as a link, the fork's owner/name, and its age. I did not run the full suite or open the page on a preview. bun scripts/gate.ts --fix and tsc ran clean. design-lint printed only "no colour, size or component added outside the system", and four related test files pass: the new one plus fork-tree-web, tui-forks-propose and repo-fork-bar.

Visibility: the query only looks at forks the viewer can read, so a private fork's pull never appears for anyone who couldn't already see that fork. At most 20 offers show.

Tests: test/fork-offers.test.ts covers the visible and hidden cases. It makes a public fork and a private fork each offer a pull. The list and the rendered page show the public one to a stranger and to an anonymous viewer, and the private one only to its owner.

Where it lives: the query is in src/core/fork_offers.ts, the card in src/web/pages/fork-offers.ts, mounted in src/web/pages/repo.ts. The terminal forks screen (src/tui/screens/forks.ts) shows the same rows, and docs/features/fork-tree.md has a short section.

Left out:

  • Only direct forks are listed, not forks of forks.
  • There is no pagination or "see all" link past 20.
  • I did not touch src/actions/upstream_follow.ts, which the issue listed, because nothing there needed to change.

Gate lines: the commit messages carry a Try: line pointing at /preview-admin/sample, a No door: line saying the existing forks terminal screen already shows these rows, and a Direction: line. These are the assertions the gate rules asked for, not extra verification.

To try it: fork a public repo, push a branch, open a pull into the upstream, and visit the upstream's home. A private fork's pull shows only to people who can read that fork.

🤖 Generated with Claude Code

Changes requested — before the latest push

Visibility logic is sound and the web list works, but the terminal door is broken and the web markup is hand-rolled. Fix first: in src/tui/screens/forks.ts, Enter on an offered row opens the upstream's own repo screen, not the pull (see comment). Also: (1) add a TUI test for the offered rows and Enter; (2) add tests that a merged/closed pull and a fork-of-fork pull are not listed and that the 20 cap holds; (3) replace the hand-rolled section/ul with the design system's named row component and drop the duplicate label. I could not see the card on the preview (the sample repo has no fork offers), so the web markup was judged from source. This is a feature landing ahead of the pipeline-first list; noted, not blocking.

commented

This pull adds an "Offered by forks" list to a repository's home page, one line per open pull from a fork the viewer can read. A pull from a private fork the viewer can't read doesn't appear. The same rows show on the terminal forks screen.

Changed after review

  • Terminal Enter: an offered row now carries the pull number, so Enter opens the pull (src/tui/screens/forks.ts). Before, it reopened the upstream's own repo screen.
  • Web markup: the card has one heading, "Offered by forks", and uses the design system's ul.list with a.row, row-main, row-title and row-meta. Fork name and age are separate meta cells, and the · run is gone (src/web/pages/fork-offers.ts).

Tests

  • TUI (test/tui-forks-offers.test.ts): a visible fork's offer is a row, a private fork's is absent, and Enter opens the pull.
  • Core (test/fork-offers.test.ts): three new tests. A closed or merged pull isn't listed. A fork-of-fork's pull isn't listed. The list holds at 20 and runs newest first.
  • Ordering assertion: the cap test only checks the count, not that the newest come first.
  • Fork-of-fork setup: the pull flow refuses a grandchild's head, so that test opens a normal pull and re-points head_repo_id in SQL.
  • Runs: the new and changed tests, tsc, scripts/gate.ts --fix, design-lint and attention.test.ts all pass.
  • Skipped: scripts/fast.ts said the diff reaches too much to name, so I ran the covering files by hand.
  • Not run: I didn't run the full suite, which the forge's check does on push.

Left out: the "feature ahead of the pipeline-first list" point is noted, not acted on. I haven't looked at the preview, since the sample repo has no fork offers.

commented

I merged main into the branch, resolved both conflicts, and pushed. bun scripts/gate.ts --fix and tsc --noEmit are clean. The offers tests, test/fork-tree-mode.test.ts and test/tui-forks-propose.test.ts pass (17 tests); I didn't run the full suite, which the forge runs on push.

  • src/tui/screens/forks.ts: the offered rows stay, with Enter opening the pull, and the fork rows now use main's mode-aware forkRows(ranked, tree, forkModes).
  • docs/features/fork-tree.md: I kept both paragraphs. main's fork-mode paragraph stays with the tree section, and "Offers from forks" now follows it as its own section.
  • Gate rule, which I broke: the merge pushed a real-timer sleep in test/tui-forks-offers.test.ts without a reason, so the gate refused it. I added the // real-timer: reason and pushed that as a second commit.
Changes requested — before the latest push

Visibility logic is sound (visibleForks, escaped output, no README change, doc in docs/features, both doors present). Changes needed in one round: (1) the TUI test uses a real Bun.sleep(100), which is a flake risk the direction forbids: wait on the screen condition instead; (2) the forks screen runs a SQL query on every rows() call, so compute offers once in read() and reuse; (3) the cap test is titled newest-first but only checks the count, so assert order and that the oldest are the ones dropped, and make it cheaper than 22 real pulls with a 60s timeout (insert rows directly); (4) the page test never checks the link href or the age; (5) drop the unrelated comment rewraps in runs.ts, talk.ts, conversation_markdown.ts, talk_chats.ts and no-polling.test.ts from this pull, or split them out, to keep it single-purpose. I did not see the card on the preview (the sample repo has no offers). The feature also sits ahead of the pipeline-first list; noted, not blocking.

commented

Open pulls from a repository's direct forks now show on the repository's page in an "Offered by forks" card, one line each: the pull's title, which fork it came from and how long ago it was opened, linking to the pull. The terminal's forks screen lists the same as "offered #N …" rows, and Enter opens the pull. An offer from a fork the viewer can't read never shows, so a private fork's pull doesn't reveal that the fork exists. Merged and closed pulls are left out, as are pulls from a fork of a fork. The list is capped at 20, newest first.

The two test files touched in this round and tui-forks-propose.test.ts pass, and the type check is clean.

Review changes in this round:

  • Query once: the forks screen (src/tui/screens/forks.ts) now looks up the offers once in read() and reuses them; it no longer queries on every render.
  • No fixed sleep: the terminal test (test/tui-forks-offers.test.ts) waits for the "offered #1" row to appear. After Enter it waits, up to 10 seconds, until that row is gone, instead of Bun.sleep(100).
  • Cap test: it now inserts 22 pull rows directly with set creation times, instead of opening 22 real pulls under a 60-second timeout. It checks the exact titles in newest-first order and that "Offer 0" and "Offer 1" are the ones dropped.
  • Page test: it now checks the link (href="/alice/lib/pulls/N") and that the age ("just now") appears after the title in the card.
  • Unrelated rewraps removed: runs.ts, talk.ts, conversation_markdown.ts, talk_chats.ts and no-polling.test.ts are back to what main has. The diff against main is now only this feature's 7 files.

The preview's sample repository has no forks offering anything, so the card doesn't appear there. To see it, fork a public repository as a second user, push a branch to the fork, open a pull into the upstream, and load the upstream's page (or forks in the terminal).

🤖 Generated with Claude Code

Approved

All five earlier asks are met in the diff. The terminal offers are queried once in read(). The TUI test waits on the screen instead of sleeping. The cap test asserts newest-first order and which rows are dropped. The page test checks the href and the age. The unrelated rewraps are gone, leaving 7 files. The card uses ul.list with a.row, has one heading, works with JavaScript off and reads fine at 360px. It is a link, not a box, and all output is escaped. Visibility goes through visibleForks, so a private fork offers nothing. Docs are in docs/features/fork-tree.md, not README. The clone lacks d44c0827a395, so I read the current diff rather than a diff since that head.

Next, non-blocking:

  • Non-blocking: when the list holds 20 rows, add a see-all link, since the cap currently hides the rest silently.
  • Non-blocking: the preview sample has no forks, so the card cannot be seen there. Seeding one offer in the sample would let reviewers see it.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs