webviews: gallery reads Swift backslashes in WebTheme.bootstrapScript (base red)

Merged
TE
22d ago
+46-4

Problem

Every gallery page on feat-cmux-next answers 500: gallery: bootstrapScript has Swift escapes; extend the reader. The color transition change (cx-3rf4z, c8fd02b62b35d) added an rgba parser to WebTheme.bootstrapScript whose regular expression is written with Swift-escaped backslashes (\\(, \\s, \\d). The gallery's reader (dev-server/galleryHost.ts) refused any backslash, so the browser-lane tests that load the gallery (react-apps-check) cannot run.

Change

readWebThemeBootstrap now reads a Swift \\ as one backslash, as Swift does, so the gallery runs the same script as the app. Any other escape (\n, \t, \") or an interpolation (\() still stops the reader.

Verified

  • bun test test/gallery-web-theme-bootstrap.test.ts: the app's script parses as JavaScript, a \\ fixture comes out as one backslash and its regular expression matches, and the other escapes still throw. The first commit adds the test alone (red on the current base), the second the fix.
  • The gallery dev server serves /gallery/frame.html?entry=agent-pane.composer&variant=picker-toggle again (it returned 500 before).

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the gallery 500 errors on feat-cmux-next by making readWebThemeBootstrap read a Swift \\ as one backslash, so the gallery runs the same script as the app. Any other Swift escape or interpolation still stops the reader, and the attached test now parses the script through node:vm rather than implied eval. Also applies the type-scale weight to the tab overflow hint button.