Avatar for the BoundaryML user
BoundaryML
baml
BlogDocsChangelog

Performance History

Latest Results

Implement lexical scoping and shadowing for let bindings (#3425) Implements lexical block scoping and local shadowing for BAML `let`, `watch let`, and `for` bindings across HIR, TIR, MIR, generated snapshots, and runtime regressions. **Summary** - Adds lexical scoping fixtures for valid shadowing and invalid block-leak cases. - Refactors HIR body walking so nested blocks, `for`/`while` loop bodies, lambdas, match arms, and catch arms own the right scopes. `Stmt::While` now pushes a Block scope around the body and the C-style `after` step, mirroring `Stmt::For`. - Allows local shadowing, repeated `_`, and parameter shadowing while preserving top-level/member/parameter duplicate diagnostics. - Adds visible-binding lookup and capture identity via binding IDs so same-name captures resolve to the correct declaration. - Restores TIR active local state across blocks, `for` loops, `while` loops, match arms, and catch arms. PatId-keyed assignment tracking distinguishes inner-shadow assignments (drop on scope exit, rule 3) from outer-binding assignments (propagate, rule 2). - Routes match-arm and catch-arm pattern bindings — including the catch-clause stack-trace binding — through `declare_scoped_local`, fixing a leak where the stack-trace binding was raw-inserted with no paired restore. - Lowers lambda captures by binding identity and marks captured MIR locals by binding identity. - Restores MIR watched-local cleanup on every exit path through a single emitter (`emit_unwatch_to_depth`): block fallthrough, `for`/`while` body fallthrough, match-arm and catch-arm body fallthrough, `throw`, `break`/`continue`/`return`. - Type-checks the C-style `for` `after` step (e.g. `i += 1`), which was previously skipped. This surfaces two correct missing-name diagnostics that update the `loops_c_for` and `header_requires_let_negative` LSP fixtures. - Adds runtime regressions and unignores now-supported branch-local and lambda-shadowing tests. - Accepts final HIR/TIR/MIR/codegen/diagnostics snapshots. **Scoping and Evolving Container Rules** - `let`, `watch let`, and `for` declarations are lexical: bindings introduced inside a block, loop body, lambda, match arm, or catch arm do not leak after that scope exits. - Assignments and type-establishing mutations to an already-visible outer binding still apply to that outer binding, even when they occur inside a nested block or loop body. - Shadowing is resolved by binding identity, not by name alone: mutating a shadowed inner binding must not mutate or retype the outer binding. - Empty evolving containers use the existing BAML heuristic: the first type-establishing usage wins. This includes `push`, index assignment, and similar mutations inside control-flow or loop bodies; the typechecker does not treat a loop body as non-establishing just because the loop might run zero times. - Example: `let xs = []; for (let n in []) { xs.push("s") }; xs.push(1)` establishes `xs` as `string[]` at the loop-body push, so the later integer push is a type error. **Validation** - `cargo test -p baml_lsp2_actions_tests --lib` - `cargo test -p baml_tests --lib` - `cargo test -p bex_engine --test concurrent test_closures_in_loop_vars` - `cargo test -p baml_tests --test lexical_scoping` - `cargo test -p baml_tests --test watch` - `mise run fmt` - `mise run clippy` - `prek run --all-files` **CI status** - Green as of commit `1a0a1f8d5`. Earlier failures in `baml_lsp2_actions_tests`, `baml_tests`, and `bex_engine --test concurrent` (run https://github.com/BoundaryML/baml/actions/runs/25013954913) are resolved by this PR. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixes for duplicate-binding diagnostics and correct restoration of outer variables after blocks, loops, and while bodies. * Improved lambda capture and shadowing behavior so closures reference the intended variables. * **New Features** * Stronger lexical-scoping guarantees across if/else, match, catch, loops, and nested blocks. * **Editor / LSP** * More accurate completions and hover/type info for let/for bindings; improved reference-finding respecting shadowing. * **Tests / Chores** * Numerous new/updated regression tests and updated snapshot expectations; .gitignore updated. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
canary
26 minutes ago
prototype class destructure/pattern refactor
avery/pattern-proto
6 hours ago
chore(deps): bump the cargo group across 4 directories with 10 updates Bumps the cargo group with 4 updates in the /baml_language directory: [openssl](https://github.com/rust-openssl/rust-openssl), [rand](https://github.com/rust-random/rand), [rustls-webpki](https://github.com/rustls/webpki) and [thin-vec](https://github.com/mozilla/thin-vec). Bumps the cargo group with 8 updates in the /engine directory: | Package | From | To | | --- | --- | --- | | [aws-sdk-bedrockruntime](https://github.com/awslabs/aws-sdk-rust) | `1.106.0` | `1.107.0` | | [bytes](https://github.com/tokio-rs/bytes) | `1.10.1` | `1.11.1` | | [time](https://github.com/time-rs/time) | `0.3.43` | `0.3.47` | | [openssl](https://github.com/rust-openssl/rust-openssl) | `0.10.73` | `0.10.78` | | [quinn-proto](https://github.com/quinn-rs/quinn) | `0.11.13` | `0.11.14` | | [rand](https://github.com/rust-random/rand) | `0.8.5` | `0.9.2` | | [jsonwebtoken](https://github.com/Keats/jsonwebtoken) | `9.3.1` | `10.3.0` | | [tar](https://github.com/alexcrichton/tar-rs) | `0.4.44` | `0.4.45` | Bumps the cargo group with 2 updates in the /integ-tests/rust directory: [bytes](https://github.com/tokio-rs/bytes) and [rustls-webpki](https://github.com/rustls/webpki). Bumps the cargo group with 2 updates in the /languages/rust directory: [bytes](https://github.com/tokio-rs/bytes) and [rustls-webpki](https://github.com/rustls/webpki). Updates `openssl` from 0.10.76 to 0.10.78 - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.76...openssl-v0.10.78) Updates `rand` from 0.8.5 to 0.8.6 - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/0.8.6/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.8.6) Updates `rustls-webpki` from 0.103.10 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `thin-vec` from 0.2.14 to 0.2.16 - [Changelog](https://github.com/mozilla/thin-vec/blob/main/RELEASES.md) - [Commits](https://github.com/mozilla/thin-vec/compare/v0.2.14...v0.2.16) Updates `rand` from 0.8.5 to 0.8.6 - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/0.8.6/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.8.6) Updates `openssl` from 0.10.76 to 0.10.78 - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.76...openssl-v0.10.78) Updates `rustls-webpki` from 0.103.10 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `rustls-webpki` from 0.103.10 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `rustls-webpki` from 0.103.10 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `aws-sdk-bedrockruntime` from 1.106.0 to 1.107.0 - [Release notes](https://github.com/awslabs/aws-sdk-rust/releases) - [Commits](https://github.com/awslabs/aws-sdk-rust/commits) Updates `bytes` from 1.10.1 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `time` from 0.3.43 to 0.3.47 - [Release notes](https://github.com/time-rs/time/releases) - [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md) - [Commits](https://github.com/time-rs/time/compare/v0.3.43...v0.3.47) Updates `openssl` from 0.10.73 to 0.10.78 - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.76...openssl-v0.10.78) Updates `quinn-proto` from 0.11.13 to 0.11.14 - [Release notes](https://github.com/quinn-rs/quinn/releases) - [Commits](https://github.com/quinn-rs/quinn/compare/quinn-proto-0.11.13...quinn-proto-0.11.14) Updates `rand` from 0.8.5 to 0.9.2 - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/0.8.6/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.8.6) Updates `bytes` from 1.10.1 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rand` from 0.8.5 to 0.9.2 - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/0.8.6/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.8.6) Updates `time` from 0.3.43 to 0.3.47 - [Release notes](https://github.com/time-rs/time/releases) - [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md) - [Commits](https://github.com/time-rs/time/compare/v0.3.43...v0.3.47) Updates `aws-sdk-bedrockruntime` from 1.106.0 to 1.107.0 - [Release notes](https://github.com/awslabs/aws-sdk-rust/releases) - [Commits](https://github.com/awslabs/aws-sdk-rust/commits) Updates `jsonwebtoken` from 9.3.1 to 10.3.0 - [Changelog](https://github.com/Keats/jsonwebtoken/blob/master/CHANGELOG.md) - [Commits](https://github.com/Keats/jsonwebtoken/compare/v9.3.1...v10.3.0) Updates `tar` from 0.4.44 to 0.4.45 - [Commits](https://github.com/alexcrichton/tar-rs/compare/0.4.44...0.4.45) Updates `openssl` from 0.10.73 to 0.10.78 - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.76...openssl-v0.10.78) Updates `quinn-proto` from 0.11.13 to 0.11.14 - [Release notes](https://github.com/quinn-rs/quinn/releases) - [Commits](https://github.com/quinn-rs/quinn/compare/quinn-proto-0.11.13...quinn-proto-0.11.14) Updates `bytes` from 1.10.1 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `bytes` from 1.10.1 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) Updates `bytes` from 1.11.0 to 1.11.1 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.1) Updates `rustls-webpki` from 0.103.8 to 0.103.13 - [Release notes](https://github.com/rustls/webpki/releases) - [Commits](https://github.com/rustls/webpki/compare/v/0.103.10...v/0.103.13) --- updated-dependencies: - dependency-name: aws-sdk-bedrockruntime dependency-version: 1.107.0 dependency-type: direct:production - dependency-name: bytes dependency-version: 1.11.1 dependency-type: direct:production - dependency-name: bytes dependency-version: 1.11.1 dependency-type: indirect - dependency-name: bytes dependency-version: 1.11.1 dependency-type: indirect - dependency-name: jsonwebtoken dependency-version: 10.3.0 dependency-type: direct:production - dependency-name: openssl dependency-version: 0.10.78 dependency-type: indirect - dependency-name: openssl dependency-version: 0.10.78 dependency-type: indirect - dependency-name: quinn-proto dependency-version: 0.11.14 dependency-type: indirect - dependency-name: rand dependency-version: 0.8.6 dependency-type: indirect - dependency-name: rand dependency-version: 0.9.2 dependency-type: direct:production - dependency-name: rustls-webpki dependency-version: 0.103.13 dependency-type: indirect - dependency-name: rustls-webpki dependency-version: 0.103.13 dependency-type: indirect - dependency-name: rustls-webpki dependency-version: 0.103.13 dependency-type: indirect - dependency-name: tar dependency-version: 0.4.45 dependency-type: direct:production - dependency-name: thin-vec dependency-version: 0.2.16 dependency-type: indirect - dependency-name: time dependency-version: 0.3.47 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
dependabot/cargo/baml_language/cargo-0ef43d590c
16 hours ago
fix(bex_engine): substitute placeholder for non-convertible trace payload leaves (#3420) ## Summary `baml-cli test` (and any other run that emits a trace event for a value containing a closure, future, function ref, or class/enum definition) printed `Failed to deep-copy VM value for trace payload` to stderr on every invocation, and silently dropped the entire trace payload to `Null`. The trigger in practice: `$collect_tests` returns a `TestRegistry` whose fields hold the test bodies as closures. The engine emits a `FunctionEnd` trace event for that call, `vm_value_to_owned` calls `as_owned_but_very_slow`, hits `CannotConvertToOwned { reason: "closure" }` deep in the tree, and the whole result is replaced with `Null` plus an unconditional `eprintln!`. ## Fix - Add `BexValue::as_owned_for_trace`, which delegates to a free `owned_inner` helper. In trace mode, non-convertible leaves (`closure`, `future`, `function`, `class`, `enum`, `bound_method`, `cell`, `function-ref`) become `<kind>` string placeholders instead of failing the whole conversion. - The strict `as_owned_but_very_slow` keeps its public signature and behavior — strict callers (builtins, `bex_project`, IO codegen) are unchanged. Both methods share `owned_inner` to avoid duplication. - `vm_value_to_owned` (the engine's trace-payload path) calls `as_owned_for_trace` and drops the `eprintln!` since the conversion can no longer fail on the closure-leaf case. The `_permit: PermitProof<'_>` argument on the public methods is kept (to preserve the GC-exclusion proof at the API boundary) but isn't threaded through `owned_inner` — it's a zero-sized type-level witness, never destructured or method-called. ## Test plan - [x] `cargo clippy -p bex_heap -- -D warnings` clean - [x] `cargo test -p bex_heap --lib` (89 passed) - [x] `cargo test -p bex_engine --lib` passes - [x] `baml-cli test` on `hackathon/coding-agent`: 9 passed, no `Failed to deep-copy VM value for trace payload` on stderr - [x] `baml-cli run -e '...'`: clean stderr <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Trace output now includes readable error text for previously unrepresentable values, improving diagnostics. * Conversions no longer emit noise to stderr; related errors are logged cleanly. * Deep-copy/conversion performance improved, reducing failures and speeding trace generation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
canary
17 hours ago
add tests
avery/pattern
17 hours ago

Latest Branches

CodSpeed Performance Gauge
+27%
baml_language: prototype class destructure/pattern refactor#3423
6 hours ago
869a32f
avery/pattern-proto
CodSpeed Performance Gauge
-21%
baml_language: implement new patterns backend without parser support#3417
16 hours ago
daa8aef
avery/pattern
CodSpeed Performance Gauge
+1%
17 hours ago
81622f0
dependabot/cargo/baml_language/cargo-0ef43d590c
© 2026 CodSpeed Technology
Home Terms Privacy Docs