Skip to content

[KS] Driver dev builds: source maps, /symbolicate, prebundled worker entry (#408) - #461

Open
sethwebster wants to merge 1 commit into
seth/kitchen-sink-gatefrom
seth/ks-408-driver-bundles
Open

sethwebster wants to merge 1 commit into
seth/kitchen-sink-gatefrom
seth/ks-408-driver-bundles

Conversation

@sethwebster

Copy link
Copy Markdown
Collaborator

Refs #408

What changed

  • scripts/e2e/bundle-server.ts (new): the driver's bundle server for dev builds. It serves /index.bundle and /.threaded-runtime/entry.bundle, their source maps (/index.map, /.threaded-runtime/entry.map), and Metro's POST /symbolicate. Like Metro's server, it rewrites each bundle's trailing sourceURL/sourceMappingURL to the URL that was actually served. export:embed writes a http://localhost:8081/... sourceURL, which nothing serves, and Hermes names profile frames by it.
  • Driver runs (DriverBackend) prebundle the worker entry in the background once the app's bundle is built. A request still bundles the entry lazily if the prebundle hasn't finished or failed. Failures go to stderr and are never silent. A failed build answers 500 and is retried.
  • exportBundle writes source maps. scripts/testing/source-map.ts now indexes by line, returns source columns, and treats unmapped segments as unmapped.
  • e2e/dev-flows/devtools/profiling-dev.yaml checks that the ks-devtools worker runs, writes isolated-ks-devtools.cpuprofile, and that both runtimes report source maps applied.
  • The first-worker waits in plugins-load, plugins-unload, isolated-runtime and profiling-dev drop from 60 s to 30 s. With a warm Metro cache, the dev worker entry took 5 s to bundle (the app bundle 11 s) when measured on this Mac.
  • Fixes found while running the flows:
    • KitchenSinkApp.open() now closes the bundle server when the session fails to open. Before, the runner never closed it and the run hung after its summary.
    • Clearing driver state now leaves dirhelper's protected TemporaryItems. Every operation on it fails with EPERM, so every clearState flow was failing.
  • Docs: docs/e2e-flows.md (the driver backend) and docs/devtools.md (Verification).

Verification (run in this session)

  • bun run typecheck: passes.
  • bun run e2e:lint: 0 problems.
  • bun run test: 2008 passed, 2 failed. Both failures are the accepted ones: node-runtime (asdf shim) and motion-native frames (display asleep).
  • New tests/e2e-bundle-server.test.ts (7 tests). tests/e2e-app-state.test.ts and tests/e2e-driver-backend.test.ts were updated.
  • ks-lock native bun run e2e:run --backend driver on a dev build (rebuild:macos): plugins-load/unload/rejections/visual, multiwindow/isolated-runtime, infra/catalog-driver, dev-flows/devtools/profiling-dev, dev-flows/devtools/react-devtools-dev: 14 passed, 0 failed. plugins-load ran first, so it covered the first-worker case.
  • Same flows except the dev-only ones on the release build (bun run build, --app .../release/KitchenSink.app): 12 passed, 0 failed.

…worker entry (#408)

The driver's bundle server (scripts/e2e/bundle-server.ts) now serves each
bundle's source map, names the URL it served in the bundle's sourceURL as
Metro does, and answers /symbolicate, so the profiler and LogBox map stacks
of both runtimes. Driver runs bundle the worker entry in the background once
the app's bundle is built; lazy bundling stays the fallback and failures are
reported. profiling-dev now checks the worker's profile and source maps; the
first-worker waits drop from 60 s to 30 s.

Also: a failed session open closes the bundle server (a run no longer hangs
on it), and clearing driver state leaves dirhelper's protected TemporaryItems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant