Repository navigation
Move browser programs out of Python - #664
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The move itself reads cleanly, and the paths it touches still behave: tests/test_render_gate.py (107 passed) exercises the new driver, wait_for_theme, and pre_upgrade_findings, and tests/test_mcp_app.py passes. The three tests/test_render_export.py failures I see locally reproduce identically at the merge base — this sandbox cannot launch the installed Chrome — so they are not the branch's. Two things to change.
_state_url's missing-root guard no longer fires on the case it was written for. Inline below.
The two references that own the directories this PR adds files to still describe them as they were. skills/leaf/assets/CLAUDE.md's Render gates section names each non-probe member of render-checks/ and its role ("render-checks/init.js installs the pre-navigation window-error channel"), and states that "The served graph imports the public widget API statically, so the JavaScript parser and module loader validate its syntax, dependencies, and named exports". driver.js is the first member deliberately outside that graph — render_checks.py filters it out of PROBE_SOURCES and installs it as a Playwright init script instead — so nothing but eslint parses it, and the next contributor to add a file there reads the opposite. Same shape in scripts/CLAUDE.md's Vendored bundles section, which still presents vendor.py as the whole of a bundle's source: scripts/vendor-src/pierre/ is now a second input, and the /* LEAF_PIERRE_LANGUAGES */ sentinel build_pierre substitutes into carries no explanation where it sits. Both edits are outside the diff — say the word and I'll push them.
Leaf maintained substantial browser and build programs inside Python string literals, which left the JavaScript outside native formatting and linting. This moves the Pierre vendor build, render probe driver, export preparation, MCP readiness, and demo selection logic into JavaScript sources; Python now owns orchestration and structured inputs.
The render driver preserves synchronous probe calls and bounded readiness waits. Export reads state from the document canonical capability root and disposes the Playwright response. Pierre regeneration remains byte-identical.
Validation:
uv run pytest tests— 1,043 passeduv run pre-commit run --all-filesuv run scripts/vendor.py pierreoutput