Skip to content

feat(go): expand generated SDK completeness - #4147

Merged
hellovai merged 25 commits into
canaryfrom
codex/go-baml-bridge-pass-2
Jul 23, 2026
Merged

feat(go): expand generated SDK completeness#4147
hellovai merged 25 commits into
canaryfrom
codex/go-baml-bridge-pass-2

Conversation

@hellovai

@hellovai hellovai commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Outcome

This makes the generated Go SDK usable across the broad static/runtime surface we have completed so far, while keeping unsupported BAML shapes omitted instead of emitting uncompilable Go.

Before, Go generation covered the initial free-function and basic-type slice. After this PR, generated callers can use packages/namespaces, classes, enums, optionals/defaults, closed and dynamic unions, aliases, generic classes/functions, media, canonical JSON, reflected type values, opaque $rust_type handles, host callbacks, methods/static methods, parse/build-request companions, cancellation, and BAML time values through one Go-native API.

result, err := baml_sdk.UserExtract(ctx, input)

Generated classes, closed unions, and callbacks remain statically typed where the configured union threshold permits it. Larger unions intentionally project to any, retain candidate documentation, and rely on BAML's runtime validation.

User-visible behavior

  • Generates one Go package per BAML package, with namespace-qualified declarations inside it so BAML namespace cycles do not become Go import cycles.
  • Applies one canonical typed naming projection while retaining exact wire names for FFI serialization.
  • Generates compile-safe free functions, instance/static methods, functional options for defaulted arguments, and callback option structs for optional callback parameters.
  • Supports recursive classes, enums, lists/maps, nullability, literals, aliases, generic type arguments, media, JSON, reflected types, opaque Rust handles, and canonical union arm selection.
  • Preserves exact selected-node type information across the final shared inbound wire contract from feat: upstream SDK codegen and runtime foundations #4087, including ambiguous empty containers and nullable bigint containers.
  • Omits unsupported functions without breaking the rest of the generated package.
  • Wires Go generation into the normal CLI flow and mirrors the shared SDK fixture harness.

Audit map

Review in this order:

  1. baml_language/sdks/go/sdkgen_go/src/types.rs — canonical BAML-to-Go semantic projection and support filtering.
  2. baml_language/sdks/go/sdkgen_go/src/names.rs — collision-safe name allocation and exact wire identity.
  3. baml_language/sdks/go/sdkgen_go/src/lib.rs — package layout, declarations, codecs, functions, methods, callbacks, and descriptors.
  4. baml_language/sdks/go/baml_go/ — runtime encoding/decoding, ownership, callbacks, media, JSON, reflected types, and handles.
  5. baml_language/sdk_tests/crates/go/ plus Go customizable fixtures — generated compile/runtime coverage and Python-parity tests.
  6. baml_language/crates/baml_cli/ and sdk_tests/harness_setup/src/go.rs — CLI and test-harness integration.

Validation

Final post-#4087 sync validation:

  • cargo test -p sdkgen_go — 84/84 passed
  • cargo test -p bex_external_types — 21/21 passed; 3 doctests ignored
  • cargo test -p bex_engine --test host_value_callable — 23 passed; 1 documented compiler-gap test ignored
  • cargo nextest run -p sdk_test_go --no-fail-fast — 9/9 passed
  • Go runtime unit suite — passed
  • Repository pre-commit formatting, conflict checks, Clippy, and cargo-hawk dead-public analysis — passed

Deliberate remaining scope

  • Streaming implementation is deferred.
  • Large unions intentionally use any above the configured typed-union threshold.
  • Structured BAML error values are currently surfaced to Go primarily through error text/trace behavior.
  • Packaging, publication, and coordinated nightly/canary releases are follow-up release work rather than generator semantics.

Summary by CodeRabbit

  • New Features
    • Added Go-only max_typed_union_arity setting (default 3) with baml.toml template support, validation, and generation behavior for typed unions.
    • Expanded the Go SDK with typed-union tuning support plus stronger generics, JSON-algebra utilities, media/time/reflection helpers, and improved host-callable integration.
  • Bug Fixes
    • Improved generated Go output installation to safely replace stale files while preserving user-created ones.
  • Tests
    • Added/extended extensive Go generator and SDK test suites, including additional gofmt-clean generation and broader runtime edge coverage.

hellovai added 19 commits July 16, 2026 22:51
…e-pass-2

# Conflicts:
#	baml_language/crates/baml_project/src/client_codegen.rs
#	baml_language/crates/bex_engine/src/conversion.rs
#	baml_language/crates/bex_engine/tests/host_value_callable.rs
#	baml_language/crates/bex_external_types/src/host_return.rs
#	baml_language/crates/bex_external_types/src/lib.rs
#	baml_language/crates/bridge_cffi/src/ffi/host_value.rs
#	baml_language/crates/bridge_ctypes/README.md
#	baml_language/crates/bridge_ctypes/src/error.rs
#	baml_language/crates/bridge_ctypes/src/ty_decode.rs
#	baml_language/crates/bridge_ctypes/src/value_decode.rs
#	baml_language/crates/bridge_ctypes/src/value_encode.rs
#	baml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/baml_inbound.proto
#	baml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/baml_outbound.proto
#	baml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/baml_type.proto
#	baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.cc
#	baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_outbound.pb.cc
#	baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_outbound.pb.h
#	baml_language/sdks/go/baml_go/class.go
#	baml_language/sdks/go/baml_go/internal/cffi/baml_inbound.pb.go
#	baml_language/sdks/go/baml_go/internal/cffi/baml_outbound.pb.go
#	baml_language/sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/baml_inbound.pb.go
#	baml_language/sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/baml_outbound.pb.go
#	baml_language/sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/baml_type.pb.go
#	baml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.py
#	baml_language/sdks/python/src/baml_bridge/cffi/v1/baml_inbound_pb2.pyi
#	baml_language/sdks/python/src/baml_bridge/cffi/v1/baml_outbound_pb2.py
#	baml_language/sdks/python/src/baml_bridge/cffi/v1/baml_outbound_pb2.pyi
#	baml_language/sdks/rust/bridge_rust/src/baml_value.rs
#	baml_language/sdks/rust/bridge_rust/src/wire/baml_bridge.cffi.v1.rs
#	baml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.d.ts
#	baml_language/sdks/typescript/bridge_typescript/dist/proto/baml_cffi.js
#	baml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.d.ts
#	baml_language/sdks/typescript/bridge_typescript/typescript_src/proto/baml_cffi.js
#	typescript2/pkg-proto/src/encode.ts
@vercel

vercel Bot commented Jul 23, 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 Jul 23, 2026 6:23pm
promptfiddle Ready Ready Preview, Comment Jul 23, 2026 6:23pm
promptfiddle2 Ready Ready Preview, Comment Jul 23, 2026 6:23pm

Request Review

@coderabbitai

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 573822e8-4d00-4c0c-98df-1b4393f870ad

📥 Commits

Reviewing files that changed from the base of the PR and between c72a569 and acbb37d.

📒 Files selected for processing (7)
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdk_tests/crates/go/src/lib.rs
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_rust_type_edges/types.baml
  • baml_language/sdks/go/sdkgen_go/src/formatting.rs
  • baml_language/sdks/go/sdkgen_go/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • baml_language/sdk_tests/crates/go/src/lib.rs
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_rust_type_edges/types.baml
  • baml_language/sdks/go/sdkgen_go/src/formatting.rs
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/sdks/go/sdkgen_go/src/lib.rs

📝 Walkthrough

Walkthrough

This PR adds Go union-arity configuration, projection-aware generation, generic and dynamic runtime support, transactional generated-output installation, C# migration to the shared writer, and extensive cross-SDK fixtures and tests.

Changes

Go SDK generation and runtime

Layer / File(s) Summary
Generator configuration and projection
baml_cli/..., sdkgen_go/src/*
Adds max_typed_union_arity, projection-aware Go type and codec generation, generic and method support, naming, formatting, and union/callback handling.
Go runtime and native bridge
baml_go/*
Adds transactional inputs, generic calls, dynamic decoding, JSON, media and Rust handles, union validation, host-call dispatch, and native bridge operations.
Fixtures and integration tests
sdk_tests/fixtures/*, sdk_tests/crates/go/*
Adds coverage for generated types, callbacks, methods, unions, media, JSON, time, reflection, LLM companions, opaque values, and error behavior.

Shared generated-output writer

Layer / File(s) Summary
Transactional writer and adoption
baml_codegen_types/*, sdk_tests/harness_setup/*, sdkgen_csharp/*
Adds validated transactional output installation with recovery and ownership tracking, then adopts it across harnesses and C# generation.

Other SDK adjustments

Layer / File(s) Summary
Rust and Swift updates
sdkgen_rust/*, TestEnums.swift, TestHandles.swift
Adds an instance-method clippy allowance, removes FileContent::as_bytes, and trims selected Swift tests.

Estimated code review effort: 5 (Critical) | ~180 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Runtime as BAML Runtime
  participant Go as Go SDK
  participant Callable as HostCallableFunc
  Runtime->>Go: Dispatch host-call payload
  Go->>Go: Validate and decode arguments
  Go->>Callable: Invoke callback
  Callable-->>Go: Return result or error
  Go->>Runtime: Complete host call
Loading
sequenceDiagram
  participant Generator as SDK Generator
  participant Writer as write_generated_output
  participant Target as Output Directory
  Generator->>Writer: GeneratedOutputFile list
  Writer->>Writer: Validate and stage output
  Writer->>Target: Install generated tree
  Writer-->>Generator: OutputWriterReport
Loading

Suggested reviewers: rossirpaulo, 2kai2kai2, antoniosarosi

Poem

A rabbit hops through Go-shaped code,
Typed unions bloom along the road,
Handles cloned and safely freed,
Writers stage what generators need,
Hop, commit, and off we go! 🐇🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: expanding the generated Go SDK surface and completeness.
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.
✨ 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 codex/go-baml-bridge-pass-2

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.

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

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Binary size checks passed

7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
baml-cli Linux 🔒 26.7 MB 11.4 MB file 26.2 MB +544.7 KB (+2.1%) OK
packed-program Linux 🔒 17.3 MB 7.2 MB file 17.0 MB +287.7 KB (+1.7%) OK
baml-cli macOS 🔒 20.7 MB 9.9 MB file 20.3 MB +430.5 KB (+2.1%) OK
packed-program macOS 🔒 13.5 MB 6.3 MB file 13.2 MB +297.6 KB (+2.3%) OK
baml-cli Windows 🔒 22.4 MB 10.1 MB file 21.9 MB +472.6 KB (+2.2%) OK
packed-program Windows 🔒 14.4 MB 6.4 MB file 14.2 MB +248.3 KB (+1.8%) OK
bridge_wasm WASM 16.4 MB 🔒 4.5 MB gzip 4.4 MB +61.9 KB (+1.4%) 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

@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: 2

🧹 Nitpick comments (1)
baml_language/sdk_tests/harness_setup/src/lib.rs (1)

242-251: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add unit tests for the new harness filesystem-traversal logic. Both sites add new recursive/selective filesystem logic to .rs files without a dedicated Rust unit test, which the repo's coding guidelines prefer over relying solely on the downstream integration tests to catch regressions.

  • baml_language/sdk_tests/harness_setup/src/lib.rs#L242-L251: add a unit test for copy_customizable's new directory-recursion branch (e.g., build a small nested tempdir tree and assert the copied tree matches).
  • baml_language/sdk_tests/harness_setup/src/go.rs#L131-L146: add a unit test for stage_output's selective cleanup, asserting .baml/target entries survive while everything else under generated/ is removed.
🤖 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/sdk_tests/harness_setup/src/lib.rs` around lines 242 - 251, The
new filesystem traversal logic lacks dedicated Rust unit coverage. In
baml_language/sdk_tests/harness_setup/src/lib.rs:242-251, add a unit test for
copy_customizable that creates a nested temporary directory tree and verifies
the recursive copy preserves it; in
baml_language/sdk_tests/harness_setup/src/go.rs:131-146, add a unit test for
stage_output that verifies .baml and target entries remain while all other
generated/ contents are removed.

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/sdk_tests/crates/go/src/lib.rs`:
- Around line 60-71: Update collect_go_files to return immediately when
fs::read_dir reports a NotFound error for the requested directory, treating the
missing generated/baml_sdk fixture as empty. Preserve the existing panic
behavior for other read_dir errors and directory-entry failures, so the final
checked > 0 assertion handles fixtures with no collected Go files.

In
`@baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_rust_type_edges/types.baml`:
- Around line 10-36: Update every function parameter declaration in
make_opaque_response, read_opaque_response, round_trip_opaque_response,
round_trip_optional_opaque_response, round_trip_opaque_responses,
round_trip_opaque_response_map, and round_trip_response_envelope to use
colon-separated name: Type syntax, preserving the existing parameter names and
types.

---

Nitpick comments:
In `@baml_language/sdk_tests/harness_setup/src/lib.rs`:
- Around line 242-251: The new filesystem traversal logic lacks dedicated Rust
unit coverage. In baml_language/sdk_tests/harness_setup/src/lib.rs:242-251, add
a unit test for copy_customizable that creates a nested temporary directory tree
and verifies the recursive copy preserves it; in
baml_language/sdk_tests/harness_setup/src/go.rs:131-146, add a unit test for
stage_output that verifies .baml and target entries remain while all other
generated/ contents are removed.
🪄 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: f859af7a-f955-4063-9416-cb3a3f6f43de

📥 Commits

Reviewing files that changed from the base of the PR and between ceae8ea and de99010.

📒 Files selected for processing (97)
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_cli/src/init_command.rs
  • baml_language/crates/baml_cli/src/manifest.rs
  • baml_language/sdk_tests/crates/go/docstrings_etc/.gitignore
  • baml_language/sdk_tests/crates/go/docstrings_etc/customizable/go_codegen_edges_test.go
  • baml_language/sdk_tests/crates/go/docstrings_etc/customizable/test_main_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/go_codegen_edges_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/main_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_cancellation_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_errors_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_generics_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_host_callables_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_json_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_main_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_methods_on_classes_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_optional_args_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_reflected_type_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_static_methods_test.go
  • baml_language/sdk_tests/crates/go/function_calls/customizable/test_time_values_test.go
  • baml_language/sdk_tests/crates/go/llm_functions/customizable/test_build_request_stream_companions_test.go
  • baml_language/sdk_tests/crates/go/llm_functions/customizable/test_main_test.go
  • baml_language/sdk_tests/crates/go/llm_functions/customizable/test_parse_companions_test.go
  • baml_language/sdk_tests/crates/go/package_edges/customizable/compile_test.go
  • baml_language/sdk_tests/crates/go/src/lib.rs
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/go_codegen_edges_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/go_codegen_union_edges_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_aliases_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_class_refs_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_enums_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_forward_refs_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_generics_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_lists_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_literals_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_maps_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_media_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_optional_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_primitives_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_recursion_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_routing_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_rust_type_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_streams_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_symbol_collisions_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_unions_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/roundtrip_tests/test_void_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/test_complex_models_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/test_generic_test.go
  • baml_language/sdk_tests/crates/go/type_shapes/customizable/test_main_test.go
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_generic_tests/types.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_go_json_tests/main.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_go_time_tests/main.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_go_type_tests/main.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_host_callable_tests/main.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_method_self_edges/types.baml
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_static_method_edges/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_alias_edges/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_rust_type_edges/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_union_edges/ns_left/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_union_edges/ns_right/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_go_codegen/ns_union_edges/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_media/types.baml
  • baml_language/sdk_tests/harness_setup/src/go.rs
  • baml_language/sdk_tests/harness_setup/src/lib.rs
  • baml_language/sdks/cpp/bridge_cpp/pb/baml_bridge/cffi/v1/baml_inbound.pb.h
  • baml_language/sdks/go/baml_go/class.go
  • baml_language/sdks/go/baml_go/container.go
  • baml_language/sdks/go/baml_go/container_test.go
  • baml_language/sdks/go/baml_go/dynamic.go
  • baml_language/sdks/go/baml_go/dynamic_test.go
  • baml_language/sdks/go/baml_go/enum.go
  • baml_language/sdks/go/baml_go/generics_test.go
  • baml_language/sdks/go/baml_go/host_callable.go
  • baml_language/sdks/go/baml_go/host_callable_test.go
  • baml_language/sdks/go/baml_go/input_ownership_test.go
  • baml_language/sdks/go/baml_go/json.go
  • baml_language/sdks/go/baml_go/json_test.go
  • baml_language/sdks/go/baml_go/literal_test.go
  • baml_language/sdks/go/baml_go/media.go
  • baml_language/sdks/go/baml_go/media_ownership_test.go
  • baml_language/sdks/go/baml_go/media_test.go
  • baml_language/sdks/go/baml_go/native_unix.go
  • baml_language/sdks/go/baml_go/native_unsupported.go
  • baml_language/sdks/go/baml_go/native_windows.go
  • baml_language/sdks/go/baml_go/optional_arg.go
  • baml_language/sdks/go/baml_go/optional_arg_test.go
  • baml_language/sdks/go/baml_go/runtime.go
  • baml_language/sdks/go/baml_go/runtime_test.go
  • baml_language/sdks/go/baml_go/rust_type.go
  • baml_language/sdks/go/baml_go/rust_type_test.go
  • baml_language/sdks/go/baml_go/type_test.go
  • baml_language/sdks/go/baml_go/value.go
  • baml_language/sdks/go/baml_go/value_test.go
  • baml_language/sdks/go/sdkgen_go/src/formatting.rs
  • baml_language/sdks/go/sdkgen_go/src/lib.rs
  • baml_language/sdks/go/sdkgen_go/src/names.rs
  • baml_language/sdks/go/sdkgen_go/src/rendering.rs
  • baml_language/sdks/go/sdkgen_go/src/types.rs
  • typescript2/pkg-proto/src/test/encode-decode.test.ts
💤 Files with no reviewable changes (1)
  • baml_language/sdk_tests/crates/go/function_calls/customizable/main_test.go

Comment thread baml_language/sdk_tests/crates/go/src/lib.rs

@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/baml_cli/src/generate.rs`:
- Around line 302-312: Update the generation flow around write_generated_output
so an initial generation into an existing SDK directory does not adopt all
unmanifested files as generated or delete them as stale; preserve unmanaged
legacy files while still removing previously generated stale outputs safely.
Extend the e2e coverage to create a user-owned file before the first manifest is
written and verify it survives generation.
🪄 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: 9bcc85d4-eaa8-4884-89c6-043b63a4fd5b

📥 Commits

Reviewing files that changed from the base of the PR and between de99010 and f579df4.

⛔ Files ignored due to path filters (1)
  • baml_language/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/crates/baml_codegen_types/Cargo.toml
  • baml_language/crates/baml_codegen_types/src/lib.rs
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/sdk_tests/harness_setup/src/cpp.rs
  • baml_language/sdk_tests/harness_setup/src/go.rs
  • baml_language/sdk_tests/harness_setup/src/java.rs
  • baml_language/sdk_tests/harness_setup/src/lib.rs
  • baml_language/sdk_tests/harness_setup/src/python_pydantic2.rs
  • baml_language/sdk_tests/harness_setup/src/rust.rs
  • baml_language/sdk_tests/harness_setup/src/swift.rs
  • baml_language/sdk_tests/harness_setup/src/typescript.rs
  • baml_language/sdk_tests/harness_setup/src/typescript_web.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/transaction.rs
  • baml_language/sdks/go/baml_go/dynamic.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/sdk_tests/harness_setup/src/go.rs
  • baml_language/sdks/go/baml_go/dynamic.go

Comment thread baml_language/crates/baml_cli/src/generate.rs

@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/baml_codegen_types/src/output_writer.rs`:
- Around line 460-473: Update validate_no_file_directory_collisions to check
each sorted path against all of its ancestor directory prefixes, rather than
only adjacent entries via windows(2). Preserve case-insensitive matching and
return FileDirectoryPathCollision for the conflicting ancestor so both
validate_generated_files and validate_preserved_paths detect non-adjacent
collisions.
🪄 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: 4a4c616c-6d0c-492d-b4e3-72aeffec6b24

📥 Commits

Reviewing files that changed from the base of the PR and between f579df4 and 5bb838b.

⛔ Files ignored due to path filters (1)
  • baml_language/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/crates/baml_codegen_types/Cargo.toml
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestEnums.swift
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestHandles.swift
  • baml_language/sdk_tests/harness_setup/src/rust.rs
  • baml_language/sdks/csharp/sdkgen_csharp/Cargo.toml
  • baml_language/sdks/csharp/sdkgen_csharp/src/lib.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/output.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/pipeline.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/semantic.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/transaction.rs
  • baml_language/sdks/rust/sdkgen_rust/src/emit/function.rs
  • baml_language/sdks/rust/sdkgen_rust/src/lib.rs
💤 Files with no reviewable changes (5)
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestEnums.swift
  • baml_language/sdks/csharp/sdkgen_csharp/Cargo.toml
  • baml_language/sdks/rust/sdkgen_rust/src/lib.rs
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestHandles.swift
  • baml_language/sdks/csharp/sdkgen_csharp/src/transaction.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • baml_language/crates/baml_codegen_types/Cargo.toml
  • baml_language/sdk_tests/harness_setup/src/rust.rs
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs

Comment thread baml_language/crates/baml_codegen_types/src/output_writer.rs

@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

🧹 Nitpick comments (1)
baml_language/sdks/cpp/sdkgen_cpp/src/lib.rs (1)

2273-2353: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Good unit-test coverage for the new completeness helpers, consider adding an alias-wrapped-class case.

The three tests correctly validate ordinary vs. optional-arg semantics across containers and alias-declaration ordering. As per coding guidelines (**/*.rs: "Prefer writing Rust unit tests over integration tests where possible"), these are appropriately scoped #[test] unit tests. Given the gap flagged on incomplete_stored_type_issue (lines 1237-1269), consider adding a case with Ty::TypeAlias wrapping an incomplete class to lock in the fix.

🤖 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/cpp/sdkgen_cpp/src/lib.rs` around lines 2273 - 2353,
Extend
declaration_safety_tests::optional_arg_storage_rejects_later_classes_in_every_container
with a Ty::TypeAlias case wrapping the incomplete user.Later class, and assert
incomplete_stored_type_issue reports the same incomplete-class message before
Later is complete and no issue afterward.

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/sdks/cpp/sdkgen_cpp/src/lib.rs`:
- Around line 1237-1269: Update incomplete_stored_type_issue to recurse through
every Ty::TypeAlias using its resolves_to target, while retaining the existing
recursive-alias diagnostic where applicable. Ensure aliases resolving to
incomplete classes or nested container types are detected, and extend the
declaration-safety tests to cover non-recursive alias targets.

---

Nitpick comments:
In `@baml_language/sdks/cpp/sdkgen_cpp/src/lib.rs`:
- Around line 2273-2353: Extend
declaration_safety_tests::optional_arg_storage_rejects_later_classes_in_every_container
with a Ty::TypeAlias case wrapping the incomplete user.Later class, and assert
incomplete_stored_type_issue reports the same incomplete-class message before
Later is complete and no issue afterward.
🪄 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: 10a6fd2a-b32e-4796-bc3f-609b6fb58583

📥 Commits

Reviewing files that changed from the base of the PR and between 5bb838b and c72a569.

📒 Files selected for processing (4)
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestHandles.swift
  • baml_language/sdks/cpp/sdkgen_cpp/src/lib.rs
  • baml_language/sdks/go/sdkgen_go/src/formatting.rs
💤 Files with no reviewable changes (1)
  • baml_language/sdk_tests/crates/swift/type_shapes/customizable/roundtrip_tests/TestHandles.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/sdks/go/sdkgen_go/src/formatting.rs
  • baml_language/crates/baml_codegen_types/src/output_writer.rs

Comment thread baml_language/sdks/cpp/sdkgen_cpp/src/lib.rs
@hellovai
hellovai added this pull request to the merge queue Jul 23, 2026
Merged via the queue into canary with commit 9aae01e Jul 23, 2026
69 of 70 checks passed
@hellovai
hellovai deleted the codex/go-baml-bridge-pass-2 branch July 23, 2026 18:23
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