Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(page-audit): let the sweep run in WebKit and Firefox, not just Chromium

nirholas58cbb4bc9702
diff --git a/docs/ops/page-audit.md b/docs/ops/page-audit.md
index fd2139722..e8882b0e3 100644
--- a/docs/ops/page-audit.md
+++ b/docs/ops/page-audit.md
@@ -48,8 +48,35 @@ node scripts/page-audit.mjs --mobile-only # skip the desktop viewport
node scripts/page-audit.mjs --concurrency 6 # parallel pages per viewport
node scripts/page-audit.mjs --strict # exit 1 on any error-severity finding
node scripts/page-audit.mjs --reverify-cap 0 # skip the solo re-check pass
+node scripts/page-audit.mjs --engine webkit # audit in Safari's engine
```
+## Engines: why Chromium alone is not enough
+
+`--engine` picks the renderer: `chromium` (default), `webkit`, or `firefox`.
+
+Chromium is the default because it is the only browser every machine here
+already has. It cannot, on its own, see a class of bug that only Safari shows.
+JavaScriptCore and V8 disagree about *when* a temporal dead zone is checked:
+JavaScriptCore checks an assignment target before it evaluates the right-hand
+side, V8 checks it afterwards. So a module that bootstraps itself above the
+`let`s it writes renders perfectly in Chrome and throws
+`Cannot access uninitialized variable.` in every Safari, desktop and iOS alike.
+
+That is not hypothetical. It is how every `/avatars/:id` page shipped dead in
+Safari while this audit, the production smoke sweep, and review all stayed
+green. `npm run check:tdz-bootstrap` now refuses that ordering at build time
+(it runs inside `build:gcp`), and a WebKit pass here catches the runtime half:
+
+```sh
+npx playwright install webkit # one time
+node scripts/page-audit.mjs --engine webkit --desktop-only --strict
+```
+
+Run a WebKit pass before any release that touched page-level JavaScript. It is
+worth the extra minutes precisely because nothing else in the pipeline looks at
+a non-V8 engine.
+
## Targeting
`BASE_URL` selects the target and defaults to production:
diff --git a/scripts/page-audit.mjs b/scripts/page-audit.mjs
index bcd0b8cf4..13ab36724 100644
--- a/scripts/page-audit.mjs
+++ b/scripts/page-audit.mjs
@@ -43,8 +43,9 @@
* node scripts/page-audit.mjs --mobile-only # skip the desktop viewport
* node scripts/page-audit.mjs --concurrency 6 # parallel pages per viewport
* node scripts/page-audit.mjs --strict # exit 1 if any error-severity finding
+ * node scripts/page-audit.mjs --engine webkit # audit in Safari's engine instead
*/
-import { chromium, devices } from 'playwright';
+import { chromium, webkit, firefox, devices } from 'playwright';
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -74,6 +75,21 @@ const DESKTOP_ONLY = flag('desktop-only');
const MOBILE_ONLY = flag('mobile-only');
const STRICT = flag('strict');
const CONCURRENCY = Math.max(1, Number(opt('concurrency', 5)) || 5);
+
+// Which engine renders the sweep. Chromium is the default because it is the
+// only browser every machine here already has, but it cannot see a whole class
+// of bug on its own: JavaScriptCore and V8 disagree about when a temporal dead
+// zone is checked, so a page can render perfectly in Chrome and throw
+// "Cannot access uninitialized variable." on every Safari. That is exactly how
+// /avatars/:id shipped dead on iOS and macOS while this audit stayed green.
+// `--engine webkit` needs `npx playwright install webkit` once.
+const ENGINES = { chromium, webkit, firefox };
+const ENGINE_NAME = String(opt('engine', 'chromium')).toLowerCase();
+const ENGINE = ENGINES[ENGINE_NAME];
+if (!ENGINE) {
+ console.error(`✗ unknown --engine "${ENGINE_NAME}". Use one of: ${Object.keys(ENGINES).join(', ')}`);
+ process.exit(2);
+}
const explicitRoutes = argv.filter((a) => a.startsWith('/'));
// ── Noise filter ────────────────────────────────────────────────────────────
@@ -814,8 +830,12 @@ async function main() {
console.log(`Page audit → ${BASE_URL}`);
console.log(` auth: ${authed ? 'session from ' + AUTH_STATE.replace(ROOT + '/', '') : 'anonymous'}`);
console.log(` viewports: ${viewports.join(', ')} · concurrency: ${CONCURRENCY}`);
+ console.log(` engine: ${ENGINE_NAME}`);
- const browser = await chromium.launch({ args: ['--no-sandbox', '--disable-dev-shm-usage'] });
+ // The sandbox flags are chromium-only; webkit and firefox reject unknown args.
+ const browser = await ENGINE.launch(
+ ENGINE_NAME === 'chromium' ? { args: ['--no-sandbox', '--disable-dev-shm-usage'] } : {},
+ );
const seedCtx = await browser.newContext(
authed ? { storageState: AUTH_STATE } : {},
);