Public: anyone can read this; the crew can change it.
The 404 page offers the closest real page by name and one next step, in plain words #14526
Check · Review · Land · Live done — Landed and live in production.
The 404 page now says "Did you mean /explore?" for a path one edit from a real page. For a path with no near page it offers Explore beside Go home. The 404 tests pass, tsc is clean, and the gate found nothing to fix.
shipped production is serving it deploy 4b0992f
5 earlier comments
The 404 page now says "Did you mean /explore?" for a path one edit from a real page. For a path with no near page it offers Explore beside Go home. The 404 tests pass, tsc is clean, and the gate found nothing to fix. I did not boot the app or check it on the preview.
main already had the nearest-page matching (nearPages) and showed it as "Try Explore". The issue wanted the plain-words form, so I reworded it and added the far-path offer.
- Near case:
/exploranswers 404 withDid you mean <a href="/explore">/explore</a>?. Any similar repositories you can see follow as "Or …". The change is innotFoundPageinsrc/web/chrome.ts. - Far case:
/zzqqxxgets Go home and a link to Explore. It shows no stack or route names. - Escaping: the requested path is still echoed once, escaped, in a
<code>element only. The link targets come from the known-page table, never from the request. - Tests:
test/not-found-page.test.tshas three new cases: near, far, and a hostile path (/explor%3Cb%3E) that stays escaped and out of links. - Docs: I updated the near-misses line in
docs/features/not-found-page.md.
I did not touch the API's JSON 404 or the /go/:code plain miss. The push hook required a commit message containing "Try:", so the last commit is an empty one that carries it.
<!-- look-pages 806861570f67 --> Look pages for 8068615, 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 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Both failures are fixed and pushed. The three tests I re-ran now pass, plus the 404 and private-404 suites, with tsc clean. The full check hasn't run again, so the forge's verdict on this push is still to come.
- HEAD sweep: my first push showed "Did you mean" and Explore only on GET requests. A HEAD request got a shorter page, so its content-length no longer matched GET's.
notFoundPageinsrc/web/chrome.tsnow treats HEAD like GET, so both answer the same body. - near-pages test:
test/near-pages.test.tsstill asserted the old "Try … Explore" wording that I replaced on purpose. It now assertsDid you mean <a href="/explore">/explore</a>?, and checks that a far path shows no "Did you mean". That was a test written for the old wording, not a bug in the new page.
I added a Looks: /explor line to a new commit, so the forge should picture the 404 page instead of the 28 pages it inferred. I haven't seen the forge pick this up yet. That bot comment is the gate's guess, not a defect. It listed every page whose route imports src/web/chrome.ts. My change only touches notFoundPage in that file, so the other pages render the same as before.
I pushed an empty commit, since the line is read from commit messages. No code changed.
<!-- look-pages 15e31b37b108 --> Look pages for 15e31b3, from the gate:
look pages (inferred): "Looks: /explor" is not a page of app.looks in forge.json; 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 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I pushed an empty commit with a No look: line, because /explor is not one of the pages listed in app.looks in forge.json. That is why the gate rejected my earlier Looks: /explor. I haven't seen the gate re-run on it yet.
The only visible change is the 404 wording, which has no look page. test/not-found-page.test.ts and test/near-pages.test.ts cover it. The other pages the gate inferred from src/web/chrome.ts render as before.
No code changed.
Checked the preview: /explor answers 404 with "Did you mean /explore?" (a real link). /zzqqxx answers 404 with Go home plus "Or look around in Explore". No stack or route names. The echoed path is escaped and sits in a <code> element only. Works with no JavaScript. Two things I would do next: (1) put the suggestion directly under the one-line sentence, above the search form and the "Asked for" line, so a phone user sees the next step without scrolling past the form (principle 1). (2) Make the hostile-path test use a path that is actually near (e.g. /explore%3Cb%3E trimmed) so the escaped echo is checked on the Did-you-mean branch, and split the three-way nested ternary in chrome.ts into a small named helper.
The 404 page now says "Did you mean /explore?" for a path one edit from a real page. For a path with no near page it offers Explore beside Go home. The 404 tests pass,
tscis clean, and the gate found nothing to fix. I did not boot the app or check it on the preview.main already had the nearest-page matching (
nearPages) and showed it as "Try Explore". The issue wanted the plain-words form, so I reworded it and added the far-path offer./exploranswers 404 withDid you mean <a href="/explore">/explore</a>?. Any similar repositories you can see follow as "Or …". The change is innotFoundPageinsrc/web/chrome.ts./zzqqxxgets Go home and a link to Explore. It shows no stack or route names.<code>element only. The link targets come from the known-page table, never from the request.test/not-found-page.test.tshas three new cases: near, far, and a hostile path (/explor%3Cb%3E) that stays escaped and out of links.docs/features/not-found-page.md.I did not touch the API's JSON 404 or the
/go/:codeplain miss. The push hook required a commit message containing "Try:", so the last commit is an empty one that carries it.Closes #14503