Skip to content

fix(playground): surface current build failures - #4298

Merged
sxlijin merged 1 commit into
canaryfrom
agent/b-1003-render-compiler-errors
Jul 31, 2026
Merged

sxlijin merged 1 commit into
canaryfrom
agent/b-1003-render-compiler-errors

Conversation

@sxlijin

@sxlijin sxlijin commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes B-1003.

User impact

When the compiler cannot prepare a runnable build without producing a normal source diagnostic, the Run tab now shows the failure in its existing compiler-error banner instead of staying indefinitely at “Preparing current build…”. The error is also replayed after a playground reconnect or state request, and disappears as soon as the source revision changes.

Root cause

The rebuild pipeline preserved source diagnostics but discarded the message from EngineBuildOutcome::Failed after logging it. The resulting ProjectUpdate had isBexCurrent: false and no error-severity diagnostics, which the playground correctly interpreted as a transient build window. Because the failed revision could never become current, that transient state never ended.

What changed

  • Persist the latest non-diagnostic build failure on LiveProject, scoped to its exact SourceRevision.
  • Include that failure as an error-severity project diagnostic in normal updates and requestState replays.
  • Ignore late failures from older revisions and clear recorded failures after a successful or source-diagnostic-blocked rebuild.
  • Serialize failure lookup through notification publication so a concurrent older diagnostics snapshot cannot overwrite the failure-bearing update.
  • Hold the source lease through publication so an edit cannot make a failure-bearing snapshot obsolete while it is being sent.
  • Document that PlaygroundSender implementations must perform a bounded, synchronous in-process handoff because project snapshots retain revision-fencing guards during publication.
  • Add regression coverage for rendering, revision fencing, stale rebuild ordering, clearing, and an edit racing failure publication.

Verification

  • cargo test -p bex_project --lib (60 passed, 1 ignored)
  • cargo clippy -p bex_project --lib -- -D warnings
  • cargo check --target wasm32-unknown-unknown -p bridge_wasm
  • cargo fmt --all -- --check
  • Verified in the real baml playground server using current playground assets. A deterministic engine-construction failure was introduced only as temporary, uncommitted test instrumentation, used identically against latest canary and this branch, then removed before committing.
  • Confirmed latest canary remains stuck at “Preparing current build…” with isBexCurrent: false and no error diagnostics, while this branch renders the failure in the expanded compiler-error banner.
  • Also confirmed ordinary independent source diagnostics already render fully (2/2), narrowing the bug to non-diagnostic engine-build failures.

Screenshots

Before — latest canary

Latest canary remains stuck at Preparing current build

After — this PR

This PR renders the current build failure in the compiler-error banner

Summary by CodeRabbit

  • Bug Fixes
    • Improved project diagnostics to accurately report build failures for the relevant revision.
    • Prevented outdated build errors from appearing after newer project updates.
    • Automatically clears build-failure diagnostics when a build succeeds or is appropriately blocked.
    • Improved handling of build status when project updates are replayed or processed out of order.
    • Ensured diagnostics remain consistent when project changes and build results arrive at different times.
    • Improved runtime status reporting so it reflects the engine installed for the current project revision.

@linear

linear Bot commented Jul 30, 2026

Copy link
Copy Markdown

B-1003

@vercel

vercel Bot commented Jul 30, 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 Jul 31, 2026 7:22pm
promptfiddle2 Ready Ready Preview Jul 31, 2026 7:22pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 23:19 Inactive
@github-actions

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.

@coderabbitai

coderabbitai Bot commented Jul 30, 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

Live projects now track build failures by source revision. Build outcomes record or clear failures by revision. Matching failures appear in published diagnostics, while stale failures are suppressed. Runtime status is checked against the requested source revision.

Changes

Build failure diagnostics

Layer / File(s) Summary
Revision-scoped failure state
baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs
LiveProject initializes revision-aware failure state that retains the newest failure, clears failures through a revision, and renders matching failures as diagnostics.
Build update and diagnostic integration
baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs, baml_language/crates/bex_project/src/project.rs, baml_language/crates/bex_project/src/bex_lsp/mod.rs
Build outcomes record or clear failures by revision. Runtime status is checked for the requested source. Publication retains a source lease while appending matching failures. Notification handoff behavior is documented.
Replay and revision fencing validation
baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs
Project-state replay uses the enriched update path. Tests cover matching failures, stale suppression, replacement rejection, revision-based clearing, and concurrent-edit fencing.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Build as Build outcome
  participant LiveProject
  participant BexProject
  participant Publisher
  Build->>LiveProject: Record or clear failure for source revision
  LiveProject->>BexProject: Read runtime status for source revision
  LiveProject->>Publisher: Publish leased project update with matching diagnostic
Loading

Possibly related PRs

Suggested reviewers: rossirpaulo, hellovai

Poem

A rabbit tracks each source revision,
Build failures wait for the right condition.
Stale errors leave the stack,
Matching ones come hopping back.
Leases hold edits until publication.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 89.47% 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: displaying current playground build failures.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/b-1003-render-compiler-errors

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29bebd0a6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sxlijin
sxlijin force-pushed the agent/b-1003-render-compiler-errors branch from 29bebd0 to 96a36f8 Compare July 30, 2026 23:25
@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 23:27 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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs`:
- Around line 1315-1335: The send_update_project flow must retain the
source-revision read lease from build_project_update through the failure lookup
and notification publication. Update the relevant source snapshot handling
around send_update_project so concurrent edits cannot publish diagnostics for an
obsolete revision, or atomically reject such snapshots before publication. Add a
deterministic regression test covering an edit racing with a failed rebuild.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c9ef206e-cc2b-492f-8ca5-890c24542c26

📥 Commits

Reviewing files that changed from the base of the PR and between 29bebd0 and 96a36f8.

📒 Files selected for processing (1)
  • baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 30, 2026 23:34 Inactive
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 27.4 MB 11.6 MB file 27.4 MB -11.1 KB (-0.0%) OK
✅ packed-program Linux 🔒 17.7 MB 7.3 MB file 17.7 MB +23.1 KB (+0.1%) OK
✅ baml-cli macOS 🔒 21.3 MB 10.2 MB file 21.3 MB -35.0 KB (-0.2%) OK
✅ packed-program macOS 🔒 13.8 MB 6.4 MB file 13.8 MB -4.6 KB (-0.0%) OK
✅ baml-cli Windows 🔒 22.9 MB 10.4 MB file 23.0 MB -54.4 KB (-0.2%) OK
✅ packed-program Windows 🔒 14.8 MB 6.5 MB file 14.8 MB -14.3 KB (-0.1%) OK
✅ bridge_wasm WASM 16.8 MB 🔒 4.6 MB gzip 4.6 MB -41.5 KB (-0.9%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@sxlijin
sxlijin force-pushed the agent/b-1003-render-compiler-errors branch from 96a36f8 to fc7bc6c Compare July 31, 2026 00:26
@vercel
vercel Bot temporarily deployed to Preview – beps July 31, 2026 00:27 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/bex_project/src/bex_lsp/multi_project/mod.rs (1)

1308-1335: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Confirm the playground transport under the source lease is non-blocking here.

send_update_project still holds the source read lease through playground_sender.send_playground_notification. For the production native sender this is short, but a bounded/contended channel could stall mutate_sources or request-lane reads while a UI/webview write is pending. If the sender is kept as an injected dyn PlaygroundSender, document the transport contract or publish the payload after releasing the lease with the same revision-fencing/rejection recheck.

🤖 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/bex_project/src/bex_lsp/multi_project/mod.rs` around
lines 1308 - 1335, The send_update_project method holds the source read guard
while calling playground_sender.send_playground_notification, so ensure this
transport call is non-blocking under the injected PlaygroundSender contract and
document that guarantee; otherwise construct the update and capture its source
revision, release both guard and build_failure before publishing, then recheck
revision/fencing and reject stale updates before sending.
🤖 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/bex_project/src/bex_lsp/multi_project/mod.rs`:
- Around line 1308-1335: The send_update_project method holds the source read
guard while calling playground_sender.send_playground_notification, so ensure
this transport call is non-blocking under the injected PlaygroundSender contract
and document that guarantee; otherwise construct the update and capture its
source revision, release both guard and build_failure before publishing, then
recheck revision/fencing and reject stale updates before sending.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d0c4491d-20a6-463c-84d6-f8d24f1690d8

📥 Commits

Reviewing files that changed from the base of the PR and between 96a36f8 and fc7bc6c.

📒 Files selected for processing (2)
  • baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs
  • baml_language/crates/bex_project/src/project.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 31, 2026 00:34 Inactive
@sxlijin
sxlijin force-pushed the agent/b-1003-render-compiler-errors branch from fc7bc6c to 6c895d0 Compare July 31, 2026 17:52
@vercel
vercel Bot temporarily deployed to Preview – beps July 31, 2026 17:54 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 31, 2026 18:01 Inactive
@sxlijin
sxlijin force-pushed the agent/b-1003-render-compiler-errors branch from 6c895d0 to 5f3b5b1 Compare July 31, 2026 19:11
@vercel
vercel Bot temporarily deployed to Preview – beps July 31, 2026 19:13 Inactive
@sxlijin
sxlijin force-pushed the agent/b-1003-render-compiler-errors branch from 5f3b5b1 to 3527145 Compare July 31, 2026 19:14
@vercel
vercel Bot temporarily deployed to Preview – beps July 31, 2026 19:15 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 31, 2026 19:22 Inactive
@sxlijin
sxlijin added this pull request to the merge queue Jul 31, 2026
Merged via the queue into canary with commit 0cf744c Jul 31, 2026
82 checks passed
@sxlijin
sxlijin deleted the agent/b-1003-render-compiler-errors branch July 31, 2026 22:41

This branch was previously deployed

2 inactive deployments
Preview – promptfiddle2 — 35271458 Deployed Jul 31, 2026 by vercel[bot]
Preview – beps — 35271458 Deployed Jul 31, 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.

1 participant