Repository navigation
fix(renderer): ship theme scripts as files; render_page names broken surfaces and blocked scripts - #120
Merged
Conversation
…surfaces and blocked scripts Astro inlines component <script>s under assetsInlineLimit, and the Site Worker's script-src 'self' blocked them on deployed sites. The cloudhal() integration now keeps every script chunk a file, and cloudhal dev sends SITE_CSP report-only so the console shows what a deploy would block. render_page gains surface-broken (.ch-surface-problem notes and unknown components in previews) and script-blocked (CSP violations kept by a listener registered before the page's own scripts). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Theme scripts were blocked on deployed sites, and
render_pagedid not notice.<script>underbuild.assetsInlineLimit(4 KB) into the page, and the Site Worker'sscript-src 'self'blocks it. Thecloudhal()integration now setsvite.build.assetsInlineLimittoscriptsNotInlined(…)(csp.ts): script chunks never inline, and other assets keep the project's own limit (number or function). This is cloudhal-dev/cloudhal.com PR chore(deps): Bump the better-auth group across 1 directory with 6 updates #11's workaround, moved into the integration.cloudhal devsendsSITE_CSPasContent-Security-Policy-Report-Onlyon HTML pages without their own policy (newcsp-middleware). The console shows what a deploy would block, and Vite's dev client keeps working. The dev-only middleware list moved intoDEV_MIDDLEWARE; that keepscloudhal()inside the size ratchet, whose baseline is updated.render_page/cloudhal rendergain two checks:surface-broken: a body ```surface fence the preview cannot draw (.ch-surface-problem, with its problems), or a component with an unknown block type or props that do not fit. Theme blocks the preview leaves to the site are not flagged.script-blocked: a script the page's CSP refused, inline (with a sample and line) or by URL, named with its directive. A listener is registered throughPage.addScriptToEvaluateOnNewDocumentbefore the page's own scripts run. Report-only violations (cloudhal dev) are reported as "would be blocked on the site". Static previews, which run no scripts on purpose, are skipped.Tests:
astro-renderer/test/csp.test.ts(the inline-limit function, the integration's Vite config on top of a project limit, the dev middleware).cli/test/render-chrome.test.tscovers both checks in Chrome: an enforced meta CSP, and a report-only header served over HTTP.Checklist
pnpm checkpasses locally (see below)@cloudhal/astro-renderer,@cloudhal/mcp-server,@cloudhal/clipatch)Verified on a local merge of all three gap PRs (fix/collection-index-page, fix/theme-scripts-csp, fix/body-blocks-and-tools; they merge cleanly): Biome, size check, font-fallback and MCP-doc checks, every typecheck, and every package test suite pass, including
@cloudhal/cli(45 files, Chrome render tests included). One exception, not from this change: 35 tests incore-tsstore.test.tson the "Durable Object SQLite (Miniflare)" backend fail withconnect EADDRNOTAVAIL(local port exhaustion).mainfails the same 35 tests on this machine. No Rust or contract change, socargo testwas not run. GitHub Actions runners do not start (billing), so CI red is environmental.🤖 Generated with Claude Code