Skip to content

[experimental] render: every file is the page as a live app, with the page's script always in it - #12039

Merged
josephfarina merged 14 commits into
mainfrom
josephfarina/render-interactive
Nov 17, 2026
Merged

josephfarina merged 14 commits into
mainfrom
josephfarina/render-interactive

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User need

A page made with astryx experimental render was one HTML file that ran no script: a picture of the page. A shared page needs its controls: tabs that switch, a popover or a menu that opens, a dialog, a form, a copy button, a layout that fits the reader's phone (useMediaQuery). In a picture those show and do nothing, and authors either hand-write a separate page (no Astryx, no way back to source) or accept a dead page.

Now the rendered file is the page as a live app, in one file: it carries the page's own script, so every control works as in the app. Everything else render promises stays: still one file, the render adds no network request and no eval, it works in a sandboxed artifact viewer whose frame allows scripts and whose content security policy allows inline scripts (the policy tested below), and --reverse gives the source back byte for byte.

Problem and solution fit

  • The file carries the page's own script, inline after the embedded source: the page's modules and the packages they use, bundled for the browser by esbuild, minified and tree-shaken. The page's own files are compiled exactly as the server compiled them (path aliases, the page's StyleX with the same class names, assets inlined as data: URIs, ?raw/?inline imports), so the browser draws the same page. A module the page loads lazily (lazy(() => import('./panel'))) is compiled with the bundle, and its styles join the stylesheet. Imports resolve the way esbuild resolves them for the browser first, so a package's browser field ("fs": false) and an installed stand-in for a Node module (events) work.
  • The file paints the rendered markup first. The markup sits in one element (#astryx-render-root, display: contents, so it takes no box), and the script draws the live page into it with React's createRoot, so state, effects and event handlers work. Drawing rather than hydrating keeps time-dependent output, charts drawn after the server render, and server-only answers (useMediaQuery returns false) from producing hydration mismatches. A viewer that blocks scripts shows the markup.
  • The stylesheet keeps the rules every class name in the script needs, not only those in the markup, so a menu or the next tab is styled when it opens.
  • In a viewer's sandboxed frame the page works as in the app. A link out of the file opens in a new tab (target="_blank" rel="noopener noreferrer"), in the first paint and once the script runs, since the frame cannot follow it; a link the page handles itself, or that names a target, keeps its way. A form submits through its submit event, which the file fires itself: a frame without allow-forms blocks the browser's own submission before the page's onSubmit runs, and a file has no server to send a form to. A click on a submit button, or Enter in a form's only text field, submits as a browser does; a form whose action is another site's address submits as the browser submits it.
  • There is no option: every render carries the script. A page whose script cannot be built for the browser (a module it loads needs Node, such as node:fs) is refused with ERR_RENDER_SCRIPT, which names the module, and nothing is written.
  • The note at the top says the file runs the page's script. The warnings say what the file does: a media query asked in JavaScript (screen-query) is answered by the server for the first paint and asked again when the script runs, and a chart the render could not draw (chart-size) is painted empty and drawn by the script; a viewer that blocks scripts keeps the first paint, so folding a layout with CSS is still the advice.
  • Only the page's own files and the mount go through esbuild's plugin; esbuild resolves and loads every package file itself. A package file comes back to the plugin only for an import every module must take from one copy (React outside a project) or for a Node module, which is refused. On a small Core page the script build takes about 0.3 s, and a whole render with the script about 0.9 s warm (0.7 s for the markup alone).
  • An image the page names by a string path is carried and the script shows the same data. The script's literal is rewritten only where it is the exact path, and never as text the page shows (children). A path that reaches the page's text through a variable (files.map(f => <figcaption>{f}</figcaption>)) is a known limit: such a caption shows the data: URI once the script draws the page.
  • --static and --interactive, which older docs and agents pass, are answered by the unknown-option path with what to do: " is no longer an option: every render carries the page's script now. Drop the flag and run the command again." (ERR_INVALID_OPTION), with the same command without the flag as the suggestion.
  • esbuild is a dependency of the CLI (^0.28.2). Only experimental render loads it, by dynamic import inside the page's worker, so no other command loads it and startup time is unchanged (lazy-dependencies.test.mjs checks that importing the API loads no esbuild).
  • Two other callers keep showing markup only: the theme editor renders its pages with an internal markup-only option and writes no file, and the docsite's landing previews drop the page's script from the rendered file, since they are pictures.

Current specification

astryx experimental render is experimental (spec:AST-017 FR27): its options, output file and JSON may change in a patch release. The maintainers chose the page's script in every render, with no option to leave it out, and esbuild as a regular dependency of the CLI, loaded only inside experimental render.

Public delta and caller burden

  • Output: every rendered file carries the page's script (experimental, patch release). In the file, a link out opens in a new tab, and a form submits through its submit event, which the file fires (it never navigates).
  • render.page JSON: new scriptBytes and scriptModules; the text output prints the same keys.
  • New dependency esbuild (^0.28.2).
  • New error code ERR_RENDER_SCRIPT (experimental): a module the page's script loads needs Node (node:fs), or cannot be found or compiled for the browser; the message names the module. An install that left esbuild out is ERR_RENDER_MISSING_DEPENDENCY.
  • Render format stays 1: the record gains no field, and released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse a file that carries a script exactly.
  • Unchanged: every stable command, doctor.
  • Caller burden: the file is larger (median 564 KB, largest 2.4 MB across every template); a page that imports a Node-only module now fails instead of rendering as a picture.
  • First run: see Evidence.
astryx experimental render src/app/page.tsx --out page.html

Design and alternatives

  • The script in every render (chosen). Rejected: an opt-in --interactive (most renders would keep dead controls), and a --static option or a fallback to a file with no script (a rendered page must work as the app works; a page whose script cannot be built is an error to fix, not a picture to ship).
  • In a viewer's frame (chosen): the file opens links out in a new tab and fires a form's submit itself. Rejected: leaving both to the browser (a sandboxed frame cannot follow a link out, and without allow-forms it never fires a form's submit, so the reader sees a link or a form that does nothing).
  • Bundler: esbuild as a regular dependency (chosen), the standard bundler that Vite itself uses for dependencies. Rejected: Vite with a single-file plugin (it adds Rollup and Vite on top of esbuild, for the same one-file output); esbuild as an optional peer (most npx and agent runs would have no esbuild); bundling with the CLI's own Babel (no tree-shaking or minifying: a dashboard was 5.7 MB and took 25 s, near the 60 s render limit).
  • Draw over the markup with createRoot (chosen) rather than hydrateRoot: hydration needs renderToString markup and fails on every legitimate difference between the server and the browser (relative times, charts drawn after the server render, useMediaQuery), and React then client-renders the whole root anyway, logging recoverable errors.
  • The script goes after the embedded source, outside the markup a reverse compares, so a hand-edit check and released CLIs read the file as before. </script, <!-- and the embedded block's type name are escaped inside the script (\x3C, \x2d, which mean the same in strings, template literals and regular expressions), and the script is parsed before it is written.

Evidence

Interaction parity with the app (.github/scripts/render-interaction-parity.browser.test.mjs, new CI step): one page with tabs, a popover, a menu, a dialog and a form is built into a Vite app with @astryxdesign/build's Vite plugin, and rendered to one file. Chromium takes the same ten steps in both (click a tab, open the popover, Escape, open the menu, pick an item, open the dialog, Escape, type a name, flip a switch, submit), the file inside a sandbox="allow-scripts" srcdoc frame under default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data: blob:. After every step both show the same thing, the app shows what the step does, and neither logs an error. A second case opens the file in a frame that allows tabs (allow-popups): the link opens a new tab, and the frame keeps the page. Both pass.

A blind check: an agent with no context built its own page with tabs, a popover, a menu, a dialog and a form, ran it as a Vite app, rendered it, and compared every interaction in Chromium at 1280 px and 390 px, the file inside the same frame and policy. Every step matched except submitting the form, which the frame's sandbox blocked before the page's handler ran; the file now fires the submit itself, and the parity check covers it (a click on the submit button and Enter in a field).

Every template the CLI ships (794: page templates and component blocks), rendered in a project, then opened the way an artifact viewer opens HTML, under the same frame and policy:

  • 794/794 render, mount (the script draws the page into its element), reverse byte for byte, carry no absolute path or user name, and say in their note that they run a script; 791/794 give the same bytes when rendered again (3 show the current time by design).
  • 768/794 log no console error. The other 26 are the frame blocking what the page itself does: 15 copy buttons calling the refused async Clipboard API (since fixed in Core by the clipboard fallback), remote favicon images that a render already warns about, an alert(), and focus moved before the reader acts.
  • Clicking up to six controls per page (tabs, switches, buttons, checkboxes, disclosures): 487 pages offer controls, and on 326 a click visibly changed the page.
  • Size per file: median 564 KB (script median 471 KB), largest 2.4 MB; render median 2.1 s on a quiet machine.

(The sweep ran on the same bundling code before the script became the default.)

First-run cost of the new dependency (Linux x64, npm 11.17, Node 24.22; each run with an empty npm cache):

  • npx: 3 alternating runs of npx -p @astryxdesign/cli@<canary> [-p [email protected]] astryx --version. The npm cache grows from 167.5 MB to 179.2 MB (+11.7 MB: the 4.7 MB compressed Linux x64 binary package, esbuild itself, and the metadata npm reads for esbuild's platform packages); the install grows from 81.7 MB to 93.2 MB (+11.6 MB). First run: 10.9 s, 10.7 s, 17.2 s before; 8.8 s, 11.5 s, 9.9 s after, which is within the network's noise. After install, startup does not change: astryx --version 89 ms → 90 ms (median of 6), astryx docs principles 233 ms → 230 ms.
  • A managed install that fetches the CLI's pinned dependency set in parallel: +4.78 MB compressed download (esbuild 0.03 MB, the Linux x64 package 4.74 MB), the installed set +11.6 MB (+3.4%), and install time 3.42 s → 3.27 s (median of 3 alternating runs; no measurable change, since the downloads run in parallel).

Scope

Components: astryx experimental render (foundation/render, api/render, the command, docs and error codes); its two markup-only callers (the theme editor's page renders, the docsite's landing previews); a CI step for the parity check.

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render packages/cli/clients/cli/commands/text-json-parity.test.mjs packages/cli/foundation/doc-compiler packages/cli/assets/docs packages/cli/test/runner-commands.test.mjs packages/cli/test/packed-manifest.test.mjs packages/cli/test/lazy-dependencies.test.mjs packages/cli/foundation/response scripts/npm/published-manifests.test.mjs — render.interactive.test.mjs: report, file structure, note, no machine paths, same bytes, exact reverse and its "Render it again", the file running in jsdom (the button works; a link out opens in a new tab, in the markup and once clicked; a form submits on a click and on Enter), CLI text keys and no option to leave the script out, --title, a package's browser map and an installed events stand-in, a lazily loaded module styled, a Node-only module refused, esbuild a dependency that resolves beside the CLI, a refusal when the install left it out (also through render() in render.interactive-missing.test.mjs), doctor never mentions it, a markup-only render never looks for it.
  • ASTRYX_RENDER_PARITY_BROWSER=1 pnpm exec vitest run .github/scripts/render-interaction-parity.browser.test.mjs after pnpm -F @astryxdesign/build build.
  • Typecheck: strict, template docs, json-api, authoring contract; Prettier and ESLint on the changed files.
  • Released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse a file that carries a script exactly.
  • The 794-template sweep above, from a script outside the repository.

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 12:46pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 1:13 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ef4beae

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 036d91c

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.34 MB packed (+11.8 kB); new dependency: esbuild.

API changes: cli +0 · ~1 · −0

1 API change (advisory)
Package Where Signature Usage
~ cli ./api/experimental · Types · type RenderPageResponse data: { input: string; output: string; bytes: number; files: string[]; stylesheets: string[]; classes: number; cssBytes: number; images: number; warnings: RenderWarning[] } → data: { input: string; output: string; bytes: number; files: string[]; stylesheets: string[]; classes: number; cssBytes: number; images: number; warnings: RenderWarni … #49f620bb import type {RenderPageResponse} from '@astryxdesign/cli/api/experimental'; const x: RenderPageResponse = {data: …}

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: +4.1 job-min per update · pool +2.3% · time to green −31.4 min · standard runners · 1 CI action or script file changed (not measured)
Before After Change
Job-minutes per PR update 182 186.1 +4.1
Runner pool, runner-minutes a day 63,754 65,203 +1,449 (+2.3%)
Average concurrent jobs 44.3 45.3 +1
Time to green (median → this run) 43.5 min 12.1 min −31.4 min
Runs a day 350 350 0

Changed jobs: node-browser-contracts changed: standard

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/render-interaction-parity.browser.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the interactive render works for plain pages, but six defects and one missing test need fixing first.

Blocking

  • --interactive refuses packages that are ready for the browser, because the Node built-in check in client-bundle.mjs runs before resolution for every importer, so a package's browser map ("fs": false) and an installed npm polyfill such as events never apply; resolve the name with build.resolve first and refuse only when that fails.
  • A page module loaded lazily (lazy(() => import('./panel'))) is unstyled in the interactive file, because page-worker.mjs compiles the page's StyleX CSS before the bundle step records that module's rules; compute the CSS after the bundle.
  • The text output prints script: … (N modules), which no JSON key names, and omits interactive, scriptBytes and scriptModules, against the CLI rule that text field names mirror JSON keys; print those keys and add an --interactive case to text-json-parity.test.mjs.
  • The optional peer range >=0.25.0 <1.0.0 makes npm install a second esbuild in projects that already hold an older one (a Vite 6.0 app gets esbuild 0.28.2 at its root) and print an ERESOLVE warning when esbuild <0.25 is a direct dependency, so the docs line "a CLI install does not carry it" is not true; declare a range that excludes nothing npm may find and keep the minimum as a runtime check, or declare no peer.
  • The render guide says copy buttons fall back to the browser's copy command in a sandboxed frame, but Core's useClipboard has no such fallback until #12035 lands; drop the sentence or land it after #12035.
  • esbuild-peer.mjs finds esbuild with require.resolve instead of the existing findInstalledPackage in foundation/fs/paths.mjs, which already finds an installed package with its version and avoids NODE_PATH and global folders; use the shared finder.
  • No test proves that --interactive composes with --title, which the CLI's option rules require for every pair of options; add one.

Smaller points: the API-level install suggestion for a missing esbuild is untested through render(), and "loads nothing from the network and runs no eval" is exact only as "the render adds no network request and no eval".

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the script is inline after the embedded source, bundled, minified and tree-shaken by esbuild: verified (client-bundle.mjs build options, render-page.mjs write order).
  • Claim: the page's own files compile as the server compiled them: verified for aliases, assets and StyleX class names; false for StyleX rules of a lazily loaded module (blocking finding).
  • Claim: the markup paints first inside a display: contents wrapper and createRoot draws the live page: verified (code and jsdom test).
  • Claim: the stylesheet keeps the rules every class name in the script needs: verified for Core and package stylesheets; false for the page's own StyleX in lazily loaded modules.
  • Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
  • Claim: esbuild is an optional peer loaded only by --interactive, found from the page's folder then beside the CLI: verified (render-page.mjs, static-render test).
  • Claim: a CLI install does not grow and a cold npx stays as fast: true for a cold npx; false for npm projects that already hold an esbuild below 0.25.
  • Claim: a missing or out-of-range esbuild writes nothing and names the install command: verified (tests).
  • Claim: a page whose script needs Node stops with ERR_RENDER_INTERACTIVE naming the module: verified, but browser-ready packages are refused too (blocking finding).
  • Claim: --interactive with --reverse is ERR_INVALID_ARGUMENT; new optional JSON fields interactive, scriptBytes, scriptModules: verified (tests, CLI run).
  • Claim: the record gains an optional interactive and the render format stays 1: verified (source-block.mjs).
  • Claim: a render without --interactive is unchanged byte for byte: verified (test).
  • Claim: the script cannot end its element or pose as the embedded source, and it is parsed before it is written: verified (scriptSafe, vm.Script).
  • Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader.
  • Claim: the template sweep, the Chromium sandbox run and the file sizes: not reproduced; a one-button page measured 508 KB here.
  • Claim (docs): copy buttons copy in a sandboxed frame: false at this head (blocking finding).
  • Files: .changeset/render-interactive.md clear; api/render/_adapter.mjs non-blocking test note; api/render/render.doc.mjs clear; api/render/render.interactive.test.mjs missing --title pair test; api/render/render.mjs clear; api/render/render.type.mjs clear; assets/docs/tree/render-pages.doc.mjs false copy and install claims; assets/docs/tree/share-a-page.doc.mjs clear; commands/experimental-render.doc.mjs clear; commands/experimental/render.mjs text/JSON key mismatch; doc-compiler/doc-loads.test.mjs clear; foundation/render/client-bundle.mjs built-in refusal; foundation/render/esbuild-peer.mjs shared finder bypassed; foundation/render/file-header.mjs clear; foundation/render/page-worker.mjs CSS before bundle; foundation/render/render-page.mjs clear; foundation/render/source-block.mjs clear; response/error-codes.doc.mjs clear; response/error-codes.mjs clear; packages/cli/package.json peer range; pnpm-lock.yaml clear.

Automated review (maintainer link)

Comment thread packages/cli/package.json Resolved
@josephfarina
josephfarina force-pushed the josephfarina/render-interactive branch from ef4beae to 5fb3b9f Compare November 16, 2026 09:56
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5fb3b9f

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c8fca50

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the interactive render works as described and every point from the last review is fixed, but one misleading output remains.

Blocking

  • Miss: an --interactive render still adds the screen-query and chart-size warnings (render-page.mjs, the two warnings after const script), which say the file never runs useMediaQuery and that an undrawn chart stays empty, although the file's own script runs the query and draws the chart once it mounts; word both for the interactive file, or drop them when script is set, and add a test for each.

Smaller points, none blocking: the exit-code text still speaks of "the range the CLI declares" though the CLI now declares any version, the --interactive help text and RenderOptions.interactive still say "no network and no dependency", and "a strict content security policy" holds for the script only under a policy that allows inline scripts, the one the description tested.

Claims and files checked

Review mode: full; reason: history

  • Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client bundle build options, write order in the render).
  • Claim: the markup paints first in a display: contents wrapper and the script draws the live page with createRoot: verified (code, jsdom test, a page outside a project clicked here).
  • Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets, ?raw/?inline): verified (one shared compile function).
  • Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test; local and package stylesheets probed here).
  • Claim: a package's browser map and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (test).
  • Claim: the stylesheet keeps the rules every class name in the script needs: verified (kept-rule set).
  • Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
  • Claim: esbuild is an optional peer of any version, loaded only by --interactive, and installing the CLI never adds or moves an esbuild a project has: verified (manifest, static-render test, npm probe with a Vite 6 project).
  • Claim: esbuild is found from the page's folder, then beside the CLI, through the shared package lookup; missing or out of range, the render writes nothing and names the install command in the project's package manager: verified (tests, shared finder and install-command helper).
  • Claim: a page whose script needs Node stops with ERR_RENDER_INTERACTIVE naming the module: verified (test).
  • Claim: --interactive with --reverse is ERR_INVALID_ARGUMENT; the JSON adds interactive, scriptBytes, scriptModules and the text prints the same keys: verified (tests, parity case).
  • Claim: the record gains an optional interactive and the render format stays 1: verified.
  • Claim: a render without --interactive is unchanged: verified (code path and test).
  • Claim: doctor never mentions esbuild: verified (test).
  • Claim: the render adds no network request and no eval: verified for the render; the script runs only where the frame allows scripts and the policy allows inline scripts (non-blocking wording note).
  • Claim: with --interactive, a layout picked with useMediaQuery fits the reader's screen once the script runs: true in the file, contradicted by the render's own warning (blocking finding).
  • Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader.
  • Claim: the template sweep, the Chromium sandbox run and the file sizes: not reproduced; a one-button Astryx counter page carried 412.6 KB of script here.
  • Claim: the copy-button console errors are fixed in Core by #12035: that pull request is still open; this pull request's docs no longer rely on it.
  • Files: .changeset/render-interactive.md clear (policy wording note); api/render/_adapter.mjs clear; api/render/render.doc.mjs clear (policy wording note); api/render/render.interactive-missing.test.mjs clear; api/render/render.interactive.test.mjs clear; api/render/render.mjs clear; api/render/render.type.mjs wording note; assets/docs/tree/render-pages.doc.mjs clear; assets/docs/tree/share-a-page.doc.mjs clear; commands/experimental-render.doc.mjs wording notes; commands/experimental/render.mjs clear; commands/text-json-parity.test.mjs clear; doc-compiler/doc-loads.test.mjs clear; foundation/render/client-bundle.mjs clear; foundation/render/esbuild-peer.mjs clear; foundation/render/file-header.mjs clear; foundation/render/page-worker.mjs clear; foundation/render/render-page.mjs warnings for interactive renders (blocking); foundation/render/source-block.mjs clear; response/error-codes.doc.mjs clear; response/error-codes.mjs clear; packages/cli/package.json clear; pnpm-lock.yaml clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 52c6572

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The interactive render's screen-query and chart-size warnings now describe what the interactive file does, with a test each, and the wording points from the last review are fixed; nothing blocks.

One small point: the description says #12035 fixes the copy-button console errors, but that pull request is still open.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client-bundle.mjs build options; render-page.mjs writes the script after the source block; test).
  • Claim: the markup paints first in a display: contents wrapper and the script draws the live page with createRoot: verified (render-page.mjs body and style, client-bundle.mjs mount, jsdom test).
  • Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets, ?raw/?inline): verified (one shared page compile in page-worker.mjs).
  • Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
  • Claim: a package's browser map and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs resolves first; test).
  • Claim: the stylesheet keeps the rules every class name in the script needs: verified (render-page.mjs kept-rule set).
  • Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
  • Claim: the screen-query and chart-size warnings say what an interactive file does, and that a viewer blocking scripts keeps the first paint: verified (render-page.mjs, two tests, a narrow-screen probe that switches layouts once the script runs).
  • Claim: esbuild is an optional peer of any version, loaded by dynamic import only for --interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json, static-render test).
  • Claim: the render checks >=0.25.0 <1.0.0 itself, looks in the page's folder then beside the CLI through the shared lookup, and when none fits writes nothing and names the install command in the project's package manager: verified (esbuild-peer.mjs, tests).
  • Claim: still one file, with no network request and no eval added by the render, so it runs in a frame that allows scripts under a policy that allows inline scripts: verified for the render; the browser sandbox run was not reproduced.
  • Claim: --reverse gives the source back byte for byte, and --interactive with --reverse is ERR_INVALID_ARGUMENT: verified (tests).
  • Claim: the JSON gains interactive, scriptBytes, scriptModules (and interactive on a reverse), and the text prints the same keys: verified (tests, parity case).
  • Claim: a page whose script needs Node stops with the new ERR_RENDER_INTERACTIVE naming the module; a missing or old esbuild is ERR_RENDER_MISSING_DEPENDENCY with the install command: verified (tests).
  • Claim: the record gains an optional interactive and the render format stays 1: verified (source-block.mjs).
  • Claim: a render without --interactive is unchanged byte for byte: verified (the base and head CLIs wrote identical bytes for the same page).
  • Claim: doctor never mentions esbuild: verified (test).
  • Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
  • Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced; a one-button counter page carried 412.6 KB of script here.
  • Claim: the copy-button errors are fixed in Core by #12035: that pull request is still open (non-blocking).
  • Files: .changeset/render-interactive.md clear; api/render/_adapter.mjs clear; api/render/render.doc.mjs clear; api/render/render.interactive-missing.test.mjs clear; api/render/render.interactive.test.mjs clear; api/render/render.mjs clear; api/render/render.type.mjs clear; assets/docs/tree/render-pages.doc.mjs clear; assets/docs/tree/share-a-page.doc.mjs clear; commands/experimental-render.doc.mjs clear; commands/experimental/render.mjs clear; commands/text-json-parity.test.mjs clear; doc-compiler/doc-loads.test.mjs clear; foundation/render/client-bundle.mjs clear; foundation/render/esbuild-peer.mjs clear; foundation/render/file-header.mjs clear; foundation/render/page-worker.mjs clear; foundation/render/render-page.mjs clear (warnings fixed); foundation/render/source-block.mjs clear; response/error-codes.doc.mjs clear; response/error-codes.mjs clear; packages/cli/package.json clear; pnpm-lock.yaml clear.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the interactive render works as described and every earlier point is fixed, but CI on this head fails the required test check on two tests this change breaks.

  • Found by CI: scripts/npm/published-manifests.test.mjs still expects Core to be the CLI's only peer, so the new optional esbuild peer in packages/cli/package.json fails it; update the test to expect both optional peers and rename it.
  • Found by CI: the new "Keep the controls working" prose in packages/cli/assets/docs/tree/render-pages.doc.mjs repeats share-a-page's "in an artifact viewer that shows HTML in a sandboxed frame" word for word, so packages/cli/test/core-doc-quality.test.mjs fails; reword the sentence or link to share-a-page instead.

Both tests pass on the base branch and fail on this head.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client-bundle.mjs build options; render-page.mjs writes it after the source block; test).
  • Claim: the markup paints first in a display: contents wrapper and the script draws the live page with createRoot: verified (render-page.mjs:1328-1331, client-bundle.mjs:101-103, jsdom test).
  • Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets, ?raw/?inline): verified (one shared compilePageModule in page-worker.mjs).
  • Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
  • Claim: a package's browser map and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs:124; test).
  • Claim: the stylesheet keeps the rules every class name in the script needs: verified (render-page.mjs:1038).
  • Claim: the note, the printed commands, the "Render it again" line and the record keep the interactive mode: verified (tests).
  • Claim: the screen-query and chart-size warnings say what an interactive file does: verified (render-page.mjs:1131, :1151, :1168; tests).
  • Claim: esbuild is an optional peer of any version, loaded by dynamic import only for --interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json, page-worker.mjs, static-render test); it breaks the manifest test above.
  • Claim: the render checks >=0.25.0 <1.0.0 itself, looks in the page's folder then beside the CLI through the shared lookup, and names the install command in the project's package manager: verified (esbuild-peer.mjs, tests).
  • Claim: still one file, with no network request and no eval added by the render, so it runs in a sandboxed frame that allows inline scripts: verified for the render output; the browser sandbox run was not reproduced.
  • Claim: --reverse gives the source back byte for byte, and --interactive with --reverse is ERR_INVALID_ARGUMENT: verified (tests).
  • Claim: the JSON gains interactive, scriptBytes, scriptModules (and interactive on a reverse), and the text prints the same keys: verified (tests, parity case).
  • Claim: a page whose script needs Node stops with ERR_RENDER_INTERACTIVE naming the module; a missing or old esbuild is ERR_RENDER_MISSING_DEPENDENCY with the install command: verified (tests).
  • Claim: the record gains an optional interactive and the render format stays 1: verified (source-block.mjs).
  • Claim: a render without --interactive is unchanged byte for byte: verified (static-render test).
  • Claim: doctor never mentions esbuild: verified (test).
  • Claim: released CLIs reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
  • Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced.
  • Claim: the copy-button errors are fixed in Core by the clipboard fallback pull request: verified, it is now merged.
  • Claim: the listed test, typecheck, README, structure, changeset, Prettier and ESLint runs: lint, typecheck and smoke checks pass in CI; the listed test run leaves out the two failing tests above.
  • Files: .changeset/render-interactive.md clear; api/render/_adapter.mjs clear; api/render/render.doc.mjs clear; api/render/render.interactive-missing.test.mjs clear; api/render/render.interactive.test.mjs clear; api/render/render.mjs clear; api/render/render.type.mjs clear; assets/docs/tree/render-pages.doc.mjs repeated passage (blocking); assets/docs/tree/share-a-page.doc.mjs clear; commands/experimental-render.doc.mjs clear; commands/experimental/render.mjs clear; commands/text-json-parity.test.mjs clear; doc-compiler/doc-loads.test.mjs clear; foundation/render/client-bundle.mjs clear; foundation/render/esbuild-peer.mjs clear; foundation/render/file-header.mjs clear; foundation/render/page-worker.mjs clear; foundation/render/render-page.mjs clear; foundation/render/source-block.mjs clear; response/error-codes.doc.mjs clear; response/error-codes.mjs clear; packages/cli/package.json breaks the manifest test (blocking); pnpm-lock.yaml clear.

Automated review (maintainer link)

Comment thread packages/cli/package.json Resolved
…es esbuild as the CLI's second optional peer; the render guide no longer repeats the share guide
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f980fc7

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. Its run found no room under the CI ceiling and was cancelled before the test, build and docsite jobs started, so it needs a re-run.

Both points from the last review are fixed: the manifest test now expects esbuild as the CLI's second optional peer, and the render guide's new section no longer repeats the share guide, so both tests pass on this head.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client-bundle.mjs:158-178, render-page.mjs:1410; test).
  • Claim: the markup paints first in a display: contents element and the script draws the live page into it with createRoot: verified (render-page.mjs:1328-1331, client-bundle.mjs:101-103; jsdom test; Chromium frames).
  • Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets, ?raw/?inline): verified (one shared compilePageModule in page-worker.mjs).
  • Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
  • Claim: a package's browser map and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs:124-140; test).
  • Claim: the stylesheet keeps the rules every class name in the script needs: verified (render-page.mjs:1038).
  • Claim: the note, the printed commands, the "Render it again" line and the record keep the interactive mode: verified (file-header.mjs, source-block.mjs:119; tests).
  • Claim: the screen-query and chart-size warnings say what an interactive file does: verified (render-page.mjs:1130-1170; tests).
  • Claim: esbuild is an optional peer of any version, loaded by dynamic import only for --interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json, page-worker.mjs:1355, static-render test, manifest test).
  • Claim: the render checks >=0.25.0 <1.0.0 itself, looks in the page's folder then beside the CLI through the shared lookup, and names the install command in the project's package manager: verified (esbuild-peer.mjs:29-80; tests).
  • Claim: still one file, with no network request and no eval added by the render, so it runs in a sandboxed frame that allows inline scripts: verified for the render output and in Chromium with no request or console error; the description's viewer-policy run was not reproduced.
  • Claim: --reverse gives the source back byte for byte, and --interactive with --reverse is ERR_INVALID_ARGUMENT: verified (render.mjs:58; tests).
  • Claim: the JSON gains interactive, scriptBytes, scriptModules (and interactive on a reverse), and the text prints the same keys: verified (tests, parity case).
  • Claim: a page whose script needs Node stops with ERR_RENDER_INTERACTIVE naming the module; a missing or old esbuild is ERR_RENDER_MISSING_DEPENDENCY with the install command: verified (tests).
  • Claim: the record gains an optional interactive and the render format stays 1: verified (source-block.mjs).
  • Claim: a render without --interactive is unchanged byte for byte: verified (static-render test; first paint identical in Chromium).
  • Claim: doctor never mentions esbuild: verified (test).
  • Claim: released CLIs reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
  • Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced; a counter page measured 496.6 KB, 412.6 KB of it script.
  • Claim: the copy-button errors are fixed in Core by the clipboard fallback pull request: verified, it is merged.
  • Claim: the listed tests and checks pass: verified for the render, docs, response, CLI test folder and npm manifest suites, and Lint passes in CI; the typecheck, README and structure checks were not reproduced, and CI has not run them on this head.
  • Files: .changeset/render-interactive.md clear; api/render/_adapter.mjs clear; api/render/render.doc.mjs clear; api/render/render.interactive-missing.test.mjs clear; api/render/render.interactive.test.mjs clear; api/render/render.mjs clear; api/render/render.type.mjs clear; assets/docs/tree/render-pages.doc.mjs clear (repeated passage fixed); assets/docs/tree/share-a-page.doc.mjs clear; commands/experimental-render.doc.mjs clear; commands/experimental/render.mjs clear; commands/text-json-parity.test.mjs clear; doc-compiler/doc-loads.test.mjs clear; foundation/render/client-bundle.mjs clear; foundation/render/esbuild-peer.mjs clear; foundation/render/file-header.mjs clear; foundation/render/page-worker.mjs clear; foundation/render/render-page.mjs clear; foundation/render/source-block.mjs clear; response/error-codes.doc.mjs clear; response/error-codes.mjs clear; packages/cli/package.json clear; pnpm-lock.yaml clear; scripts/npm/published-manifests.test.mjs clear (expects both optional peers).

Automated review (maintainer link)

The page's script is always in the file: no --static or --interactive.
esbuild becomes a dependency of the CLI, loaded only inside render. In a
viewer's sandboxed frame, a link out of the file opens in a new tab and a
form submits through its submit event, which the file fires itself. A page
whose script cannot be built is refused with ERR_RENDER_SCRIPT. A browser
check compares every interaction in the file against the same page built
as a Vite app.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): every astryx experimental render carries the page's script, so the file behaves like the app in one HTML file. There is no --static mode, no --interactive mode and no script-less fallback. A page whose script cannot be built is refused with ERR_RENDER_SCRIPT, which names the module and what to change. The JSON drops interactive and always carries scriptBytes and scriptModules, which is acceptable on this experimental surface. Passing the removed --static or --interactive gets an error that says every render carries the script now and to drop the flag, because older docs and agents still pass --interactive. esbuild becomes a regular dependency, loaded only in render's worker, and the first-run cost is in the description.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5483d54

# Conflicts:
#	packages/cli/api/theme-edit/_parts.mjs
#	packages/cli/foundation/render/render-page.mjs
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 700caaa

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8676817

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the rendered file works as a live app for ordinary pages, but three defects need fixing first.

  • A page whose script throws in a sandboxed viewer frame loses its first paint and shows an empty page, because createRoot clears the markup and an uncaught error unmounts the root (client-bundle.mjs:156), so keep the first paint when the script fails (an error boundary or onUncaughtError that restores the saved markup), add a test for a page that writes localStorage in an effect, and name storage among what a frame blocks in the render guide.
  • --static and --interactive are refused with ERR_INVALID_ARGUMENT, while every other option the command does not take answers ERR_INVALID_OPTION, so answer ERR_INVALID_OPTION (experimental/render.mjs:49) and agents that branch on the code treat them like any unknown flag.
  • Miss: a syntax error in a module the page loads lazily comes back as ERR_RENDER_SCRIPT with the author's absolute path, the importer's line and, in a terminal or CI, a coloured code frame, while the same error in a static import is ERR_RENDER_COMPILE naming the file and line, so report it the way the server render does (client-bundle.mjs:243).

Non-blocking: response-types.doc.mjs does not list scriptBytes and scriptModules, and some test descriptions still describe the opt-in design. CI has passed so far on this head, with four test shards still running.

Claims and files checked

Review mode: incremental; reason: none

Changed rules (0): none

Claims:

  • Changeset: the file is the page as a live app and its controls work as in the app: verified for ordinary pages (button and form cases in render.interactive.test.mjs pass); false for a page whose script throws in a sandboxed frame (first blocking finding)
  • Changeset: the script is inline after the embedded source, bundled by esbuild: verified (render-page.mjs:1378 and :1454; render.notes.test.mjs)
  • Changeset: the file paints its markup first, then the script draws over it: verified (client-bundle.mjs:156; jsdom case)
  • Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts: one file and no request verified (render.test.mjs); works in the frame is false for pages that touch storage (first blocking finding)
  • Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases in render.interactive.test.mjs)
  • Changeset: a link out opens a new tab and a form submits through its submit event: verified (render-page.mjs:705; client-bundle.mjs:33-71; jsdom form case)
  • Changeset: a page whose script cannot be built is refused with ERR_RENDER_SCRIPT naming the module: verified for a module that needs Node (node:fs case); a lazily loaded module's syntax error gets that code with a machine path (third blocking finding)
  • Changeset: esbuild is a new CLI dependency that only the render loads: verified (package.json:137 from the catalog's ^0.28.2; lazy-dependencies.test.mjs)
  • Changeset: the JSON adds scriptBytes and scriptModules: verified (_adapter.mjs:526-527; render.mjs:85-86)
  • Changeset: the credit line names the author: verified
  • Description: the file shows the same as the app after the same clicks, keys and typing in a sandboxed frame: verified for the parity page (the parity browser step passed in CI at this head)
  • Description: the page's files compile as the server compiled them, a lazily loaded module is styled, a package's browser map and an installed stand-in work: verified (cases in render.interactive.test.mjs)
  • Description: the stylesheet keeps the rules for class names the script holds: verified (render-page.mjs:1080)
  • Description: the note and the screen-query and chart-size warnings describe the script: verified (file-header.mjs; render-page.mjs:1177, :1197, :1214; warning tests)
  • Description: there is no option to leave the script out: verified; the removed flags answer the wrong error code (second blocking finding)
  • Description: the theme editor stays markup-only and the docsite previews drop the script: verified (theme-edit/_parts.mjs:653; generate-landing-template-previews.mjs:153, :192)
  • Description: render format stays 1 and the record gains no field: verified (record fields unchanged; only the hashed markup includes the wrapper)
  • Description: the template sweep, file sizes, first-run install cost and released-CLI reverses: not reproduced
  • Description: copy buttons were since fixed in Core by a clipboard fallback: verified on main (useClipboard.ts); not part of this branch

Files:

  • packages/cli/foundation/render/client-bundle.mjs: first and third blocking findings; link-out pattern duplicated (non-blocking)
  • packages/cli/clients/cli/commands/experimental/render.mjs: second blocking finding
  • packages/cli/foundation/render/page-worker.mjs: third blocking finding (the error is passed on as it is); merge resolution clear
  • packages/cli/foundation/render/render-page.mjs: clear (link-out pattern duplicated, non-blocking); merge resolution clear
  • packages/cli/foundation/render/esbuild-dependency.mjs: clear
  • packages/cli/foundation/render/file-header.mjs: clear
  • packages/cli/api/render/_adapter.mjs: clear
  • packages/cli/api/render/render.doc.mjs: clear
  • packages/cli/api/render/render.type.mjs: clear
  • packages/cli/clients/cli/commands/experimental-render.doc.mjs: clear
  • packages/cli/foundation/response/error-codes.mjs: clear
  • packages/cli/foundation/response/error-codes.doc.mjs: clear
  • packages/cli/api/theme-edit/_parts.mjs: clear; merge resolution keeps both options
  • apps/docsite/scripts/generate-landing-template-previews.mjs: clear
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: should name storage among what a frame blocks (part of the first finding)
  • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear
  • .changeset/render-interactive.md: claim narrowed by the first finding; credit line clear
  • packages/cli/package.json: clear
  • pnpm-lock.yaml: clear
  • .github/workflows/ci.yml: clear
  • .github/scripts/render-interaction-parity.browser.test.mjs: clear
  • packages/cli/api/render/render.interactive.test.mjs: stale header text (non-blocking); the refusal test needs the new code
  • packages/cli/api/render/render.interactive-missing.test.mjs: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/foundation/render/render.test.mjs: clear
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: stale runner descriptions (non-blocking)
  • packages/cli/test/lazy-dependencies.test.mjs: clear

Automated review (maintainer link)

…nt, string-path images keep showing, and a lazy module's compile error names its file
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f346546

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the three issues from the last review are fixed at this head, but the required Node test legs fail.

  • Regression: every test-node leg fails with "Node legs over budget", because render.interactive.test.mjs, render.interactive-missing.test.mjs and render-interaction-parity.browser.test.mjs have no recorded time in scripts/vitest-node-durations.json, so the planner books each at 12.9 s and the longest of the 8 legs plans 1389.1 s against the 1386.7 s budget (main alone plans 1384.4 s); record their times there (the parity file is skipped in the Node legs and the missing-esbuild case takes milliseconds) or speed up the render tests, then rerun CI.

Non-blocking: withCarriedPaths also rewrites a string shown as text when it equals an inlined image path, so a caption that names ./photo.png turns into the image's data URI once the script runs; and doc-loads.test.mjs:441 and :453 still describe the opt-in design. The rest of CI passed at this head, the parity browser step included.

Claims and files checked

Review mode: incremental; reason: none

Changed rules (0): none

Claims:

  • Changeset: the file is the page as a live app and its controls work as in the app: verified (counter and form cases in render.interactive.test.mjs; two clicks count to 2 in Chromium in a sandboxed frame)
  • Changeset: the script is inline after the embedded source, bundled by esbuild: verified (render-page.mjs:1486; client-bundle.mjs)
  • Changeset: the file paints its markup first, then the script draws over it: verified (client-bundle.mjs:162-169; jsdom case)
  • Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (render.test.mjs one-file case; Chromium under the parity test's policy)
  • Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases)
  • Changeset: a link out opens a new tab and a form submits through its submit event: verified (render-page.mjs:705; client-bundle.mjs:37; jsdom form case)
  • Changeset: a page whose script cannot be built is refused with ERR_RENDER_SCRIPT naming the module: verified (node:fs case)
  • Changeset: esbuild is a new CLI dependency that only the render loads: verified (packed manifest esbuild: ^0.28.2; lazy-dependencies.test.mjs)
  • Changeset: the JSON adds scriptBytes and scriptModules: verified (_adapter.mjs:526-527; render.mjs:85-86)
  • Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (storage case in jsdom; a storage effect and a render throw in Chromium)
  • Changeset: an image named by a string path keeps showing once the script draws, and a srcSet image is carried: verified (image case; the first paint now inlines React's srcSet); the rewrite also changes equal strings shown as text (non-blocking)
  • Changeset: a lazily loaded page file that does not compile is refused as a static import is, with ERR_RENDER_COMPILE naming the file and line: verified (lazy case; the CLI with CI set prints no colour and no machine path)
  • Changeset: the credit line names the author: verified
  • Description: the page's files are compiled as the server compiled them, so the browser draws the same page: verified for the compile (page-worker.mjs, compilePageModule(…, true)); see the non-blocking rewrite note
  • Description: a lazily loaded module is styled, a package's browser map and an installed stand-in work: verified (cases in render.interactive.test.mjs)
  • Description: the stylesheet keeps the rules for class names the script holds: verified (render-page.mjs:1112)
  • Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (client-bundle.mjs:37-75; jsdom Enter case)
  • Description: there is no option to leave the script out, and the removed flags are refused: verified (--static and --interactive answer ERR_INVALID_OPTION, as an unknown option does)
  • Description: the note and the screen-query and chart-size warnings describe the script: verified (file-header.mjs:67; render-page.mjs:1208, :1228, :1245; warning tests)
  • Description: the theme editor stays markup-only and the docsite previews drop the script: verified (theme-edit/_parts.mjs:653; generate-landing-template-previews.mjs:153, :192)
  • Description: render format stays 1 and released CLIs reverse a file with a script: the record gains no field and the base reader stops the markup at the embedded source (source-block.mjs:262-267); the released CLIs were not run
  • Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
  • Description: the template sweep, file sizes and first-run install cost: not reproduced (a one-button page measured 513 KB here)
  • Description: interaction parity with the app in a sandboxed frame: verified (the parity browser step passed in CI at this head)
  • Description: copy buttons were since fixed in Core by a clipboard fallback: verified on main (useClipboard.ts); not part of this branch

Files:

  • packages/cli/api/render/render.interactive.test.mjs: blocking finding (no recorded time; Node leg plan over budget)
  • packages/cli/api/render/render.interactive-missing.test.mjs: blocking finding (same)
  • .github/scripts/render-interaction-parity.browser.test.mjs: blocking finding (same)
  • packages/cli/foundation/render/render-page.mjs: non-blocking (the image path rewrite reaches strings shown as text)
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: non-blocking (opt-in wording)
  • packages/cli/foundation/render/client-bundle.mjs: clear
  • packages/cli/foundation/render/page-worker.mjs: clear
  • packages/cli/foundation/render/esbuild-dependency.mjs: clear
  • packages/cli/foundation/render/file-header.mjs: clear
  • packages/cli/foundation/render/render.test.mjs: clear
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear
  • packages/cli/clients/cli/commands/experimental-render.doc.mjs: clear
  • packages/cli/api/render/_adapter.mjs: clear
  • packages/cli/api/render/render.doc.mjs: clear
  • packages/cli/api/render/render.type.mjs: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/api/theme-edit/_parts.mjs: clear
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear
  • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear
  • packages/cli/foundation/response/error-codes.mjs: clear
  • packages/cli/foundation/response/error-codes.doc.mjs: clear
  • packages/cli/foundation/response/response-types.doc.mjs: clear
  • packages/cli/package.json: clear
  • packages/cli/test/lazy-dependencies.test.mjs: clear
  • pnpm-lock.yaml: clear
  • .github/workflows/ci.yml: clear
  • apps/docsite/scripts/generate-landing-template-previews.mjs: clear
  • .changeset/render-interactive.md: clear

Automated review (maintainer link)

* @param {Map<string, string>} rewrites
* @returns {string}
*/
export function withCarriedPaths(script, rewrites) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this rewrites every string in the bundle that equals an inlined image path, not only the ones that reach an image. files.map(f => <figure><img src={f} /><figcaption>{f}</figcaption></figure>) with './photo.png' paints the caption ./photo.png, then the script draws the image's whole data URI as the caption. Mapping the value only where it reaches src, srcset or poster (for example when React sets the attribute) keeps text as the page wrote it.

…on answer, recorded test times

- The page's script build sends only the page's own files and the mount
  through esbuild's plugin; esbuild resolves and loads every package file
  itself (about 1.2 s to 0.3 s for a small page).
- --static and --interactive are answered by the unknown-option path
  (ERR_INVALID_OPTION, with what to do), not hidden options, so the
  command's options match its doc.
- withCarriedPaths leaves text the page shows (children) as written.
- Recorded Node times for the render's new test files.
# Conflicts:
#	packages/cli/clients/cli/commands/experimental-render.doc.mjs
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 236ff3e

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the unrecorded test times from the last review are fixed at this head, but the reworked script build breaks how a refused script names its file.

  • ERR_RENDER_SCRIPT now names the page's file as ../astryx-page:<absolute path>/src/page.tsx:1: (client-bundle.mjs:320-334), because the page's files moved into esbuild's astryx-page namespace and that prefix is resolved as a path; strip the astryx-page:/astryx-mount: prefix before describe(path.resolve(…)), and assert in render.interactive.test.mjs that the node:fs refusal and a lazy missing import name no absolute path.

The required test-node legs still fail at this head, but on main's own leg plan (main alone plans its longest Node leg at 1394 s against the 1387 s budget), not because of this pull request. Non-blocking: the image-path rewrite still turns a caption into the image's data URI when the path reaches text through a variable, as in files.map(f => <figcaption>{f}</figcaption>). The parity browser step passed at this head.

Claims and files checked

Review mode: full; reason: merge-touches-pr-files

Changed rules (0): none

Claims:

  • Changeset: the file is the page as a live app and its controls work as in the app: verified (a tabs-and-button page switches tabs and counts clicks in Chromium in a sandboxed frame; the parity browser step passed in CI at this head)
  • Changeset: the script is inline after the embedded source, bundled by esbuild: verified (render-page.mjs:1493; client-bundle.mjs)
  • Changeset: the file paints its markup first, then the script draws the live page over it: verified (client-bundle.mjs mount with createRoot on #astryx-render-root)
  • Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (one-file case in render.test.mjs; Chromium under the parity test's policy with every other request blocked)
  • Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases in render.interactive.test.mjs)
  • Changeset: a link out opens a new tab and a form submits through its submit event: verified (render-page.mjs:1013; the viewer script in client-bundle.mjs; jsdom form case)
  • Changeset: a page whose script cannot be built is refused with the new error code, which names the module: false at this head (refused, but the message names the file through the bundler's namespace and its absolute path; blocking)
  • Changeset: esbuild is a new CLI dependency that only the render loads: verified (package.json catalog entry; lazy-dependencies.test.mjs)
  • Changeset: the JSON adds scriptBytes and scriptModules: verified (_adapter.mjs:542-543; experimental/render.mjs:89-90)
  • Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (error boundary in client-bundle.mjs; jsdom storage case)
  • Changeset: an image named by a string path in src or srcSet keeps showing once the script draws, and srcSet is carried: verified (image case); the rewrite still changes some equal strings shown as text (non-blocking)
  • Changeset: a lazily loaded page file that does not compile is refused as a static import is, naming its file and line: verified (lazy compile case)
  • Changeset: the credit line names the author: verified
  • Description: the page's own files are compiled as the server compiled them: verified (compilePageModule(…, true) in page-worker.mjs)
  • Description: a lazily loaded module is bundled and styled; a package's browser map and an installed stand-in work: verified (cases in render.interactive.test.mjs)
  • Description: drawing with createRoot instead of hydrating, and a viewer that blocks scripts shows the markup: verified
  • Description: the stylesheet keeps the rules for class names the script holds: verified (render-page.mjs:1119)
  • Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (the viewer script's keydown handler and its other-site check)
  • Description: there is no option to leave the script out, and a refusal writes nothing: verified; that the refusal names the module: false (as above)
  • Description: the note and the screen-query and chart-size warnings describe the script: verified (file-header.mjs; render-page.mjs:1215, :1235, :1252; warning tests)
  • Description: only the page's files and the mount go through esbuild's plugin, and a package file returns to it only for a single-copy import or a Node module: verified (client-bundle.mjs:253-262)
  • Description: the script build takes about 0.3 s and a whole render about 0.9 s warm: not reproduced
  • Description: the removed flags are answered through the unknown-option path with what to do and the same command without the flag: verified (stray-option.mjs:286-331; CLI run)
  • Description: esbuild ^0.28.2 is a CLI dependency loaded only in the page's worker, so startup is unchanged: dependency verified (workspace catalog); the startup timings not reproduced
  • Description: the theme editor stays markup-only and the docsite previews drop the script: verified (theme-edit/_parts.mjs; generate-landing-template-previews.mjs)
  • Description: render format stays 1 and released CLIs reverse a file with a script: the record gains no field and the reader stops the markup at the embedded source (source-block.mjs:262-267); the released CLIs were not run
  • Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
  • Description: the template sweep, file sizes and first-run install cost: not reproduced (a tabs-and-button page measured 547 KB here)
  • Description: interaction parity with the app in a sandboxed frame: verified (the parity browser step passed 2/2 in CI at this head)

Files:

  • packages/cli/foundation/render/client-bundle.mjs: blocking finding (the refused script's message and module name carry the bundler namespace and an absolute path)
  • packages/cli/foundation/render/render-page.mjs: non-blocking (the image-path rewrite still reaches some text)
  • packages/cli/api/render/render.interactive.test.mjs: clear (the Node-module case checks only the readable part of the message; part of the fix)
  • packages/cli/foundation/render/page-worker.mjs: clear
  • packages/cli/foundation/render/esbuild-dependency.mjs: clear
  • packages/cli/foundation/render/file-header.mjs: clear
  • packages/cli/foundation/render/render.test.mjs: clear
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear
  • packages/cli/clients/cli/lib/stray-option.mjs: clear
  • packages/cli/clients/cli/commands/experimental-render.doc.mjs: clear
  • packages/cli/api/render/_adapter.mjs: clear
  • packages/cli/api/render/render.doc.mjs: clear
  • packages/cli/api/render/render.type.mjs: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/api/render/render.interactive-missing.test.mjs: clear
  • packages/cli/api/theme-edit/_parts.mjs: clear
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear
  • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear
  • packages/cli/foundation/response/error-codes.mjs: clear
  • packages/cli/foundation/response/error-codes.doc.mjs: clear
  • packages/cli/foundation/response/response-types.doc.mjs: clear
  • packages/cli/package.json: clear
  • packages/cli/test/lazy-dependencies.test.mjs: clear
  • pnpm-lock.yaml: clear
  • scripts/vitest-node-durations.json: clear
  • .github/workflows/ci.yml: clear
  • .github/scripts/render-interaction-parity.browser.test.mjs: clear
  • apps/docsite/scripts/generate-landing-template-previews.mjs: clear
  • .changeset/render-interactive.md: clear

Automated review (maintainer link)

esbuild names a page file with its build namespace (astryx-page:/…); the
message now strips it, and the mount, the render's own module, names no
file. Tests: the node:fs refusal and a lazily loaded missing module name
no machine path and no namespace.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 036d91c

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. Its run found no room under the CI ceiling and was cancelled, so the CI workflow needs a re-run that passes before this merges.

The refused-script message now names the page's file without a machine path or the bundler's namespace, and the new tests for the node:fs refusal and a missing lazy import cover it. Non-blocking: the image-path rewrite still turns a caption into the image's data URI when the path reaches text through a variable, as in files.map(f => <figcaption>{f}</figcaption>).

Claims and files checked

Review mode: incremental; reason: none

Changed rules (0): none

Claims:

  • Changeset: the file is the page as a live app and its controls work as in the app: verified (in Chromium in a sandboxed frame at this head, the tab switches and the button counts; jsdom cases in render.interactive.test.mjs)
  • Changeset: the script is inline after the embedded source, bundled by esbuild: verified (render-page.mjs:1493; client-bundle.mjs)
  • Changeset: the file paints its markup first, then the script draws the live page over it: verified (createRoot on #astryx-render-root, client-bundle.mjs:216)
  • Changeset: one file, with no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (one-file case in render.test.mjs; Chromium under the parity test's policy with every other request blocked)
  • Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (the markup stays in the body; reverse cases in render.interactive.test.mjs)
  • Changeset: a link out opens a new tab, and a form submits through its submit event: verified (render-page.mjs:705; the viewer script in client-bundle.mjs; jsdom form case)
  • Changeset: a page whose script cannot be built is refused with the new error code, which names the module: verified (the node:fs and missing-lazy-import cases name the page's file; both tests fail on the last reviewed code and pass here)
  • Changeset: esbuild is a new CLI dependency that only the render loads: verified (package.json; lazy-dependencies.test.mjs)
  • Changeset: the JSON adds scriptBytes and scriptModules: verified (_adapter.mjs:542-543; experimental/render.mjs:89-90)
  • Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (error boundary in client-bundle.mjs; jsdom storage case)
  • Changeset: an image named by a string path in src or srcSet keeps showing once the script draws, and srcSet is carried: verified (image case); the rewrite still changes some equal strings shown as text (non-blocking)
  • Changeset: a lazily loaded page file that does not compile is refused as a static import is, naming its file and line: verified (lazy compile case)
  • Changeset: the credit line names the author: verified
  • Description: the page's own files are compiled as the server compiled them: verified (compilePageModule(…, true) in page-worker.mjs)
  • Description: a lazily loaded module is bundled and styled, and a package's browser map and an installed stand-in work: verified (cases in render.interactive.test.mjs)
  • Description: the page is drawn with createRoot instead of hydrated, and a viewer that blocks scripts shows the markup: verified
  • Description: the stylesheet keeps the rules for class names the script holds: verified (render-page.mjs:1119)
  • Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (the viewer script's keydown handler and its other-site check)
  • Description: there is no option to leave the script out, and a refusal writes nothing and names the module: verified
  • Description: the note and the screen-query and chart-size warnings describe the script: verified (file-header.mjs; the warning cases)
  • Description: only the page's files and the mount go through esbuild's plugin: verified (client-bundle.mjs:266-299)
  • Description: a whole render takes about 0.9 s warm, against 0.7 s for the markup alone: consistent (a tabs-and-button page renders in about 0.9 s on the head and 0.75 s on the base); the 0.3 s script build alone was not measured
  • Description: the image-path rewrite touches only the exact path and never children, and a path that reaches text through a variable is a known limit: verified (withCarriedPaths and its unit test; the limit reproduces)
  • Description: the removed flags get an answer that says what to do, with the same command without the flag: verified (stray-option.mjs:286-331; CLI case)
  • Description: esbuild ^0.28.2 is a regular dependency loaded only by dynamic import in the page's worker, so startup is unchanged: dependency and dynamic import verified; the startup timings were not reproduced
  • Description: the theme editor stays markup-only and the docsite previews drop the script: verified (theme-edit/_parts.mjs; generate-landing-template-previews.mjs)
  • Description: a missing esbuild install is refused as a missing dependency: verified (render.interactive-missing.test.mjs and the esbuildFrom case)
  • Description: render format stays 1, and released CLIs reverse a file that carries a script exactly: verified for 0.7.10 and 0.7.15 (exact, source byte-identical); 0.7.12 was not run
  • Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
  • Description: files grow to a median of 564 KB and at most 2.4 MB: consistent (547 KB for a tabs-and-button page); the template sweep was not reproduced
  • Description: the interaction parity browser check passes: it passed in CI at the previous revision, and this push does not change what it exercises; CI has not run it at this head
  • Description: public text and artifacts carry no internal context: verified
  • Description: the blind check, the template sweep and the first-run install cost: run outside the repository and not reproduced

Files:

  • packages/cli/foundation/render/client-bundle.mjs: clear (the error now names the page's file)
  • packages/cli/api/render/render.interactive.test.mjs: clear (the new assertions fail on the last reviewed code)
  • packages/cli/foundation/render/render-page.mjs: non-blocking (the image-path rewrite still reaches some text)
  • packages/cli/foundation/render/page-worker.mjs: clear
  • packages/cli/foundation/render/esbuild-dependency.mjs: clear
  • packages/cli/foundation/render/file-header.mjs: clear
  • packages/cli/foundation/render/render.test.mjs: clear
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear
  • packages/cli/clients/cli/lib/stray-option.mjs: clear
  • packages/cli/clients/cli/commands/experimental-render.doc.mjs: clear
  • packages/cli/api/render/_adapter.mjs: clear
  • packages/cli/api/render/render.doc.mjs: clear
  • packages/cli/api/render/render.type.mjs: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/api/render/render.interactive-missing.test.mjs: clear
  • packages/cli/api/theme-edit/_parts.mjs: clear
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear
  • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear
  • packages/cli/foundation/response/error-codes.mjs: clear
  • packages/cli/foundation/response/error-codes.doc.mjs: clear
  • packages/cli/foundation/response/response-types.doc.mjs: clear
  • packages/cli/package.json: clear
  • packages/cli/test/lazy-dependencies.test.mjs: clear
  • pnpm-lock.yaml: clear
  • scripts/vitest-node-durations.json: clear
  • .github/workflows/ci.yml: clear
  • .github/scripts/render-interaction-parity.browser.test.mjs: clear
  • apps/docsite/scripts/generate-landing-template-previews.mjs: clear
  • .changeset/render-interactive.md: clear

Automated review (maintainer link)

@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina
josephfarina merged commit 48dc5d7 into main Nov 17, 2026
204 of 237 checks passed
@github-actions
github-actions Bot deleted the josephfarina/render-interactive branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 036d91c8 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant