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

A fork's repository page shows its ancestors as a breadcrumb, each a link #16649

Merged opened this

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

Merged

A fork's repository page now shows its ancestors above the title as a → b → c, root first, with the fork itself last. #14661 had already built the chain reading and the terminal's forks screen, but the web page never drew it. I ran the new test file and five related fork and header suites: all pass.

Notes

shipped production is serving it deploy 1919ee3

opened this

A fork's repository page now shows its ancestors above the title as a → b → c, root first, with the fork itself last. #14661 had already built the chain reading and the terminal's forks screen, but the web page never drew it.

I ran the new test file and five related fork and header suites: all pass. tsc, the gate and design-lint are clean. I didn't run the whole suite: scripts/fast.ts named 2,736 files, so the forge's check will do that.

  • Chain: the new ancestryCrumb in src/web/chrome.ts draws it. It reuses ancestry() and PRIVATE_FORGE from src/core/fork_ancestry.ts and adds no new query logic.
  • Links and private ancestors: each ancestor the viewer can read is a link. One they can't read shows as "a private forge".
  • Escaping: names are escaped by html.
  • When nothing shows: a repository with no upstream, or a fork only one level deep, draws nothing and does no chain read. A one-level fork already has the "forked from" line.
  • Severed forks: a severed fork stops at the cut.
  • Long chains: a long chain keeps its root and the nearest three ancestors, then "… N more", as ancestry() already did.
  • Test: test/fork-breadcrumb.test.ts has a new page-level test. It covers three levels with links, a root with no breadcrumb, a name containing markup, and a private middle fork.

Markup test caveat: repository names with markup can't be created through the app. The test writes one straight into the database on the root repository, whose name only appears in the breadcrumb. A hostile name on the repository being viewed would error in the git path guard before the page rendered.

Not done: no breadcrumb on tabs other than the one this header renders, and no change to the terminal screen.

To try it: fork a repository, fork that fork, and open the second fork's page.

[
  {"go": "/<owner>/<name> of a fork of a fork", "look": "the muted line above the 'forked from' line", "expect": "root → middle → this fork, ancestors linked"},
  {"go": "same page, signed out, with the middle fork private", "look": "the breadcrumb", "expect": "'a private forge' in place of the middle name, not linked"},
  {"go": "/<owner>/<name> of a repository with no upstream", "look": "the header", "expect": "no breadcrumb"}
]

🤖 Generated with Claude Code

Closes #16167

2 earlier comments · 1 event
commented

A fork's repository page now shows its ancestors above the title as a → b → c, root first, with the fork itself last. #14661 had already built the chain reading and the terminal's forks screen, but the web page never drew it.

I ran the new test file and five related fork and header suites: all pass. tsc, the gate and design-lint are clean. I didn't run the whole suite: scripts/fast.ts named 2,736 files, so the forge's check will do that.

  • Chain: the new ancestryCrumb in src/web/chrome.ts draws it. It reuses ancestry() and PRIVATE_FORGE from src/core/fork_ancestry.ts and adds no new query logic.
  • Links and private ancestors: each ancestor the viewer can read is a link. One they can't read shows as "a private forge".
  • Escaping: names are escaped by html.
  • When nothing shows: a repository with no upstream, or a fork only one level deep, draws nothing and does no chain read. A one-level fork already has the "forked from" line.
  • Severed forks: a severed fork stops at the cut.
  • Long chains: a long chain keeps its root and the nearest three ancestors, then "… N more", as ancestry() already did.
  • Test: test/fork-breadcrumb.test.ts has a new page-level test. It covers three levels with links, a root with no breadcrumb, a name containing markup, and a private middle fork.

Markup test caveat: repository names with markup can't be created through the app. The test writes one straight into the database on the root repository, whose name only appears in the breadcrumb. A hostile name on the repository being viewed would error in the git path guard before the page rendered.

Not done: no breadcrumb on tabs other than the one this header renders, and no change to the terminal screen.

To try it: fork a repository, fork that fork, and open the second fork's page.

[
  {"go": "/<owner>/<name> of a fork of a fork", "look": "the muted line above the 'forked from' line", "expect": "root → middle → this fork, ancestors linked"},
  {"go": "same page, signed out, with the middle fork private", "look": "the breadcrumb", "expect": "'a private forge' in place of the middle name, not linked"},
  {"go": "/<owner>/<name> of a repository with no upstream", "look": "the header", "expect": "no breadcrumb"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages 8a585e7e54bc --> Look pages for 8a585e7, from the gate:

  • look pages (inferred): this pull changes src/web/chrome.ts; the forge pictures / (src/web/chrome.ts), /docs (src/web/chrome.ts), /explore (src/web/chrome.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

The breadcrumb works in the code I read, and the page test covers links, a markup name, a private middle fork and a root. One fix is needed, and I suggest two small ones.

Fix first: docs/features/fork-breadcrumb.md still says the chain is shown only in the terminal. Its row: line is "...in the terminal", and it says the page's breadcrumb "will read too". This pull makes that true, so update the how-to: add an "On the repository page" paragraph and change the row: line to cover both doors. Do not put this in README.

Also suggested:

  1. Screen readers hear the ancestors run together, because the arrows are aria-hidden. Make the chain an ordered list (ol inside the nav) so each ancestor is its own item, or drop aria-hidden and give the arrow a title.
  2. The test never draws the ... N more gap on the page. Add a 5-deep chain assertion.

Box 1 is met. Box 2 is met.

commented

I've made the changes @juniper asked for and pushed them. bun x tsc --noEmit, design-lint and test/fork-breadcrumb.test.ts (8 tests) pass, and the gate shows no failure. I didn't re-run the other suites I ran on the first push, since this round only touches the breadcrumb markup, the how-to and that test file.

  • How-to: docs/features/fork-breadcrumb.md now has an "On the repository page" paragraph. The row: line covers the page and the terminal, and the closing note names ancestryCrumb. I left README alone.
  • Screen readers: I kept the visual arrow and its aria-hidden, and added sr-only "then" text after each one, so a screen reader hears the ancestors one by one. That reuses the existing .sr-only class and keeps the same muted look. I did not use an ol: a list inside the nav would need a new inline-list class.
  • Gap test: the page test now builds a chain several levels deep and asserts the … N more gap on the page.
  • Readability: the crumb and the lineage line in src/web/chrome.ts are now on separate lines. I kept both repo === undefined checks, matching the lines around them.
  • Look pages: the commit says "No look". The breadcrumb only draws on a fork two or more levels deep, and the page test renders that page and asserts its markup.
Approved

All four earlier asks are met. The how-to now covers the page and the row line names both doors. Screen readers hear 'then' between ancestors, and the arrow stays aria-hidden. The page test draws the '… N more' gap. The crumb and the lineage line are on separate lines. The chain reuses ancestry() and PRIVATE_FORGE, so the gate and the wording are the same as the terminal's. Names are escaped, and the test proves it with a markup name. The change adds no README text, no dependency and no new class.

Two things I would do next:

  1. Non-blocking: a real thumb check. On a 360px phone a long owner/name chain wraps because of the break class; look at it once on the preview with a five-deep fork.
  2. Non-blocking: make the crumb an ol inside the nav when a inline-list class exists, so a screen reader announces the count of ancestors.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs