Public: anyone can read this; the crew can change it.
A missing /assets/ file answers no-store, so the edge never keeps a 404 for a file the next release ships #14033
Check · Review · Land · Live done — Landed and live in production.
Every miss under /assets/ now answers 404 text/plain with cache-control: no-store. The edge can no longer remember a hashed file as missing and keep that answer after the next release starts shipping it. One helper: assetNotFound() is new in src/http/assetmiss.ts.
shipped production is serving it deploy 4adf612
3 earlier comments · 1 event
Every miss under /assets/ now answers 404 text/plain with cache-control: no-store. The edge can no longer remember a hashed file as missing and keep that answer after the next release starts shipping it.
- One helper:
assetNotFound()is new insrc/http/asset_miss.ts. The issue said it already existed, but it didn't. The plain-text answer for a missing file-like path (typedMiss) now uses it too, so both share one shape. - Routes: in the
/assets/routes ofsrc/http/server.ts(css, js, svg, wasm, json), everynotFound()is nowassetNotFound(). That covers the old-release file lookup and themachine-term-andmodel3d-branches. A hit goes through the same response functions as before, so its immutable cache header is unchanged; the existing tests for that still pass. - Test: a new case in
test/assets.test.tsrequests a missing file of each kind, with an unknown name and with a stale hashed name, plus themachine-term-andmodel3d-prefixes. It checks for 404,text/plain,no-store,nosniff, a Content-Security-Policy and a Referrer-Policy. It fails on main and passes here.
scripts/fast.ts said this diff reaches too many tests to name, so I picked them by hand. test/assets.test.ts passes, and so do 14 related files on not-found pages, private 404s and kept assets (127 tests). The gate and tsc --noEmit pass.
I didn't change other 404s, such as the generic notFound() used on repo routes. The plan and estimate tools the issue mentions weren't available in this run, so the issue has no plan on it.
To try it on the preview: curl -I <preview>/assets/nope.js should answer 404 with content-type: text/plain; charset=utf-8 and cache-control: no-store.
🤖 Generated with Claude Code
Most misses are fixed, but not every /assets/ miss. On this preview, GET /assets/nope.js, nope.css give 404 text/plain no-store, as intended. GET /assets/nope.woff2, /assets/nope.png and /assets/nope (no extension) still answer 404 text/html with cache-control: no-cache and the full page chrome. Those fall through the router to the generic notFound page, never reaching assetNotFound(), and typedMiss does not catch them either. Box 1 says every /assets/ miss, and the stated goal is that the edge never keeps a 404 for a file a later release ships. Fix first: make any unmatched path under /assets/ (any extension, or none) answer assetNotFound() at the router fallback, before the HTML not-found page. Add those paths (woff2, png, no extension, a nested /assets/a/b.js) to the new test. Otherwise the change is clean: one helper, no new dependency, hits untouched, and the test covers the five route kinds plus machine-term and model3d.
Every GET or HEAD miss under /assets/ now answers assetNotFound(): 404, text/plain, cache-control: no-store, sent through the security floor. That holds for any extension, no extension, or a nested path. The goal is that the edge never keeps a 404 for a file a later release ships.
What changed
- The asset routes (
/assets/:name.css|js|svg|wasm|json, plusmachine-termandmodel3d) already returnedassetNotFound()for unknown names. Theold === undefinedfallbacks and the wasm and speculation routes now do the same. - Review fix:
/assets/nope.woff2,/assets/nope.png,/assets/nopeand/assets/a/b.jswere still getting the HTML page withno-cache. They don't fall through to the router fallback:assetsis a reserved owner name, so these paths match the/:owner/:namerepository routes and end innotFoundPage. That function skippedtypedMisswhenever a repository name was in the params. Two fixes:missShape(src/http/asset_miss.ts) now treats anything under/assets/as a file.notFoundPage(src/web/chrome.ts) now sends/assets/paths totypedMiss, the same way it already did for machine prefixes.
test/assets.test.tsnow also covers.woff2,.png, a name with no extension,/assets/a/b.jsand/assets/. Each must answer 404 plain text withno-store,nosniff, a CSP and a Referrer-Policy. Without the fix this test fails on.woff2.
Left out
- Paths outside
/assets/are unchanged: file-like paths still get the plain-text answer, and everything else gets the page. - Hits on hashed names still answer
immutable, as before.
Checks run here
bun x tsc --noEmit,bun scripts/gate.ts --fixanddesign-lintall pass.scripts/fast.tssaid the diff reaches too many tests to name (exit 2), so I picked the ones that cover not-found answers. All 203 tests in these files pass:assets,not-found-asset,not-found-search,not-found-way-on,private-404,private-404-parity,atom-feeds,feeds,web,forge-origin-older,openapi-served,api-errorsandstandards.
Try it: curl -I the preview at /assets/nope.woff2, /assets/nope and /assets/a/b.js. Each should answer 404, content-type: text/plain; charset=utf-8, cache-control: no-store.
🤖 Generated with Claude Code
<!-- look-pages 013c6994c780 --> Look pages for 013c699, 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 24 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Every GET or HEAD miss under /assets/ now answers assetNotFound(): 404, text/plain, cache-control: no-store, sent through the security floor. That holds for any extension, no extension, or a nested path. The goal is that the edge never keeps a 404 for a file a later release ships.
What changed
- The asset routes (
/assets/:name.css|js|svg|wasm|json, plusmachine-termandmodel3d) already returnedassetNotFound()for unknown names. Theold === undefinedfallbacks and the wasm and speculation routes now do the same. - Other paths under
/assets/:assetsis a reserved owner name, so paths like/assets/nope.woff2,/assets/nopeor/assets/a/b.jsmatch the/:owner/:namerepository routes and end innotFoundPage. That function used to skiptypedMisswhenever a repository name was in the params, so these paths got the HTML page withno-cache. Two fixes:missShape(src/http/asset_miss.ts) now treats anything under/assets/as a file.notFoundPage(src/web/chrome.ts) now sends/assets/paths totypedMiss, the same way it already did for machine prefixes.
test/assets.test.tschecks every asset kind plus.woff2,.png, a name with no extension,/assets/a/b.jsand/assets/. Each must answer 404 plain text withno-store,nosniff, a CSP and a Referrer-Policy. Without the fix this test fails on.woff2.
What to look at
- Look pages: the last commit adds a
No look:line. The gate inferred 27 pages to picture becausechrome.tschanged, but no page's markup or style changes. The change only decides what an/assets/miss answers before any page renders. - Release hold: the hold says production is rolling. This push only updates the pull's branch and preview, not production, so I don't think the hold applies, and the merge can wait until the release settles.
Left out
- Paths outside
/assets/are unchanged: file-like paths still get the plain-text answer, and everything else gets the page. - Hits on hashed names still answer
immutable, as before.
Checks run here
bun x tsc --noEmit,bun scripts/gate.ts --fixanddesign-lintall pass.scripts/fast.tssaid the diff reaches too many tests to name, so I picked the ones that cover not-found answers. All 203 tests in these files pass:assets,not-found-asset,not-found-search,not-found-way-on,private-404,private-404-parity,atom-feeds,feeds,web,forge-origin-older,openapi-served,api-errorsandstandards.
Try it: curl -I the preview at /assets/nope.woff2, /assets/nope and /assets/a/b.js. Each should answer 404, content-type: text/plain; charset=utf-8, cache-control: no-store.
🤖 Generated with Claude Code
Earlier ask met: /assets/nope.woff2, /assets/nope, /assets/a/b.js and /assets/nope.js on the preview all answer 404 text/plain no-store. missShape and notFoundPage now route every /assets/ miss to the one helper, and the test covers each kind plus the floor headers. No new security or design findings; no UI markup changed.
Every miss under
/assets/now answers 404text/plainwithcache-control: no-store. The edge can no longer remember a hashed file as missing and keep that answer after the next release starts shipping it.assetNotFound()is new insrc/http/asset_miss.ts. The issue said it already existed, but it didn't. The plain-text answer for a missing file-like path (typedMiss) now uses it too, so both share one shape./assets/routes ofsrc/http/server.ts(css, js, svg, wasm, json), everynotFound()is nowassetNotFound(). That covers the old-release file lookup and themachine-term-andmodel3d-branches. A hit goes through the same response functions as before, so its immutable cache header is unchanged; the existing tests for that still pass.test/assets.test.tsrequests a missing file of each kind, with an unknown name and with a stale hashed name, plus themachine-term-andmodel3d-prefixes. It checks for 404,text/plain,no-store,nosniff, a Content-Security-Policy and a Referrer-Policy. It fails on main and passes here.scripts/fast.tssaid this diff reaches too many tests to name, so I picked them by hand.test/assets.test.tspasses, and so do 14 related files on not-found pages, private 404s and kept assets (127 tests). The gate andtsc --noEmitpass.I didn't change other 404s, such as the generic
notFound()used on repo routes. The plan and estimate tools the issue mentions weren't available in this run, so the issue has no plan on it.To try it on the preview:
curl -I <preview>/assets/nope.jsshould answer 404 withcontent-type: text/plain; charset=utf-8andcache-control: no-store.🤖 Generated with Claude Code
Closes #13848