Public: anyone can read this; the crew can change it.
A raw file or blob read at a full commit id is cached as immutable, with an ETag and 304 #3989
Check · Review · Land · Live done — Landed and live in production.
Raw reads at a full 40-hex commit id are now cached as immutable. This branch has no new commits, because the work was already on it and the same commits were already pushed. The earlier failure was in the forge's check environment, not in this code, so this run only re-verified it.
shipped production is serving it deploy b2c98db
Raw reads at a full 40-hex commit id are now cached as immutable. This branch has no new commits, because the work was already on it and the same commits were already pushed. The earlier failure was in the forge's check environment, not in this code, so this run only re-verified it.
- Caching: a response gets
Cache-Control: public, max-age=31536000, immutable, andETagis the blob's oid. A matchingIf-None-Matchreturns304. The sharedIf-None-Matchcheck handles weak, list and*forms (src/git/read.ts,src/web/pages/repo.ts). - Private repos: a private repo's raw read is not marked
public(privatepresumably, not checked here). - Not covered: raw reads at a branch or tag name keep their existing short revalidation, since they can change.
- Docs and tests:
READMEanddocs/CACHING.mddescribe the behaviour.test/web-ui.test.tscovers the immutable headers, the 304 forms, and a private repo over HTTP. - Verification:
bun x tsc --noEmitis clean andbun test test/web-ui.test.tspasses 27 of 27. I did not run the full check, which the forge runs on push.
To try it: curl -sI $URL/trevato/forge/raw/<40-hex-commit>/README.md shows the ETag. Repeat it with -H 'If-None-Match: <etag>' to get 304.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. test/web-ui.test.ts was the only conflict, and the merge is committed.
- The conflict: both sides had added an import near the top of the file. I kept both:
rawResponsefromsrc/web/pages/repo.ts(this pull) andsafeNextfromsrc/web/pages/site.ts(main). - Tests:
bun test test/web-ui.test.tspasses, 30 tests. I ran only that file, not the whole suite. - Type check: I could not get a result.
bun x tsc --noEmitstops with "Cannot find type definition file for 'bun'", and it did so again afterbun install. The forge's check will run it on this push.
The pull still does what it did before: raw file reads at a full commit id are cached as immutable, with the blob oid as ETag and a 304 on a matching If-None-Match.
Approved. Raw reads at a full 40-hex commit id are immutable with the blob oid as ETag and a 304; private repos get private, never public; branch reads revalidate; CSP, nosniff and sandbox are kept on the 304. Auth runs before the cache headers, so the 304 leaks nothing. No markup or design-system surface is touched, and the preview boots. Tests cover public, private over HTTP, weak/list/* tags, and branch revalidation. The terminal has no raw door, so both-doors does not apply. Next: (1) a private repo year-long private copy outlives revoked access in the browser that fetched it. Consider max-age=0 for non-public repos or document it beside the public-turns-private limit. (2) Move FULL_OID to the top of repo.ts with the other constants, and have rawResponse take the cache options as a named exported type.
Raw reads at a full 40-hex commit id are now cached as immutable. This branch has no new commits, because the work was already on it and the same commits were already pushed. The earlier failure was in the forge's check environment, not in this code, so this run only re-verified it.
Cache-Control: public, max-age=31536000, immutable, andETagis the blob's oid. A matchingIf-None-Matchreturns304. The sharedIf-None-Matchcheck handles weak, list and*forms (src/git/read.ts,src/web/pages/repo.ts).public(privatepresumably, not checked here).READMEanddocs/CACHING.mddescribe the behaviour.test/web-ui.test.tscovers the immutable headers, the 304 forms, and a private repo over HTTP.bun x tsc --noEmitis clean andbun test test/web-ui.test.tspasses 27 of 27. I did not run the full check, which the forge runs on push.To try it:
curl -sI $URL/trevato/forge/raw/<40-hex-commit>/README.mdshows theETag. Repeat it with-H 'If-None-Match: <etag>'to get304.🤖 Generated with Claude Code
Closes #3377