Skip to content

feat: use Chromium as a true WASM driver — fix Leg 2, add Playwright, explore sandbox isolation #8

Description

@iheitlager

Summary

Leg 2 (leg2_pyodide_chromium) is misnamed — it loads Pyodide directly in Node.js via loadPyodide() and never uses Puppeteer or Chromium. The puppeteer dependency in package.json is unused.

This issue tracks making Leg 2 honest and progressively exploring Chromium as a real WASM runtime driver.

Tasks

Phase 1: Fix Leg 2 — True Puppeteer-driven Pyodide

  • Rewrite harness.js to actually launch headless Chrome via Puppeteer
  • Load Pyodide inside the browser page (not Node.js)
  • Proxy HTTP requests through page.evaluate() into the browser's Pyodide
  • Keep the current Node.js-only version as leg2a (rename) for comparison
  • Add the real Chromium variant as leg2b
  • Benchmark both — measure the overhead of Chrome as the WASM host vs bare Node.js

Phase 2: Playwright experiment

  • Create a new leg using Playwright instead of Puppeteer
  • Compare API ergonomics, startup time, and reliability
  • Playwright is the more modern/maintained choice for 2026

Phase 3: Chrome as a sandbox

  • Explore using browser contexts as isolation boundaries
  • Per-request WASM sandboxes (fresh BrowserContext per request, or context pooling)
  • This is closer to real serverless patterns (Cloudflare Workers, Fermyon)
  • Measure isolation overhead vs shared-context approach

Hypotheses to add

# Hypothesis
H8 Pyodide-in-Chrome has higher cold start and memory than Pyodide-in-Node due to browser overhead
H9 Warm request latency comparable — Chrome's V8 and Node's V8 run WASM at similar speed
H10 Browser context isolation adds measurable per-request overhead but provides security guarantees
H11 Playwright and Puppeteer have comparable performance for this use case

Learning goals

  • Understand Puppeteer/Playwright APIs for headless browser automation
  • Learn CDP (Chrome DevTools Protocol) concepts under the hood
  • Explore the browser as a compute sandbox (not just a rendering engine)
  • Compare Node.js-as-WASM-host vs Chrome-as-WASM-host patterns

🤖 Analysis by Claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions