Public: anyone can read this; the crew can change it.
The shell's 27 KB of JavaScript is a cached file, not re-sent with every page #1033
Every page now links the shell's script (shellJs, about 27.7 KB) as a cached file at /assets/shell- .js instead of sending it inline. Each HTML response is about 27.5 KB smaller, and a browser downloads the shell once per deploy. Why the last check failed.
stopped closed without shipping deploy c962028
Sign in to join this conversation.
new above
offline
Every page now links the shell's script (
shellJs, about 27.7 KB) as a cached file at/assets/shell-<hash>.jsinstead of sending it inline. Each HTML response is about 27.5 KB smaller, and a browser downloads the shell once per deploy.Why the last check failed. The check parked on pull #1004 failed in "capacity: only a forge admin reads or changes it > an admin changes each one…". That test fails on
maintoo, wheneverFORGE_CHECK_SHARDSis set. The check command sets it to 2 for its shard runner, and test processes inherit it. That variable is also the boot default forchecks.shards, so resetting the setting went back to "2" instead of to nothing. Commit c962028 clears the variable for thatdescribeblock and restores it afterwards. This is the cause #1018 left unnamed, so it may conflict with #1018's split of the same case.The check's other failures were preview deploys that didn't come up in time, an egress probe refused, and looks that depend on a deploy, all in a check that ran 21 minutes. Run here with
FORGE_CHECK_SHARDS=2, those suites all pass on this branch: studio 175, fork-pull-approval 12, meter 7, looks 14, contain 25.What changed for the shell (2fd49ba)
src/web/asset.ts:shellAsset()hashesshellJsonce per process and returns its path and anintegrityhash.shellResponse()serves it withcache-control: public, max-age=31536000, immutable.src/http/server.ts: the existing/assets/:name.jsroute serves the shell as well as the highlighter. A stale hash gets a 404, and that page works without the shell's scripting until it reloads.src/web/layout.ts:page()emits<script nonce src integrity>for the shell, then the page's ownscriptJsinline under the same nonce.Run order: the shell is a classic script, not a module and not deferred, placed directly before the page's inline script. Classic scripts run in document order, so the page's script still runs after the shell. The shell is a self-contained IIFE and defines no globals.
CSP: the nonce admits the file, so
script-srcgains neither'self'nor'unsafe-inline'.Tests:
test/web.test.ts:/, the shell's source is absent from the HTML, it is linked as a classic script with the nonce and integrity, and it comes before the page's inline script.shellJs, and matches its integrity hash; a stale hash gets a 404.test/web-browse.test.tsnow allows the shell's file as the only<script src>.The shell isn't minified; that was left out on purpose.
To try it: open a page on the preview and find the
shell-….jstag at the end of<body>. On the second load the file comes from cache, and the palette, Escape on menus and the theme menu work as before.🤖 Generated with Claude Code
Closes #114