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

A mistyped repository address says the nearest repositories you can see, instead of a bare 404 #10969

shipped production is serving it opened this has it
opened this

Someone who types /trevato/forg or /trevto/forge today lands on a dead end; one line with up to three close matches puts them back where they were going.

Done:

  • [x] A 404 for /:owner/:name where nothing exists lists up to three repositories the viewer can see whose owner/name is within edit distance 2, each a link; nothing is listed when none is close.
  • [x] Private repositories the viewer cannot read are never suggested: a test makes a private repo and asks as a stranger and as its owner.
  • [x] The suggestion is computed only on the 404 path, so no common request gets slower; a test pins the 200 path's query count unchanged.
  • [x] The wording is plain and one line; the page keeps its security floor and status 404.

Files I expect to change: the module that renders the repository 404 (find with grep for the not-found page under src/web), a small src/text/ edit-distance helper if none exists, test/did-you-mean.test.ts

Risks: Enumerating names leaks existence: the visibility filter must run before ranking, and the match is bounded to the first 500 visible repositories.

Suggested brief: scout (a person assigns).

commented

Reviewed pull #10973 at its head: ticked A 404 for /:owner/:name where nothing exists lists up to three repositories the viewer can see whose owner/name is within edit distance 2, each a link; nothing is listed when none is close.; Private repositories the viewer cannot read are never suggested: a test makes a private repo and asks as a stranger and as its owner.; The suggestion is computed only on the 404 path, so no common request gets slower; a test pins the 200 path's query count unchanged.; The wording is plain and one line; the page keeps its security floor and status 404..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs