Skip to content

site: a GitHub URL with commit.city swapped in lands on the city - #9

Merged
azank1 merged 2 commits into
mainfrom
site/github-paths
Oct 13, 2026
Merged

azank1 merged 2 commits into
mainfrom
site/github-paths

Conversation

@azank1

@azank1 azank1 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Swapping github.com for commit.city is the site's front door, but it only worked on a profile or a repo's front page. In production today:

path before after
/vercel/ai/pulls 404 → /vercel/ai
/vercel/ai/tree/main/packages/ai 404 → /vercel/ai
/vercel/next.js/commits/canary 404 → /vercel/next.js
/vercel/ai.git opens a repo city for "ai.git" → /vercel/ai
/orgs/vercel opens a repo city for "orgs/vercel" → /vercel
  • vercel.json gets three redirects (307). Existing site paths (/api, /s, /v, /explore, …) are excluded by the same lookahead the rewrites use.
  • scripts/dev.mjs applies redirects too, in Vercel's order: redirects, then the filesystem, then rewrites.
  • New test/routes.test.ts runs a table of paths through vercel.json with path-to-regexp 6.3.0, which matches the patterns as Vercel does.

Tests: web 39, 33 pass, 6 live tests skipped. The dev server returned all five redirects above, and ?x=1 query strings are kept.

Second commit: a repo GitHub moved has one city, under its current name

facebook/react is react/react now, and commit.city kept two cities of it. /facebook/react served one built on 2026-10-11 (685 commits), while /react/react had one a day newer (689). Builds were keyed by the name requested, so every old link to a moved repo built a second city.

  • The page redirects (307) when the city under the requested name belongs to a repo that has since moved: /facebook/react → /react/react. A different letter case is still the same name and doesn't redirect.
  • A build of a moved repo is keyed by its current name and checks the current owner's hidden setting. It also writes a meta under the old name that redirects, so later visitors are sent on instead of triggering a rebuild.
  • The page swaps the address bar to the current name when the build starts.

Tests: new test/page.test.ts covers the redirect; the finish test checks the meta written under the old name. web: 40 tests, 34 pass, 6 live tests skipped.

Swapping the domain on a GitHub page is the site's front door, but it only
worked on a profile or a repo's front page: /vercel/ai/pulls,
/vercel/ai/tree/main and /vercel/next.js/commits/canary were 404s, and
/orgs/vercel opened a repo city called "orgs/vercel".

- /owner/repo/<anything> and /owner/repo.git redirect to /owner/repo
- /orgs/<org>[/...] redirects to /<org>
- the dev server applies vercel.json's redirects too, and a test runs the
  routes through path-to-regexp, which matches them as Vercel does
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
commit-city Ready Ready Preview Oct 13, 2026 12:02pm UTC

facebook/react is react/react now, and commit.city kept two cities of it:
/facebook/react served one built 2026-10-11 (685 commits) while
/react/react had one a day newer (689). A build was keyed by the name it
was asked for, so every old link to a moved repo built a second city.

- the page redirects (307) when the city under the asked-for name belongs
  to a repo that has since moved: /facebook/react -> /react/react
- a build of a moved repo is keyed by the current name, checks the current
  owner's hidden setting, and leaves the old name a meta that redirects,
  so its later visitors are sent on rather than rebuilding
- the page swaps the address bar to the current name when the build starts
@azank1
azank1 force-pushed the site/github-paths branch from 2e943c8 to 07a7e91 Compare October 13, 2026 12:02
@azank1
azank1 marked this pull request as ready for review October 13, 2026 12:22
@azank1
azank1 merged commit a0f0661 into main Oct 13, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 07a7e91b Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant