torb doc: move the inline head script into a file so a strict CSP allows it #235
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up of #17.
Problem. The pages
torb docwrites carry one inline<script>in the head:headScriptofcompiler/src/documentation/site-style.trb, written bycompiler/src/reference/site.trb. It restores the stored theme before paint. The registry serves a version's pages (/docs/intools/deploy/nginx.conf) withscript-src 'self', so the browser blocks that script and a page follows the system theme until the toggle is used.Proposal.
torb docwrites the head script as a file of the site,theme.jsat the root of the site (next tosearch.js), and the head loads it with<script src="{root}theme.js"></script>, withoutdeferso it still runs before paint. A hash in the CSP would break with every toolchain change. The file holdsheadScriptunchanged (one source of truth; its language and referrer parts are no-ops on reference pages, which carry nodata-path).Acceptance.
siteFilesofcompiler/src/reference/site.trbcontainstheme.js, with the content ofheadScript.torb docwrites contains an inline<script>(only<script src=...>); the head loadstheme.jsbeforesearch-index.jsandsearch.js, withoutdefer, with the right relative root forindex.htmland for<package>/<module>.html.compiler/tests/reference.test.trbcover the three points above (file list, no inline script, the tag per page depth).script-src 'self') restores the saved theme and the console reports no CSP violation (checked once in a browser on the rendered output served with that header; not a CI gate).docs/tooling/torb-doc.mdnamestheme.js; the comment of the/docs/location intools/deploy/nginx.confno longer says the theme script is blocked; the generated skills are refreshed if the docs change requires it (torb docs skill docs skills --check).Design point.
docs/design/RELEASE.mdsection 7.7/7.11 (documentation worker, registry shell: no inline script);docs/tooling/torb-doc.md("The site"). No open question in CONCEPT is involved.Seed. Not touched: no syntax change, no new native, no driver flag, no std name looked up by string.
Size. One PR, one Conventional Commit, e.g.
fix(doc): load the head script of torb doc pages from theme.js.Out of scope. The documentation site (
torb docs site,site-layout.trb) keeps its inline head script: it is not served under a strict CSP.torb docfor every version #17## Declarationssections of the standard library pages #32[loop:torbscript] intake: in scope (author orion, label loop), follow-up of #17, not a duplicate. Moves the inline head script of torb doc pages into a file for a strict CSP. next: waiting (refine queued, ready buffer full) until 2026-10-10T04:00:00Z
[loop:torbscript] claim refine by session:loop-torbscript-20261025-0542 until 2026-10-25T08:50:00Z (no ready issue is free to implement: all five are in review/CI or blocked, intake since 2026-10-09 not refined yet)
[loop:torbscript] decided by the loop:
theme.jsholdsheadScriptunchanged instead of a trimmed theme-only script. Why: one source of truth; the language and referrer parts do nothing on reference pages (nodata-path, noassembledrule), the file is a few hundred bytes, and the behaviour stays identical to the inline script. Scope istorb doconly (the/docs/location of nginx.conf is the strict-CSP host); the site's own pages are not served under it.[loop:torbscript] refine: body rewritten with goal, testable acceptance, design point (RELEASE.md 7.7/7.11, torb-doc.md), seed untouched, one PR / one commit; label
readyset. next: ready. Worker tokens ~65k. Claim of session:loop-torbscript-20261025-0542 released.[loop:torbscript] claim implement by session:loop-torbscript-20261025-0542 until 2026-10-25T19:40:00Z (PR 481 landed, torb doc area free; implement per the refine comment: one PR, one commit)
[loop:torbscript] release implement: #483, head
21395f9c7f, CI pending after 1500 s (bootstrap, commit messages, pdisc green; tier A/B, gates and the rest queued), Argus review requested, next: waiting (CI + review on PR 483)[loop:torbscript] claim implement by session:loop-torbscript-20261025-0542 until 2026-10-25T20:30:00Z (CI fix on PR 483 head
21395f9c: tier A one failing testthe site > written to disk, the files are there, Assertion failed: written == 8; run 1818 job 20471; gates job 20466 to be checked)[loop:torbscript] release implement: CI fix on PR 483. Root cause of run 1818: the test
the site > written to disk, the files are therestill expected 8 written files, but the PR addstheme.js(now 9). Thegatesjob only aggregates its needs (it listsgates.tier-a), so it failed because tier A did. The test now assertswritten == 9and thattheme.jsexists on disk; the other assertions already named the new file. Still one commit (force-with-lease on loop/235-theme-js, check-commits clean), Argus is a requested reviewer. Head12aa2b83b5. CI after 1500 s: pending (tier A, gates, agree, playground, seed, archives queued; bootstrap, tier B, tools, commit messages, pdisc green). next: waiting (CI + review on PR 483)