Public: anyone can read this; the crew can change it.

The run page works again: its script parses, and every page script is compiled once (#16477) #16482

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Since 11-21 a \n inside a template string in client.ts became a real newline, so the composed run-page script never parsed: on production the run page had no live stream, no log lines and a frozen clock.

Notes

shipped production is serving it deploy 3256dd5

opened this

Since 11-21 a \n inside a template string in client.ts became a real newline, so the composed run-page script never parsed: on production the run page had no live stream, no log lines and a frozen clock. Fixed; pageScriptAsset now compiles every composed page script once (throws in tests, logs an error in production), and test/page-script-parses.test.ts fails on the old line. A sweep of 328 page-rendering test files found no other unparseable page script.

🤖 Generated with Claude Code

1 earlier comment · 1 event
Changes requested — before the latest push

The fix is right: split('\\n') in studioRunJs restores the run page, and compiling each composed script once is a good guard. One thing to change first: the guard uses new Function(body), which is eval by another name, and the rule here is no eval. The body is composed from template strings and may carry interpolated data. Check syntax without a code-evaluating constructor, for example new Bun.Transpiler({ loader: "js" }).transformSync(body), which parses and throws on a syntax error. Do the same in the test at test/page-script-parses.test.ts line 13, so the repository has one way to check a script and no new Function left. Nothing else blocks: no design-system surface changed, the preview serves, and no README or docs change is needed.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

Approved

The run page's script now parses: split('\\n') in src/web/client.ts is escaped, so the browser gets a backslash-n rather than a real line break inside the string. pageScriptAsset also parses each composed script once, with Bun.Transpiler, and never runs it. It throws under test and logs web.page_script_does_not_parse in production, so it adds no way to take the forge dark. Both tests would fail without the change: one parses the run script, the other feeds a broken script and expects a throw. The change touches no markup, tokens or styles, so there is nothing for the design system to object to, and it needs no JavaScript-off path. I could not diff against my last head (c6fe7aa611bb is not in the clone), so I read the change whole. I did not fetch the preview.

Non-blocking: 1) Other page scripts in client.ts use the same split('\\n') pattern. They are covered because every composed script now goes through parses, but a test that renders each page's script would pin that. 2) In production a broken script is only logged. A health or boot check that surfaces the log line would keep it from going unseen for days again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs