Skip to content

Implement canonical playground RunStore migration - #3786

Merged
aaronvg merged 23 commits into
canaryfrom
paulo/playground-v3
Jun 19, 2026
Merged

aaronvg merged 23 commits into
canaryfrom
paulo/playground-v3

Conversation

@rossirpaulo

@rossirpaulo rossirpaulo commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Move playground execution state behind Rust-owned RunStore snapshots and patches, delete browser runtime-event reconstruction, and add native/WASM run protocol support.

Summary by CodeRabbit

  • New Features

    • Added a baml playground CLI command to open the playground in your browser.
    • Added a VS Code command to open the playground via an external browser terminal.
    • Toolchain releases now package and validate playground web assets.
  • Improvements

    • Enhanced playground runtime lifecycle (runs, previews, snapshots, input/env resolving, and cancellation) with run patching and richer editor integration.
    • Improved profiling output and .bamlprof reconstruction across native, browser, and WASM.
    • Improved playground navigation to correctly resolve namespaced functions.
  • Documentation

    • Added/updated references for tracing/profiling behavior and BEP-053 semantic identity.

Move playground execution state behind Rust-owned RunStore snapshots and patches, delete browser runtime-event reconstruction, and add native/WASM run protocol support.

Include TASK plan, references, and implementation findings for peer handoff context.
@vercel

vercel Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jun 19, 2026 9:20pm
promptfiddle Ready Ready Preview, Comment Jun 19, 2026 9:20pm
promptfiddle2 Ready Ready Preview, Comment Jun 19, 2026 9:20pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds run-based playground execution across the CLI, native server, WASM bridge, and editor UI, and packages playground assets into releases. It also expands tracing/profiling artifacts, wire formats, and reconstruction support.

Changes

Playground run protocol and profiling

Layer / File(s) Summary
Docs, CLI, and packaging
TASK/*, baml_language/crates/baml_cli/*, .github/workflows/release-baml-language.yml, baml_language/crates/baml_release/src/lib.rs
Adds tracing references, the playground CLI path, shared project/source resolution, and playground asset packaging and validation.
Native server and project resolution
baml_language/crates/baml_lsp_server/src/*, baml_language/crates/bex_project/src/bex_lsp/*, baml_language/crates/bex_project/src/project.rs, baml_language/crates/baml_project/src/{db.rs,symbols.rs}
Switches the native playground to workspace-root startup, run-store-backed commands, source-file APIs, graph overlay lookups, and qualified function naming.
Tracing, profiling, and run wire contracts
baml_language/crates/bex_events/src/{lib.rs,run_wire.rs,prof/*}, baml_language/crates/bex_engine/tests/*, baml_language/crates/bridge_ctypes/src/*, baml_language/crates/bex_engine/src/*, baml_language/crates/bex_vm/src/vm.rs, baml_language/crates/bridge_wasm/src/lib.rs
Adds traced entry-call results, per-VM profiling suppression, caller-span recording, shared run serialization, and expanded profile encode/read/drain/reconstruction support.
Editor backends and web UI integration
baml_language/crates/bridge_wasm/src/*, baml_language/crates/bridge_wasm/tests/*, typescript2/app-promptfiddle/src/playground/*, typescript2/app-vscode-webview/src/*, typescript2/pkg-editor/src/*, typescript2/pkg-editor/package.json, typescript2/app-vscode-ext/src/*
Replaces direct WASM playground calls with run commands, adds cooperative profile emission, introduces a reusable editor backend package, connects Promptfiddle through a worker backend, and adds remote editor/browser controls in the VS Code webview.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • antoniosarosi

Poem

🐇 I packed a playground into a crate,
with runs and traces marching straight.
I hopped through spans and patchwork light,
and taught the webview browser flight.
Now rabbits can browse the code with glee,
while profiles bloom in a run-tree.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Implement canonical playground RunStore migration' is specific and accurately summarizes the main change: migrating the playground's execution state management to Rust-owned RunStore snapshots and patches, as confirmed by the detailed PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch paulo/playground-v3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Allow baml lsp --playground-via-browser --workspace <path> to seed project discovery outside an editor client and open the first discovered project.
@github-actions

github-actions Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 17:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 17:27 Inactive
@github-actions

github-actions Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

No description provided.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 17:39 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 18:36 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 18:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 18:44 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 18:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 18:57 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 19:01 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 19:07 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 19:18 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 19:53 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 19:59 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 20:11 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 22:44 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 22:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 23:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 19, 2026 20:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 19, 2026 20:15 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
baml_language/crates/baml_lsp_server/src/playground_server.rs (1)

128-144: Extract duplicated encoded_success_outcome helper function to shared location.

This function has an identical implementation in bridge_wasm/src/lib.rs:1086-1102. Consider moving it to bridge_ctypes (which already contains the underlying external_to_outbound function and is a shared dependency of both crates) to avoid maintenance drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@baml_language/crates/baml_lsp_server/src/playground_server.rs` around lines
128 - 144, The function encoded_success_outcome in playground_server.rs is
duplicated in bridge_wasm/src/lib.rs with identical implementation. Move the
encoded_success_outcome function to the bridge_ctypes crate (which is a shared
dependency of both crates and already contains the external_to_outbound function
it depends on), then remove the duplicate implementation from both
playground_server.rs and bridge_wasm/src/lib.rs, and import the function from
bridge_ctypes in both locations instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@baml_language/crates/baml_lsp_server/src/playground_server.rs`:
- Around line 128-144: The function encoded_success_outcome in
playground_server.rs is duplicated in bridge_wasm/src/lib.rs with identical
implementation. Move the encoded_success_outcome function to the bridge_ctypes
crate (which is a shared dependency of both crates and already contains the
external_to_outbound function it depends on), then remove the duplicate
implementation from both playground_server.rs and bridge_wasm/src/lib.rs, and
import the function from bridge_ctypes in both locations instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 425b61fb-ad6c-4074-aa09-038a6a50775b

📥 Commits

Reviewing files that changed from the base of the PR and between da556bb and 8643c7b.

📒 Files selected for processing (10)
  • baml_language/crates/baml_lsp_server/src/playground_server.rs
  • baml_language/crates/bex_events/src/prof/read.rs
  • baml_language/crates/bex_events/src/run.rs
  • baml_language/crates/bridge_wasm/src/lib.rs
  • typescript2/pkg-playground/src/ExecutionPanel.tsx
  • typescript2/pkg-playground/src/FunctionSidebar.tsx
  • typescript2/pkg-playground/src/index.ts
  • typescript2/pkg-playground/src/ports/WebSocketRuntimePort.ts
  • typescript2/pkg-playground/src/serialized-test-tree.ts
  • typescript2/pkg-playground/src/worker-protocol.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/crates/bex_events/src/prof/read.rs
  • baml_language/crates/bridge_wasm/src/lib.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 19, 2026 20:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 19, 2026 20:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 19, 2026 20:43 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 19, 2026 20:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 19, 2026 20:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 19, 2026 21:02 Inactive
@aaronvg
aaronvg enabled auto-merge June 19, 2026 21:02
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 19, 2026 21:08 Inactive
@aaronvg
aaronvg added this pull request to the merge queue Jun 19, 2026
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 19, 2026 21:20 Inactive
Merged via the queue into canary with commit 6db884b Jun 19, 2026
54 checks passed
@aaronvg
aaronvg deleted the paulo/playground-v3 branch June 19, 2026 21:25
aaronvg added a commit that referenced this pull request Jun 24, 2026
The pkg-playground RunStore migration (#3786) replaced the old
callFunction/callTestFunction worker messages — and the matching WASM
methods, now removed — with startRun/startTestRun and runStarted/runPatch
streaming. The app-website worker still spoke the old protocol, so both
run paths silently no-op'd: the LivePlayground "Run" button (panel sends
startRun, no handler) and the learn2 BamlEditor "Run" codelens (called
WASM methods that no longer exist).

Bring app-website/playground/baml-worker.ts onto the new protocol
(mirroring app-promptfiddle's worker) and have app/learn2/_editor/runtime.ts
reuse the shared client instead of bespoke messages:
createRunStoreClient + WorkerRuntimePort + applyRunPatch +
decodeRunResultValue. Export decodeRunResultValue from pkg-playground.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle — 13f1b467 Deployed Jun 19, 2026 by vercel[bot]
Preview – promptfiddle2 — 13f1b467 Deployed Jun 19, 2026 by vercel[bot]
Preview – beps — 13f1b467 Deployed Jun 19, 2026 by vercel[bot]
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.

2 participants