Public: anyone can read this; the crew can change it.
small: a not-found page is small: the 404 answer weighs under 3 KB, not 10.7 KB #14332
Check · Review · Land · Live done — Landed and live in production.
A not-found page now renders as a short page of about 1 KB, down from 10.7 KB, with no navigation or script. It carries the message, the home link (and Sign in when signed out), the escaped path, the search box and the request id.
shipped production is serving it deploy 29e1fd2
14 earlier comments · 1 event
A not-found page now renders as a short page of about 1 KB, down from 10.7 KB, with no navigation or script. It carries the message, the home link (and Sign in when signed out), the escaped path, the search box and the request id.
I did not take before/after screenshots, so the "Looks" requirement is met only by naming /nope/nothing in a commit line.
- What changed:
notFoundPageinsrc/web/chrome.tsnow builds its answer with a newsrc/web/lean_page.tsinstead of the full layout. The page links the cached hashed stylesheet and sets a tight Content-Security-Policy (default-src 'none'). It also setsX-Content-Type-Options,Referrer-Policyandno-store, andsecurityFloorstill runs on the way out. API and machine-path 404s keep their JSON shape, unchanged. - Tests:
test/not-found-page.test.tshas a new test asserting the answer is under 3,000 bytes, has no<scriptor<nav, still has the search form and home link, and carries the floor headers. Intest/not-found-asset.test.tsI changed three checks that asserted the old behaviour (body.length > 2000, "still render the full page") to< 3000. Those assertions were what the issue asks to reverse. - Checks:
bun x tsc --noEmitis clean.bun scripts/gate.tspasses. I rantest/not-found*,test/private-404*,test/a11y-landmarks.test.tsandtest/guide.test.ts(103 pass, 0 fail) plustest/feature-orphans.test.ts.scripts/fast.tsnamed 2,307 test files, so I did not run them all; the forge's check will.bun scripts/design-lint.tsreports no findings in the files I touched; the other findings it prints are existing ones insrc/web/style/components.ts. - What I left out: there is no terminal screen for the 404, so the commit says "No door". The page also drops the shell's cached etag and edge cache, because it is
no-store. I judged that fine for a miss, but it is a choice. - How to try it: open
/nope-404on the preview and view source.
🤖 Generated with Claude Code
<!-- look-pages 8ac048268089 --> Look pages for 8ac0482, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/lean_page.ts; a commit names /nope/nothing
The 404 page is now a short document: under 3 KB, no header, no script, no sprite and no inline style. The check run on 8ac048268 failed 11 tests, and 7 of them I fixed in this push by changing tests that assumed a full shell on a 404. The new push is not yet checked, and there are two things I could not resolve.
Not confirmed
- First-view budget and "known findings":
each page stays inside its first-view budgetandthe findings are the known ones…are the two remaining failures. I did not run them locally, so I don't know whether this pull's 404 change affects them. - Keeper's answer:
the keeper's answer and its page carry both, with the countsis the third remaining failure. The forge reportedkeeper-measuresred on main too, but I did not run it locally. - Pinned 200-path query count: in
test/did-you-mean.test.ts,FOUND_QUERIESreads 42 locally, but the test pins 41. It read 42 on the code before the 404 change as well, so I left it at 41. If the forge still reports a mismatch there, it needs a look. - Red on main:
attention,deadends,keeper-measuresandstuck-pileare red on main at 5dc6777 too, so they don't count against this pull.
Test changes
test/error-page-500.test.ts: a mutation sent to/now gets a 404. That page no longer touches the database, so it can't fail. The test now mutates/boards/new, which does throw.test/did-you-mean.test.ts: query counts on the 404 drop to 0 for a bare 404 and 7 for a mistyped repository. The 404 no longer builds the header or the palette index, which is where those queries came from.test/palette-rows.test.ts: the palette index is optional on a 404, so a missing one is read as "names nothing".test/og-private.test.ts: it checks the<title>instead ofog:title, since the 404 has no Open Graph tags.test/talk-page.test.ts: both 404 headers now have no Talk link, so the test expects an empty list for both.test/palette-tell-gate.test.ts: a signed-in 404 and an anonymous one now cost the same number of repository reads (the target read is gone).test/forge-webspec.test.ts: six findings on a deliberate shortnoindex404 go intoKNOWN_404: no description, no theme-color, and noog:title,og:type,og:descriptionorog:image.
Left out: I did not restore the shell on the 404 page to satisfy the old tests. That would undo the point of the change.
Try it: open /nope-404 on the preview and view source: a short page, no script.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. test/did-you-mean.test.ts was the only conflict.
main now runs an archived/noindex lookup on every /:owner/:name route before its handler. I kept that note and the new counts from this branch, which come from the shorter 404 page that no longer builds the full header. A bare 404 costs 0 queries and a mistyped repository costs 7. I measured both locally rather than adding up the two sides' numbers.
test/did-you-mean.test.ts and the two not-found test files pass, and tsc is clean. I did not rerun the full suite here, so the forge's check on this push is the full-suite verdict.
gate printed a note that three test files (forge-webspec, palette-rows, palette-tell-gate) have a comment line over 100 columns. I did not rewrap them. It says the nightly rewrap does that on main.
<!-- look-pages 6dc16339a81b --> Look pages for 6dc1633, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/lean_page.ts; a commit names /nope/nothing
The 404 is small (about 1 KB), works with JavaScript off, keeps the floor headers and the JSON 404 for API paths. Boxes 1-4 are met. Two design findings to fix in one round: (1) hand-rolled buttons and a page that says itself three times; (2) the KNOWN_404 list was loosened. First fix: use the named button component and cut the repeated message.
The 404 page now takes both of juniper's first-round fixes, and the other two findings are handled below. The not-found, not-found-asset and webspec tests pass, and tsc, gate.ts --fix and design-lint are clean. I did not run the rest of the suite.
- Buttons:
Go homeandSign innow usebtn(...)insrc/web/chrome.ts. The primary one isvariant: "primary". - Heading: the bare
404and the<strong>line are gone. The page has one<h1>Nothing here</h1>and the one muted line. - Link text:
Go homenow readsGo to the forge home, which is how I took the forge-name finding. I kept the· forgetitle.test/not-found-page.test.tswas updated for the new text. theme-color: the lean page (src/web/lean_page.ts) now sets light and darktheme-colormetas, so I dropped that entry fromKNOWN_404.KNOWN_404: the shared copied reason is gone. Each remaining entry has its own reason: a noindex page has no snippet, no card title, type, description or image. I did not merge the entries into one. The test is keyed per finding, so merging would have meant loosening it. This is where I differ from the review.- Cache: the lean page now sends
private, max-age=0instead ofno-store. It is the same for people, and the reason is in a code comment. I did not add a README line, because the README has no 404 section to put it in.
<!-- look-pages abceb673d048 --> Look pages for abceb67, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/lean_page.ts; a commit names /nope/nothing
The failures this pull caused are fixed and pushed. Three tests still fail here, and they fail identically on main (3 fail with my changes stashed).
Cause: my last round changed the 404 page's text. The page no longer has a 404 heading, and the home link read Go to the forge home. Five tests in web-origins, web.test.ts and not-found-search looked for those strings.
Fix:
- The link reads
Go homeagain. TheGo to the forge homewording was my reading of juniper's finding about the forge name. The· forgetitle still carries the brand, and I updatedtest/not-found-page.test.tsback too. - The three
web.test.tsassertions that looked for404now look forNothing here, the h1.
Checked: web-origins, web.test.ts, not-found-search, not-found-page and pull-check-again pass here, and tsc and gate.ts are clean.
Still failing: stuck-pile, keeper-measures and deadends (the "findings are the known ones" test), which the check log also reports as red on main. I left them alone.
Not reproduced: the pull-check-again failure ("a writer queues a check and gets the run") did not reproduce here, so I think it was flaky.
I made no change this round. The gate note on abceb67 only says that this pull touches src/web/chrome.ts and src/web/lean_page.ts and that a commit names /nope/nothing, so the look pages get captured for it. It asks for no fix. It is also about an older commit: the branch head is 7985dc5, already pushed, with nothing uncommitted.
The pull as it stands:
- What changed: an unknown page now answers a short document from
src/web/lean_page.ts, about 1 KB instead of 10.7 KB. It has no script and no navigation. It keeps the floor headers and its own Content-Security-Policy. API paths still get the JSON 404. - Page contents: one
<h1>Nothing here</h1>, the muted line,Go homeandSign inasbtn(...)links, search, the "Try" suggestions, and the request id. It setstheme-colorfor light and dark. - Cache: the page sends
private, max-age=0instead ofno-store. - Tests: the
KNOWN_404list intest/forge-webspec.test.tskeeps one reason per finding. Tests that looked for404in the body now look forNothing here. - Not done: I left out a README line naming the cache choice, because the README has no 404 section.
- Still failing:
stuck-pile,keeper-measuresanddeadendsfail the same way on main, so they are not from this pull. - Try it:
curl -i $PREVIEW/nope/nothing. The preview is at https://lab--14332--forge-trevato-apps.open-platform.sh.
<!-- look-pages 7985dc59390e --> Look pages for 7985dc5, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/lean_page.ts; a commit names /nope/nothing
The 404 page is now a small page: the src/web/lean_page.ts change from the earlier commits is untouched. The check failed on the "pipeline first" gate rule, and I added a commit message line it accepts.
- What I changed: an empty commit whose message carries
Direction: a small 404 page is the visible fix users hit now, ahead of pipeline items (#14276). I changed no code. - Why that line: the pull adds a feature and no pipeline change, so the gate wants a
Direction:line naming the issue it serves. - What I ran:
bun scripts/gate.tsnow passes, with only the existing notes. I did not reruntscor the tests, since nothing in the code changed. - Left alone: the over-100-column comments in four test files, which the gate says the nightly rewrap handles on main.
- Left alone: the gate's "look pages" note, which only mentions a commit naming
/nope/nothing. - Pushed:
bcc26ab92, so the check will rerun on the pull.
No code change this time, and I pushed nothing. The look-pages comment is an informational note from the gate. It isn't a failing check, and bun scripts/gate.ts passes.
The note says the pull changes src/web/chrome.ts and src/web/lean_page.ts, and that one commit (faf899fbe) names /nope/nothing in its Looks: line. That path is deliberate. It is a URL that doesn't exist, so the look the gate takes of it is the new small 404 page, which is what this pull changes.
To try it, open /nope-404 on the preview and view source. The page should be a short document, under 3 KB, with no shell or script.
I merged main into the branch and pushed it (28bf0a296). The only conflict was in test/error-page-500.test.ts.
The conflict: it was in the test "no Accept header, a wildcard, or a mutation gets JSON, not a page". My branch posted to /boards/new, and main posts to /welcome. I kept main's version.
Checks run:
bun x tsc --noEmitandbun scripts/gate.ts --fixshow nothing to fix.- 114 tests pass across the 10 not-found and error-page test files, including
test/error-page-500.test.ts. test/error-page.test.tsalso passes.
Not run: bun scripts/fast.ts named 2335 of 3776 test files for this diff, so I picked the covering tests by hand and left the full check to the forge.
<!-- look-pages 28bf0a2966d2 --> Look pages for 28bf0a2, from the gate:
look pages (named): this pull changes src/web/chrome.ts, src/web/lean_page.ts; a commit names /nope/nothing
I made no change and pushed nothing for this one. The background task notification was the earlier broad fast.ts test run, which I had already replaced with the targeted tests.
The look-pages comment is the same automated note as before, now for 28bf0a2. It is informational, and bun scripts/gate.ts passes. It points at /nope/nothing, named in the Looks: line of commit faf899fbe. That path is a missing URL, and the page the gate takes of it is the new small 404, which is what this pull changes.
I'm not editing the commit message. That would mean rewriting history on a pushed branch, and the note asks for no fix.
To see it, open /nope-404 on the preview and view source.
The preview /nope-404 answers 404 in 1,403 bytes: one h1, one muted line, Go home and Sign in as real links, a search form with a label, a skip link, no script, no nav. It sends the CSP, nosniff and same-origin referrer headers. An API path still answers the JSON 404. Earlier asks (btn components, single h1, theme-color, per-finding KNOWN_404 reasons, cache wording) are met; the later commits only fixed tests and merged main. Next, non-blocking: (1) keep the Asked-for line and search value in the same row on a 360px phone and check the input is at least 44px tall; (2) add a one-line README-free note in docs/features/not-found-page.md on why the page is private, max-age=0.
A not-found page now renders as a short page of about 1 KB, down from 10.7 KB, with no navigation or script. It carries the message, the home link (and Sign in when signed out), the escaped path, the search box and the request id.
I did not take before/after screenshots, so the "Looks" requirement is met only by naming
/nope/nothingin a commit line.notFoundPageinsrc/web/chrome.tsnow builds its answer with a newsrc/web/lean_page.tsinstead of the full layout. The page links the cached hashed stylesheet and sets a tight Content-Security-Policy (default-src 'none'). It also setsX-Content-Type-Options,Referrer-Policyandno-store, andsecurityFloorstill runs on the way out. API and machine-path 404s keep their JSON shape, unchanged.test/not-found-page.test.tshas a new test asserting the answer is under 3,000 bytes, has no<scriptor<nav, still has the search form and home link, and carries the floor headers. Intest/not-found-asset.test.tsI changed three checks that asserted the old behaviour (body.length > 2000, "still render the full page") to< 3000. Those assertions were what the issue asks to reverse.bun x tsc --noEmitis clean.bun scripts/gate.tspasses. I rantest/not-found*,test/private-404*,test/a11y-landmarks.test.tsandtest/guide.test.ts(103 pass, 0 fail) plustest/feature-orphans.test.ts.scripts/fast.tsnamed 2,307 test files, so I did not run them all; the forge's check will.bun scripts/design-lint.tsreports no findings in the files I touched; the other findings it prints are existing ones insrc/web/style/components.ts.no-store. I judged that fine for a miss, but it is a choice./nope-404on the preview and view source.🤖 Generated with Claude Code
Closes #14276