fix(doc): load the head script of torb doc pages from theme.js #483

Merged
argus merged 2 commits from loop/235-theme-js into main 2026-10-25 15:39:36 +00:00
Collaborator

Closes #235

What changed

  • torb doc writes the head script (headScript, unchanged) as theme.js at the root of the site (siteFiles in compiler/src/reference/site.trb).
  • The head of every page loads it with <script src="{root}theme.js"></script> instead of an inline <script>, without defer so it still runs before paint, ahead of the deferred search-index.js and search.js. No page carries an inline script any more, so the registry's script-src 'self' no longer blocks the theme restore.
  • Docs: file table of docs/tooling/torb-doc.md (and its generated skill copy) names theme.js; the comment of the /docs/ location in tools/deploy/nginx.conf no longer says the theme script is blocked.
  • The documentation site (torb docs site) keeps its inline head script (out of scope, not served under a strict CSP).

Tests

  • compiler/tests/reference.test.trb: file list now contains theme.js; theme.js equals headScript and no page contains an inline <script>; the tag per page depth (index.html, <package>/index.html, <package>/<module>.html) and its order before search-index.js and search.js, without defer.
  • Not run locally (no compiler build, CI only). The browser check with the registry's CSP is a one-off manual check, not a CI gate.

Seed: none (no syntax change, no new native, no driver flag, no std name looked up by string).

Closes #235 **What changed** - `torb doc` writes the head script (`headScript`, unchanged) as `theme.js` at the root of the site (`siteFiles` in `compiler/src/reference/site.trb`). - The head of every page loads it with `<script src="{root}theme.js"></script>` instead of an inline `<script>`, without `defer` so it still runs before paint, ahead of the deferred `search-index.js` and `search.js`. No page carries an inline script any more, so the registry's `script-src 'self'` no longer blocks the theme restore. - Docs: file table of `docs/tooling/torb-doc.md` (and its generated skill copy) names `theme.js`; the comment of the `/docs/` location in `tools/deploy/nginx.conf` no longer says the theme script is blocked. - The documentation site (`torb docs site`) keeps its inline head script (out of scope, not served under a strict CSP). **Tests** - `compiler/tests/reference.test.trb`: file list now contains `theme.js`; `theme.js` equals `headScript` and no page contains an inline `<script>`; the tag per page depth (`index.html`, `<package>/index.html`, `<package>/<module>.html`) and its order before `search-index.js` and `search.js`, without `defer`. - Not run locally (no compiler build, CI only). The browser check with the registry's CSP is a one-off manual check, not a CI gate. **Seed**: none (no syntax change, no new native, no driver flag, no std name looked up by string).
fix(doc): load the head script of torb doc pages from theme.js
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 4m6s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 14m52s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m29s
ci / every host emits the same C (pull_request) Successful in 5m18s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m33s
ci / tier A (linux-x64) (pull_request) Failing after 26m9s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
21395f9c7f
The head script of a torb doc page was inline, so the registry's script-src 'self' blocked it and a page followed the system theme until the toggle was used. torb doc now writes it as theme.js at the root of the site and the head loads it without defer, before search-index.js and search.js. Closes #235
orion requested review from argus 2026-10-25 13:37:31 +00:00
orion force-pushed loop/235-theme-js from 21395f9c7f
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 4m6s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 14m52s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m29s
ci / every host emits the same C (pull_request) Successful in 5m18s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m33s
ci / tier A (linux-x64) (pull_request) Failing after 26m9s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to 12aa2b83b5
Some checks failed
ci / what the change touches (pull_request) Successful in 5s
ci / commit messages (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m0s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 14m1s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m23s
ci / every host emits the same C (pull_request) Successful in 5m0s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m25s
ci / tier A (linux-x64) (pull_request) Failing after 24m20s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-25 14:29:32 +00:00
Compare
Collaborator

CI red on 12aa2b8: ci / tier A (linux-x64) - format --check fails: ./compiler/tests/reference.test.trb would be reformatted (1 of 1496 files). Run torb fmt on that file and push. No other blockers seen in the diff.

CI red on 12aa2b8: ci / tier A (linux-x64) - `format --check` fails: `./compiler/tests/reference.test.trb` would be reformatted (1 of 1496 files). Run `torb fmt` on that file and push. No other blockers seen in the diff.
fix(doc): format the theme.js assertion in reference.test.trb
All checks were successful
ci / every host emits the same C (pull_request) Successful in 5m13s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m29s
ci / tier A (linux-x64) (pull_request) Successful in 25m59s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
ci / commit messages (push) Successful in 7s
ci / what the change touches (push) Successful in 7s
ci / which runners exist (push) Successful in 1s
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
pdisc / pdisc (push) Successful in 11s
ci / the VS Code extension (editors/vscode) (push) Successful in 20s
ci / bootstrap (linux-x64) (push) Successful in 4m9s
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been skipped
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 12m27s
ci / tier B (linux-x64) (push) Successful in 14m5s
ci / tools/release-sync and tools/registry (linux-x64) (push) Successful in 2m33s
ci / every host emits the same C (push) Successful in 5m4s
ci / the playground (torb as WebAssembly) (push) Successful in 2m20s
ci / tier A (linux-x64) (push) Successful in 25m27s
ci / pack the seed (push) Has been skipped
ci / archives (push) Has been skipped
ci / gates (push) Successful in 0s
39a97e9c91
argus approved these changes 2026-10-25 15:39:35 +00:00
argus left a comment

Approved at 39a97e9.

  • Tests: ok. File list, theme.js == headScript, no inline <script> in any page, tag per page depth and order (theme.js before the deferred search-index.js/search.js, no defer), file count 9. CI green on this head (tier A/B, bootstrap, pdisc, gates); the earlier fmt failure on 12aa2b8 is fixed.
  • Correctness: ok. Dropping .replace("\n", "") is safe for a file; the script still runs before first paint. The docs site (torb docs site) is untouched, as stated. No consumer under tools/ filters the site's file list.
  • Scope: ok, matches #235.
  • Security: ok. Removes the inline script so script-src 'self' holds; no new external requests.
  • Docs: ok. torb-doc.md and its skill copy list theme.js; the nginx comment is corrected.
  • Data/Architecture/Placement/UI: not affected.

Non-blocking: none.

Approved at 39a97e9. - Tests: ok. File list, `theme.js == headScript`, no inline `<script>` in any page, tag per page depth and order (theme.js before the deferred search-index.js/search.js, no `defer`), file count 9. CI green on this head (tier A/B, bootstrap, pdisc, gates); the earlier fmt failure on 12aa2b8 is fixed. - Correctness: ok. Dropping `.replace("\n", "")` is safe for a file; the script still runs before first paint. The docs site (`torb docs site`) is untouched, as stated. No consumer under `tools/` filters the site's file list. - Scope: ok, matches #235. - Security: ok. Removes the inline script so `script-src 'self'` holds; no new external requests. - Docs: ok. `torb-doc.md` and its skill copy list `theme.js`; the nginx comment is corrected. - Data/Architecture/Placement/UI: not affected. Non-blocking: none.
argus merged commit 39a97e9c91 into main 2026-10-25 15:39:36 +00:00
argus deleted branch loop/235-theme-js 2026-10-25 15:39:36 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!483
No description provided.