Repository navigation
fix(cffi): consolidate call_function and call_handle APIs, which had diverged - #4245
Conversation
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (16)
📒 Files selected for processing (94)
📝 WalkthroughWalkthroughThe V1 bridge now carries function names and owned function handles inside protobuf-encoded ChangesUnified encoded call-target dispatch
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant SDK
participant Runtime
participant Bridge
participant Engine
SDK->>Runtime: Encode CallFunctionArgs with call_target
Runtime->>Bridge: call_function(encoded_args, callback_id)
Bridge->>Bridge: Decode and validate call_target
Bridge->>Engine: Dispatch named or handle call
Engine-->>SDK: Complete callback result
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
f552811 to
b2e298a
Compare
Binary size checks passed✅ 7 passed
Generated by |
b2e298a to
8f27930
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f27930efd
ℹ️ 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".
| pub type BamlCallFunctionFn = | ||
| extern "C" fn(encoded_args: *const u8, length: usize, callback_id: u32); |
There was a problem hiding this comment.
Preserve the V1 call_function ABI
Keep the existing four-argument function-pointer signature or introduce a new ABI version/append-only entry. BamlApiV1 explicitly promises that existing fields never change type, but this changes call_function while leaving BAML_API_V1_ABI_VERSION at 1; therefore a host and runtime built from different revisions can pass the compatibility check and invoke this slot with different argument layouts. For example, a new host loading the preceding V1 table passes only three arguments to the old implementation, which interprets the protobuf pointer as a C string and the length as a pointer, leading to out-of-bounds reads or undefined behavior rather than a controlled incompatibility error.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
baml_language/sdks/java/bridge_java/src/lib.rs (1)
33-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd unit tests for the new target-dispatch branches.
The new logic — missing-
call_targeterror, the FunctionHandle+type_argsrejection, and the FunctionName/FunctionHandle dispatch match in bothcall_sync_to_bytesandspawn_async_call— is unit-testable in isolation but has no accompanying tests in this diff.Note: I can't execute
cargo test --libin this sandboxed review environment (no Rust toolchain available), so please run it locally/in CI per the repository's Rust guideline.
Based on coding guidelines: "Prefer writing Rust unit tests over integration tests where possible" and "Always runcargo test --libif you changed any Rust code."Also applies to: 48-76, 84-121, 332-382
🤖 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/sdks/java/bridge_java/src/lib.rs` around lines 33 - 40, In the Rust bridge unit-test module, add focused tests covering the new target-dispatch behavior in call_sync_to_bytes and spawn_async_call: missing call_target errors, rejection of FunctionHandle with type_args, and matching FunctionName versus FunctionHandle dispatch paths. Use existing test helpers and assertion conventions, then run cargo test --lib locally or in CI.Source: Coding guidelines
🤖 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/bridge_cffi/src/lib_native.rs`:
- Around line 158-162: Introduce an invalid-argument-classified BridgeError
variant in bridge_cffi::error for unsupported type_args on FunctionHandle
targets, then use it at the decode checks in
baml_language/crates/bridge_cffi/src/lib_native.rs:158-162,
baml_language/crates/bridge_cffi/src/lib_wasm.rs:51-55, and
baml_language/sdks/typescript/bridge_typescript/src/runtime.rs:186-190. Apply
the same substitution in the mirrored Python and Java decode helpers so all
decode paths classify this caller input consistently.
In `@baml_language/sdks/python/src/baml_bridge/proto.py`:
- Around line 517-526: Require exactly one call target in both encoders: update
the Python encoder around the existing function_name/function_handle validation
in proto.py lines 517-526 and the TypeScript encoder’s corresponding
target-option validation in proto.ts lines 308-330 to reject cases where both
selectors are absent, while preserving rejection when both are provided.
---
Nitpick comments:
In `@baml_language/sdks/java/bridge_java/src/lib.rs`:
- Around line 33-40: In the Rust bridge unit-test module, add focused tests
covering the new target-dispatch behavior in call_sync_to_bytes and
spawn_async_call: missing call_target errors, rejection of FunctionHandle with
type_args, and matching FunctionName versus FunctionHandle dispatch paths. Use
existing test helpers and assertion conventions, then run cargo test --lib
locally or in CI.
🪄 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: edcddbeb-a24c-47f0-b6de-bfc89f81c0bc
⛔ Files ignored due to path filters (15)
baml_language/sdks/go/baml_go/internal/cffi/baml_inbound.pb.gois excluded by!**/*.pb.gobaml_language/sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/baml_inbound.pb.gois excluded by!**/*.pb.gobaml_language/sdks/typescript/bridge_typescript/dist/define_function.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/define_function.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/index.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/index.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/native.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.d.ts.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/proto.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/stream.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/stream.js.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (65)
baml_language/crates/bridge_cffi/cbindgen.tomlbaml_language/crates/bridge_cffi/include/baml_cffi.hbaml_language/crates/bridge_cffi/src/api.rsbaml_language/crates/bridge_cffi/src/baml_to_host.rsbaml_language/crates/bridge_cffi/src/error.rsbaml_language/crates/bridge_cffi/src/lib_native.rsbaml_language/crates/bridge_cffi/src/lib_wasm.rsbaml_language/crates/bridge_cffi/tests/abi_assertions.hbaml_language/crates/bridge_cffi/tests/abi_layout.cbaml_language/crates/bridge_cffi/tests/abi_layout.rsbaml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/baml_inbound.protobaml_language/sdks/cpp/bridge_cpp/include/baml/detail/call.hbaml_language/sdks/cpp/bridge_cpp/include/baml/detail/loader.hbaml_language/sdks/cpp/bridge_cpp/include/baml/detail/proto.hbaml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.ccbaml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.hbaml_language/sdks/csharp/bridge_csharp/src/Cffi/EncodedCallArguments.csbaml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeApi.csbaml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeTypes.csbaml_language/sdks/go/baml_go/internal/cffi/include/baml_cffi.hbaml_language/sdks/go/baml_go/native_unix.gobaml_language/sdks/go/baml_go/native_unsupported.gobaml_language/sdks/go/baml_go/native_windows.gobaml_language/sdks/go/baml_go/runtime.gobaml_language/sdks/go/bridge_go/cffi/bridge.hbaml_language/sdks/go/bridge_go/cffi/lib.gobaml_language/sdks/go/bridge_go/pkg/proto.gobaml_language/sdks/go/bridge_go/pkg/runtime.gobaml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/BamlFfi.javabaml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/internal/ProtoWriter.javabaml_language/sdks/java/bridge_java/src/lib.rsbaml_language/sdks/python/rust/bridge_python/src/baml_core/baml_py/__init__.pyibaml_language/sdks/python/rust/bridge_python/src/py_handle.rsbaml_language/sdks/python/rust/bridge_python/src/runtime.rsbaml_language/sdks/python/src/baml_bridge/__init__.pybaml_language/sdks/python/src/baml_bridge/_stream.pybaml_language/sdks/python/src/baml_bridge/baml_py.pyibaml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.pybaml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.pyibaml_language/sdks/python/src/baml_bridge/proto.pybaml_language/sdks/rust/bridge_rust/src/capi.rsbaml_language/sdks/rust/bridge_rust/src/runtime.rsbaml_language/sdks/rust/bridge_rust/src/wire/baml_bridge.cffi.v1.rsbaml_language/sdks/swift/Sources/BamlBridge/Api.swiftbaml_language/sdks/swift/Sources/BamlBridge/Encode.swiftbaml_language/sdks/swift/Sources/BamlBridge/Proto/.generated-frombaml_language/sdks/swift/Sources/BamlBridge/Proto/baml_inbound.pb.swiftbaml_language/sdks/swift/Sources/BamlBridge/Runtime.swiftbaml_language/sdks/swift/Sources/CBamlBridge/include/baml_cffi.hbaml_language/sdks/typescript/bridge_typescript/src/errors.rsbaml_language/sdks/typescript/bridge_typescript/src/runtime.rsbaml_language/sdks/typescript/bridge_typescript/typescript_src/define_function.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/index.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/native.d.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.d.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.jsbaml_language/sdks/typescript/bridge_typescript/typescript_src/stream.tsbaml_language/sdks/typescript/bridge_typescript_web/src/errors.rsbaml_language/sdks/typescript/bridge_typescript_web/src/runtime.rsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/index.tsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/native.tsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/wasm/bridge_web_core.d.tsmise.tomlrelease/bridge-cffi-public-exports.txt
💤 Files with no reviewable changes (6)
- baml_language/sdks/swift/Sources/BamlBridge/Api.swift
- baml_language/crates/bridge_cffi/tests/abi_layout.c
- baml_language/crates/bridge_cffi/tests/abi_layout.rs
- release/bridge-cffi-public-exports.txt
- baml_language/crates/bridge_cffi/tests/abi_assertions.h
- baml_language/crates/bridge_cffi/cbindgen.toml
8f27930 to
d8f38c9
Compare
d8f38c9 to
eaf39f2
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
baml_language/sdks/python/rust/bridge_python/src/runtime.rs (1)
21-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick windecode_args is duplicated verbatim across bridges.
This function (call_id validation, target extraction, FunctionHandle+type_args rejection, type_args/kwargs conversion) is identical to the same-named function in the Java and TypeScript bridge crates. Since all of them already depend on
bridge_cffi, this looks like a good candidate to hoist intobridge_cffias a shared helper to avoid the 3+ copies drifting apart over time.Also applies to: 104-156, 158-217, 224-250
🤖 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/sdks/python/rust/bridge_python/src/runtime.rs` around lines 21 - 30, Move the duplicated decode_args logic, including call_id validation, target extraction, FunctionHandle/type_args rejection, and type_args/kwargs conversion, into a shared helper in bridge_cffi. Update the Python, Java, and TypeScript bridge implementations to call that helper and reuse its shared decoded-arguments type, removing their local copies while preserving existing behavior.baml_language/sdks/go/sdkgen_go/src/lib.rs (1)
2479-2494: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFragile string-surgery for context injection.
render_returned_callback_go_typederives the returned-callable's Go type by textually splicingcontext.Contextinto the already-renderedrender_callback_go_typestring (replacen("func(", ...)+ a follow-up.replace("Context, )", "Context)")to fix up the empty-param case). It's correct for every case currently exercised, but any future change torender_callback_go_type's output shape (e.g. a different prefix, or a nested callback whose own rendering also starts with"func(") could silently break this.Consider threading a
with_leading_context: boolparameter intorender_callback_go_typedirectly instead of post-processing its output string.🤖 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/sdks/go/sdkgen_go/src/lib.rs` around lines 2479 - 2494, Update render_callback_go_type to accept a with_leading_context boolean and render the context.Context parameter directly when requested. Change render_returned_callback_go_type to pass this flag and return the rendered result without replacen or replace string surgery, preserving the existing parameter behavior for other callers.
🤖 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/bridge_cffi/src/baml_to_host.rs`:
- Around line 368-371: Update the missing-argument branch in the callable
argument handling to return BridgeError::MissingArgument, or an equivalent
invalid-argument variant, instead of BridgeError::Internal so it maps to
baml.errors.InvalidArgument. Add an outbound-envelope test covering a callable
invocation that omits a required argument.
In `@baml_language/sdks/cpp/bridge_cpp/include/baml/detail/loader.h`:
- Around line 302-310: Validate every required ABI function pointer, including
call_function, for null in the C++ loader before materializing or invoking the
table, alongside the existing ABI version and size checks. In
baml_language/sdks/rust/bridge_rust/src/capi.rs:207-224, keep raw ABI slots
nullable during loading and validate all required entries before constructing
Api; update both sites as part of the same validation flow.
In `@baml_language/sdks/go/bridge_go/pkg/proto.go`:
- Around line 27-37: Update encodeCallArgs to require an explicit call target
instead of accepting an optional variadic functionName; always populate
CallFunctionArgs.CallTarget from that required argument. Find and update every
encodeCallArgs caller to pass the appropriate target, ensuring no caller can
construct a payload without dispatch information.
---
Nitpick comments:
In `@baml_language/sdks/go/sdkgen_go/src/lib.rs`:
- Around line 2479-2494: Update render_callback_go_type to accept a
with_leading_context boolean and render the context.Context parameter directly
when requested. Change render_returned_callback_go_type to pass this flag and
return the rendered result without replacen or replace string surgery,
preserving the existing parameter behavior for other callers.
In `@baml_language/sdks/python/rust/bridge_python/src/runtime.rs`:
- Around line 21-30: Move the duplicated decode_args logic, including call_id
validation, target extraction, FunctionHandle/type_args rejection, and
type_args/kwargs conversion, into a shared helper in bridge_cffi. Update the
Python, Java, and TypeScript bridge implementations to call that helper and
reuse its shared decoded-arguments type, removing their local copies while
preserving existing behavior.
🪄 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: 3e2ce807-f68d-4718-ba70-1c7d4bc2d1a7
⛔ Files ignored due to path filters (15)
baml_language/sdks/go/baml_go/internal/cffi/baml_inbound.pb.gois excluded by!**/*.pb.gobaml_language/sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/baml_inbound.pb.gois excluded by!**/*.pb.gobaml_language/sdks/typescript/bridge_typescript/dist/define_function.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/define_function.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/index.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/index.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/native.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.d.ts.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/proto.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto.js.mapis excluded by!**/dist/**,!**/*.mapbaml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.d.tsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/stream.jsis excluded by!**/dist/**baml_language/sdks/typescript/bridge_typescript/dist/stream.js.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (88)
baml_language/crates/bex_engine/src/lib.rsbaml_language/crates/bex_engine/tests/host_value_callable.rsbaml_language/crates/bex_project/src/bex.rsbaml_language/crates/bex_project/src/lib.rsbaml_language/crates/bridge_cffi/cbindgen.tomlbaml_language/crates/bridge_cffi/include/baml_cffi.hbaml_language/crates/bridge_cffi/src/api.rsbaml_language/crates/bridge_cffi/src/baml_to_host.rsbaml_language/crates/bridge_cffi/src/error.rsbaml_language/crates/bridge_cffi/src/lib_native.rsbaml_language/crates/bridge_cffi/src/lib_wasm.rsbaml_language/crates/bridge_cffi/tests/abi_assertions.hbaml_language/crates/bridge_cffi/tests/abi_layout.cbaml_language/crates/bridge_cffi/tests/abi_layout.rsbaml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/baml_inbound.protobaml_language/sdk_tests/crates/csharp/phase11_host_callable/Program.csbaml_language/sdk_tests/crates/go/function_calls/customizable/test_host_callables_test.gobaml_language/sdk_tests/fixtures/function_calls/baml_src/ns_host_callable_tests/main.bamlbaml_language/sdks/cpp/bridge_cpp/include/baml/detail/call.hbaml_language/sdks/cpp/bridge_cpp/include/baml/detail/loader.hbaml_language/sdks/cpp/bridge_cpp/include/baml/detail/proto.hbaml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.ccbaml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.hbaml_language/sdks/cpp/sdkgen_cpp/src/lib.rsbaml_language/sdks/csharp/ABI.mdbaml_language/sdks/csharp/bridge_csharp/src/Cffi/EncodedCallArguments.csbaml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeApi.csbaml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeTypes.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.AbiLifetimeProbe/Program.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.AbiProbe/Program.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.HostCallable.Tests/Program.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.ProgramBootstrapProbe/NativeBytecodeInitializer.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.StreamMediaAbiProbe/NativeBridge.csbaml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.Tests/Program.csbaml_language/sdks/csharp/sdkgen_csharp/src/semantic.rsbaml_language/sdks/go/baml_go/function.gobaml_language/sdks/go/baml_go/internal/cffi/include/baml_cffi.hbaml_language/sdks/go/baml_go/native_darwin_test.gobaml_language/sdks/go/baml_go/native_unix.gobaml_language/sdks/go/baml_go/native_unsupported.gobaml_language/sdks/go/baml_go/native_windows.gobaml_language/sdks/go/baml_go/runtime.gobaml_language/sdks/go/bridge_go/cffi/bridge.hbaml_language/sdks/go/bridge_go/cffi/lib.gobaml_language/sdks/go/bridge_go/pkg/proto.gobaml_language/sdks/go/bridge_go/pkg/runtime.gobaml_language/sdks/go/sdkgen_go/src/lib.rsbaml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/BamlFfi.javabaml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/internal/ProtoWriter.javabaml_language/sdks/java/bridge_java/src/lib.rsbaml_language/sdks/java/sdkgen_java/src/emit.rsbaml_language/sdks/java/sdkgen_java/src/lib.rsbaml_language/sdks/python/rust/bridge_python/src/baml_core/baml_py/__init__.pyibaml_language/sdks/python/rust/bridge_python/src/py_handle.rsbaml_language/sdks/python/rust/bridge_python/src/runtime.rsbaml_language/sdks/python/src/baml_bridge/__init__.pybaml_language/sdks/python/src/baml_bridge/_stream.pybaml_language/sdks/python/src/baml_bridge/baml_py.pyibaml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.pybaml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.pyibaml_language/sdks/python/src/baml_bridge/proto.pybaml_language/sdks/rust/bridge_rust/src/capi.rsbaml_language/sdks/rust/bridge_rust/src/function.rsbaml_language/sdks/rust/bridge_rust/src/runtime.rsbaml_language/sdks/rust/bridge_rust/src/wire/baml_bridge.cffi.v1.rsbaml_language/sdks/rust/sdkgen_rust/src/translate_ty.rsbaml_language/sdks/swift/Sources/BamlBridge/Api.swiftbaml_language/sdks/swift/Sources/BamlBridge/Encode.swiftbaml_language/sdks/swift/Sources/BamlBridge/Proto/.generated-frombaml_language/sdks/swift/Sources/BamlBridge/Proto/baml_inbound.pb.swiftbaml_language/sdks/swift/Sources/BamlBridge/Runtime.swiftbaml_language/sdks/swift/Sources/CBamlBridge/include/baml_cffi.hbaml_language/sdks/typescript/bridge_typescript/src/errors.rsbaml_language/sdks/typescript/bridge_typescript/src/runtime.rsbaml_language/sdks/typescript/bridge_typescript/typescript_src/define_function.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/index.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/native.d.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.d.tsbaml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.jsbaml_language/sdks/typescript/bridge_typescript/typescript_src/stream.tsbaml_language/sdks/typescript/bridge_typescript_web/src/errors.rsbaml_language/sdks/typescript/bridge_typescript_web/src/runtime.rsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/index.tsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/native.tsbaml_language/sdks/typescript/bridge_typescript_web/typescript_src/wasm/bridge_web_core.d.tsmise.tomlrelease/bridge-cffi-public-exports.txt
💤 Files with no reviewable changes (6)
- baml_language/sdks/swift/Sources/BamlBridge/Api.swift
- baml_language/crates/bridge_cffi/tests/abi_layout.c
- release/bridge-cffi-public-exports.txt
- baml_language/crates/bridge_cffi/tests/abi_layout.rs
- baml_language/crates/bridge_cffi/tests/abi_assertions.h
- baml_language/crates/bridge_cffi/cbindgen.toml
🚧 Files skipped from review as they are similar to previous changes (46)
- baml_language/sdks/swift/Sources/BamlBridge/Proto/.generated-from
- baml_language/sdks/swift/Sources/BamlBridge/Encode.swift
- baml_language/sdks/typescript/bridge_typescript_web/src/errors.rs
- baml_language/crates/bridge_cffi/src/error.rs
- baml_language/sdks/cpp/bridge_cpp/include/baml/detail/call.h
- baml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.d.ts
- baml_language/sdks/go/baml_go/native_unsupported.go
- baml_language/sdks/typescript/bridge_typescript/typescript_src/native.d.ts
- baml_language/sdks/go/bridge_go/pkg/runtime.go
- baml_language/sdks/python/rust/bridge_python/src/py_handle.rs
- baml_language/sdks/csharp/bridge_csharp/src/Cffi/EncodedCallArguments.cs
- baml_language/sdks/go/bridge_go/cffi/lib.go
- baml_language/sdks/go/bridge_go/cffi/bridge.h
- baml_language/sdks/typescript/bridge_typescript_web/typescript_src/index.ts
- baml_language/sdks/python/src/baml_bridge/proto.py
- baml_language/sdks/typescript/bridge_typescript/typescript_src/stream.ts
- baml_language/sdks/typescript/bridge_typescript/src/errors.rs
- baml_language/sdks/cpp/bridge_cpp/include/baml/detail/proto.h
- baml_language/sdks/rust/bridge_rust/src/wire/baml_bridge.cffi.v1.rs
- baml_language/sdks/swift/Sources/BamlBridge/Runtime.swift
- baml_language/sdks/typescript/bridge_typescript/typescript_src/define_function.ts
- baml_language/sdks/python/src/baml_bridge/_stream.py
- baml_language/sdks/python/rust/bridge_python/src/baml_core/baml_py/init.pyi
- baml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.py
- baml_language/sdks/typescript/bridge_typescript_web/typescript_src/wasm/bridge_web_core.d.ts
- baml_language/sdks/go/baml_go/native_windows.go
- baml_language/sdks/typescript/bridge_typescript/typescript_src/index.ts
- baml_language/sdks/typescript/bridge_typescript/typescript_src/proto.ts
- baml_language/sdks/typescript/bridge_typescript_web/typescript_src/native.ts
- baml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/BamlFfi.java
- baml_language/sdks/python/src/baml_bridge/baml_py.pyi
- baml_language/sdks/go/baml_go/runtime.go
- baml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.js
- baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.h
- baml_language/sdks/java/baml_bridge/src/main/java/baml_bridge/internal/ProtoWriter.java
- baml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeApi.cs
- baml_language/crates/bridge_cffi/src/api.rs
- baml_language/sdks/csharp/bridge_csharp/src/Cffi/NativeTypes.cs
- baml_language/sdks/swift/Sources/BamlBridge/Proto/baml_inbound.pb.swift
- baml_language/sdks/go/baml_go/internal/cffi/include/baml_cffi.h
- baml_language/sdks/python/src/baml_bridge/init.py
- baml_language/sdks/rust/bridge_rust/src/runtime.rs
- baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.cc
- baml_language/sdks/typescript/bridge_typescript/src/runtime.rs
- baml_language/sdks/java/bridge_java/src/lib.rs
- baml_language/crates/bridge_cffi/src/lib_native.rs
eaf39f2 to
59e70da
Compare
59e70da to
24228e3
Compare
24228e3 to
5797bd1
Compare
Summary
CallFunctionArgs.call_target.call_functionC ABI export and remove the appendedcall_handlesurface.protoc-gen-swiftto the mise toolchain so the Swift SDK bindings can be regenerated locally.Review follow-up from #4220
context.Context.OptionalArg<T>, reject empty wire parameter names, document unsafe handle dispatch, and add handle lifetime/arity/omission tests.argNnames and fail generation explicitly for optional returned callables until Java can preserve omitted versus explicit-null values.Review follow-up from #4245
BamlApiV1function-table ABI revision to 2 so revision-1 hosts and runtimes reject the changedcall_functionpointer signature before reading the slot.type_argssupplied with a function-handle target and omitted required callable arguments as invalid arguments across the shared outbound error path.baml.errors.HostCallablevalue with same-process error identity.Stack
Built on #4220, which has now merged into
canary; this PR was rebased onto its merge commit and contains one follow-up commit.Test plan
mise exec -- cargo test -p bridge_cffi --testsmise exec -- cargo test -p baml_bridge -p sdkgen_cpp -p sdkgen_csharp -p bridge_typescript -p bridge_typescript_web -p bridge_python -p bridge_javamise exec -- go test ./...in bothsdks/go/baml_goandsdks/go/bridge_gofunction_callsmatrix across Python, Node, browser, Workers, Go, C++, Rust, Swift, C#, and Javamise run clippy, formatting, and repository prek hooksSummary by CodeRabbit
New Features
Breaking Changes
Bug Fixes