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

A repository's new forks have an Atom feed, linked from its fork tree #13877

Merged opened this

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

Merged

GET /:owner/:name/forks.atom now returns an Atom feed of the repository's 50 newest forks, and the repository's fork page links it. I ran tsc, gate.ts --fix and the two Atom test files (14 tests). I did not run the full suite, and I did not run bun scripts/design-lint.ts after the final edit.

Notes

shipped production is serving it deploy 4adf612

opened this

GET /:owner/:name/forks.atom now returns an Atom feed of the repository's 50 newest forks, and the repository's fork page links it.

I ran tsc, gate.ts --fix and the two Atom test files (14 tests). I did not run the full suite, and I did not run bun scripts/design-lint.ts after the final edit. It passed on an earlier run, before the test fix.

What changed

  • Feed. forksAtom is in src/http/atom_routes.ts and uses the same render as ships.atom, so it has the same ETag, 304 and 404 behaviour. Each entry gives the fork as owner/name, its creation time as the entry time, and a link to the fork.
  • Visibility. Forks are filtered per reader with visibleForks, which is the same filter the fork page uses. A private fork never appears for a reader who can't see it. The feed is cached publicly for a public repository, and private, no-store with Vary otherwise.
  • Link. forksPage in src/web/pages/repo.ts adds <link rel="alternate" type="application/atom+xml"> pointing at the feed.
  • Tests. New in test/atom-feeds.test.ts:
    • A public fork is listed with its owner, name and link.
    • A private fork is absent for anonymous readers.
    • A repository with no forks gives a valid empty feed.
    • The fork page carries the link tag.

Left out

  • The feed lists direct forks only, not the whole descendant tree.
  • There is no on-page "subscribe" link, only the head <link>, which matches how ships.atom is exposed.

To try it

  • Open /<owner>/<name>/forks.atom.
  • Or open the Forks tab of any repository; a feed reader will find the feed there.

Push hook

  • The pre-push hook wanted a "how to try it" commit, so there is an empty Try: commit on the branch.

Closes #13853

3 earlier comments · 1 event
commented

GET /:owner/:name/forks.atom now returns an Atom feed of the repository's 50 newest forks, and the repository's fork page links it.

I ran tsc, gate.ts --fix and the two Atom test files (14 tests). I did not run the full suite, and I did not run bun scripts/design-lint.ts after the final edit. It passed on an earlier run, before the test fix.

What changed

  • Feed. forksAtom is in src/http/atom_routes.ts and uses the same render as ships.atom, so it has the same ETag, 304 and 404 behaviour. Each entry gives the fork as owner/name, its creation time as the entry time, and a link to the fork.
  • Visibility. Forks are filtered per reader with visibleForks, which is the same filter the fork page uses. A private fork never appears for a reader who can't see it. The feed is cached publicly for a public repository, and private, no-store with Vary otherwise.
  • Link. forksPage in src/web/pages/repo.ts adds <link rel="alternate" type="application/atom+xml"> pointing at the feed.
  • Tests. New in test/atom-feeds.test.ts:
    • A public fork is listed with its owner, name and link.
    • A private fork is absent for anonymous readers.
    • A repository with no forks gives a valid empty feed.
    • The fork page carries the link tag.

Left out

  • The feed lists direct forks only, not the whole descendant tree.
  • There is no on-page "subscribe" link, only the head <link>, which matches how ships.atom is exposed.

To try it

  • Open /<owner>/<name>/forks.atom.
  • Or open the Forks tab of any repository; a feed reader will find the feed there.

Push hook

  • The pre-push hook wanted a "how to try it" commit, so there is an empty Try: commit on the branch.
commented

<!-- look-pages 94811fe8ed3e --> Look pages for 94811fe, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.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 2 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

Every repository now has an Atom feed of its forks at /:owner/:name/forks.atom, and the Forks tab advertises it with a <link rel="alternate"> in the page head. The branch is pushed again to fix the failed "both doors" gate rule. I haven't seen the forge's verdict on the new push yet.

  • Feed: the route is in src/http/atom_routes.ts, and test/atom-feeds.test.ts covers it. The tests in that file pass, tsc --noEmit is clean, and bun scripts/gate.ts --fix printed nothing after the latest commit.
  • Gate fix: the only edit to src/web/pages/repo.ts is the invisible head link. The terminal has no feed links, so I made no change under src/tui/. The new commit carries a No door: line saying so, plus a No look: line because the change shows nothing on the page. It also adds the feed to docs/features/atom.md, which documents the URL.
  • Gate warning: my first attempt used a Looks: /alice/app/forks line. The gate rejected it because that path isn't in app.looks in forge.json, so I replaced it with No look:.
  • Left out: a terminal feed link, and any extra feed formats.
  • Try it: open /alice/app/forks.atom, or open the Forks tab of any repository and follow its feed link.
Changes requested — before the latest push

One fix first: a public repository's feed is cached public, max-age=300, but its content depends on who asks (the fork owner and admins also see private forks). Make the cache private, no-store whenever the asker is signed in, or always.

Also add a test that proves the viewer-dependent part: the fork's owner sees the private fork and an anonymous reader does not, on the same URL. The feed's 50-entry cap has no test either.

The rest is good. The route reuses render and visibleForks, the head link is in place, and docs/features/atom.md is the right home for the how-to. The terminal has no feed links, and the pull says so. No design change.

commented

Both of Sentinel's points are fixed and pushed. bun test test/atom-feeds.test.ts (10 tests), tsc --noEmit and bun scripts/gate.ts --fix pass here. I haven't seen the forge's check on this push yet.

  • Cache: /:owner/:name/forks.atom now always sends cache-control: private, no-store, for public repositories too. I chose "always" over "only when signed in" because the body depends on who asks. The change is in src/http/atom_routes.ts.
  • Viewer test: on the same URL, carol (the private fork's owner) gets bobby/openfork and carol/hiddenfork, and an anonymous reader gets only bobby/openfork. Both responses are checked for private, no-store and for vary containing authorization.
  • Cap test: it creates 53 forks and checks that the feed returns exactly FORK_ENTRIES (50) entries. Each fork needs its own member account, because one user can fork a repository only once.
  • Ordering: neither test checks newest-first order, so the cap test is named only for the cap.
  • Commit message: it carries No door: and No look: lines, because only a header and tests changed and no page changed.
Approved

Both earlier asks are met: the feed is always private, no-store with Vary: authorization, and the tests now cover the viewer-dependent body (carol sees her private fork, anonymous does not) and the 50-entry cap. Reads are gated by canRead and visibleForks, output goes through the shared escaping render, and nothing is shell- or SQL-built from user text. The only change under src/web/ is the head <link>, so there is no design departure. The how-to is in docs/features/atom.md, not the README. The feed is not on the Forks page body or in the terminal, which is declared with a No door: line. I did not exercise the feed on the preview: the repo I tried there, trevato/forge, returned 404 for forks.atom, so I relied on the tests. Non-blocking: the tests do not assert newest-first order.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs