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

An app's page lists its forks as a plain list with each fork's owner and how long ago it last changed #13509

opened this

Merged 18d 14h ago, live in production

An app's page now has a Forks (N) card in its side rail. It lists up to ten forks, most recently changed first. Each row shows the owner, the fork's name and "changed 3d ago" (the newest push, else when the fork was made).

Notes

opened this

An app's page now has a Forks (N) card in its side rail. It lists up to ten forks, most recently changed first. Each row shows the owner, the fork's name and "changed 3d ago" (the newest push, else when the fork was made). It links to the fork, and an "All" link opens the full forks page.

  • Visibility: the list and the N both come from visibleForks, so a private fork the viewer can't read is neither listed nor counted. When the viewer sees no forks, the card is absent.
  • Code: the new module is src/web/studio/forks_card.ts, wired into the rail in src/web/studio/app.ts.
  • Tests: test/app-forks-card.test.ts covers:
    • newest-first ordering;
    • a private fork hidden from anonymous and other users, with its owner still seeing it;
    • the cap of ten while the count stays whole.
  • Checks: that file, the fork-count and forks suites, feature-orphans and guide pass. tsc, bun scripts/gate.ts and design-lint are clean. I did not run scripts/fast.ts's selection: it named 1873 files, too broad to run here.

Left out

  • Page-level test: the tests cover the read, not the rendered card on the app page. I did not boot the app and open the page.
  • Time wording: it uses the existing timeAgo, so it reads "3d ago", not "3 d ago".
  • Terminal and MCP: I added no terminal or MCP door, since the Forks screen and MCP forks already list the same forks to the same viewers. The commit says so with a No door: line.
  • Docs: I added a short section to the existing docs/features/fork-tree.md, not a new feature page.

Try: open the page of an app that has public forks and read the Forks (N) card in the side rail. Then sign in as the owner of a private fork and see it counted for them alone.

Closes #13459

3 earlier comments
commented

An app's page now has a Forks (N) card in its side rail. It lists up to ten forks, most recently changed first. Each row shows the owner, the fork's name and "changed 3d ago" (the newest push, else when the fork was made). It links to the fork, and an "All" link opens the full forks page.

  • Visibility: the list and the N both come from visibleForks, so a private fork the viewer can't read is neither listed nor counted. When the viewer sees no forks, the card is absent.
  • Code: the new module is src/web/studio/forks_card.ts, wired into the rail in src/web/studio/app.ts.
  • Tests: test/app-forks-card.test.ts covers:
    • newest-first ordering;
    • a private fork hidden from anonymous and other users, with its owner still seeing it;
    • the cap of ten while the count stays whole.
  • Checks: that file, the fork-count and forks suites, feature-orphans and guide pass. tsc, bun scripts/gate.ts and design-lint are clean. I did not run scripts/fast.ts's selection: it named 1873 files, too broad to run here.

Left out

  • Page-level test: the tests cover the read, not the rendered card on the app page. I did not boot the app and open the page.
  • Time wording: it uses the existing timeAgo, so it reads "3d ago", not "3 d ago".
  • Terminal and MCP: I added no terminal or MCP door, since the Forks screen and MCP forks already list the same forks to the same viewers. The commit says so with a No door: line.
  • Docs: I added a short section to the existing docs/features/fork-tree.md, not a new feature page.

Try: open the page of an app that has public forks and read the Forks (N) card in the side rail. Then sign in as the owner of a private fork and see it counted for them alone.

commented

The app page's Forks card now has tests on the rendered card, and forksOfApp does its ordering and limit in SQL. test/app-forks-card.test.ts passes (5 tests), as do tsc, gate.ts --fix and design-lint; I did not run the full suite.

  • Tests: they call forksCard with a minimal context.
    • Heading and rows: Forks (2) has the right N, and there is one row per fork showing owner / name and the "changed" text.
    • Private fork: for a stranger and for no viewer, the private fork's owner never appears in the HTML. Its own owner sees it.
    • No visible forks: the card is null for an app with none.
  • Query: visibility still filters in JS, because it is a per-viewer rule (canRead). The ordering by last push (else creation) and the LIMIT 10 now run in one query over the visible ids, passed as a JSON array through json_each. The total is the count of visible forks.
  • Not covered: the forksCard(...) call in src/web/studio/app.ts:569 still has no test that fails without it. Rendering the whole app page needs a request, an auth and a repo wired together, so I tested the card directly, which the review allowed. Deleting that call would still leave the suite green.
commented

An app's page shows a "Forks (N)" card in its side rail. It lists up to ten forks, most recently changed first. Each row shows owner / name and how long ago the fork changed (its newest push, else when it was made). The card and the count only include forks the viewer may read, through visibleForks, so a private fork never shows up or adds to N. When the viewer can see no forks, there is no card. An "All" link goes to the forks page.

  • Card: src/web/studio/forks_card.ts, placed in the side rail at src/web/studio/app.ts:569. It reuses the existing listCard/row pieces, so it adds no new component.
  • Query: visibility is a per-viewer rule, so it filters first. One query then sorts and caps the visible forks at ten, with no sort in JS. The total is the number of visible forks.
  • Tests: test/app-forks-card.test.ts fetches /alice/lib from a served app and checks:
    • the Forks (2) heading;
    • one data-fork row per visible fork;
    • the private fork is missing for an anonymous viewer and for a stranger;
    • its owner sees Forks (3);
    • an app with no forks has no app-forks card.

    With the forksCard(ctx, repo) call removed from app.ts, the page test fails.

  • Test setup: an app that has never run hides its whole side rail. The test therefore inserts one merged pull straight into the database so the rail is drawn.
  • No door: this card adds no new door. The terminal's Forks screen (src/tui) and the MCP forks tool already list the same forks to the same viewers through visibleForks.
  • Left out: no change to the forks page itself, nothing new in the API or the terminal.

Checks run here: tsc --noEmit, gate.ts --fix and design-lint are clean. test/app-forks-card.test.ts, test/following-card.test.ts and six test/studio*.test.ts files pass (148 tests). The full suite was not run: scripts/fast.ts named 1,873 test files (about 159 minutes) for this diff, so the forge's check on push covers the rest.

Try it: open an app with public forks and look for the "Forks (N)" card in the side rail.

🤖 Generated with Claude Code

commented

An app's page now has a Forks (N) card in its side rail. It lists up to ten forks, the most recently changed first, each with its owner, its name and "changed 3d ago". Only forks the viewer may read are listed or counted, so the number never hints at a private fork. "All" opens the full forks page.

The card is built in src/web/studio/forks_card.ts and placed on the page in src/web/studio/app.ts. The query sorts and limits the forks. test/app-forks-card.test.ts checks the rendered card on the app page: the heading, the rows, that a private fork is absent, and that there is no card when an app has no forks.

This push merges main back in, which conflicted in docs/features/fork-tree.md. Both sides are kept: main's notes on the severed word, the mode phrases and the "Offers from forks" section, followed by this pull's "On the app page" section.

What I left out: the card does not show whether each fork follows its parent and does not paginate; the forks page already does both.

After the merge, the gate, bun x tsc --noEmit and bun scripts/design-lint.ts came back clean. The forks card, fork-tree mode, fork offers and studio test files all passed (244 tests, 0 failures).

To try it, open an app that has forks on the preview, https://lab--13509--forge-trevato-apps.open-platform.sh, and look at the side rail.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs