Skip to content

feat(sdk-ts): implement the ts/nodejs SDK generator - #3614

Merged
sxlijin merged 9 commits into
canaryfrom
sam/nodejs
Jun 2, 2026
Merged

sxlijin merged 9 commits into
canaryfrom
sam/nodejs

Conversation

@sxlijin

@sxlijin sxlijin commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added Node.js/TypeScript SDK with full code generation support
    • Introduced media wrapper types (Image, Audio, Video, PDF) with URL/file/base64 constructors
    • Added Stream wrapper for async streaming operations
    • Implemented function and method binding factories for generated code
  • Bug Fixes

    • Improved error classification with new BamlPanic error type for runtime panics
  • Chores

    • Renamed Node.js package from @boundaryml/baml-node to @boundaryml/baml-core
    • Added CI/CD workflow for building and publishing Node.js SDK

@vercel

vercel Bot commented May 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, Comment Jun 2, 2026 9:55pm
promptfiddle Ready Ready Preview, Comment Jun 2, 2026 9:55pm
promptfiddle2 Ready Ready Preview, Comment Jun 2, 2026 9:55pm

Request Review

@coderabbitai

coderabbitai Bot commented May 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

Adds TypeScript/Node SDK generation, expands the Node bridge (runtime init, media, streams, typemap, error handling), updates engine coercions, wires CLI output type, implements full codegen, overhauls tests/harness, and introduces CI build/publish workflows and package rename.

Changes

Node.js TypeScript SDK: codegen, bridge, tests, and release

Layer / File(s) Summary
JS/TS bridge surface and proto flow
baml_language/sdks/nodejs/bridge_nodejs/{index.*,define_function.*,errors.*,exit_hook.*,ctx_manager.js,typemap.*,stream.*,proto.*}, .../typescript_src/*
Adds function/instance factories, UNSET sentinel, exit-hook, broader exports, typemap runtime, streams, and typemap-aware proto encode/decode with refined error/panic handling.
Rust N-API runtime, handles, media, engine coercions
.../src/{runtime.rs,handle.rs,media.rs,lib.rs}, crates/bex_engine/src/conversion.rs
Exposes initializeRuntime/getRuntime, handle table put/take and seed helpers, media wrappers, public modules, and class-arm coercion in unions.
CLI/output type wiring
crates/baml_cli/src/generate.rs, crates/baml_codegen_types/src/generator_fields.rs, crates/baml_cli/Cargo.toml
Adds TypescriptNode output type and routes generation to codegen_nodejs.
Node codegen implementation
sdks/nodejs/codegen_nodejs/src/{routing.rs,translate_ty.rs,emit/*,lib.rs}
Implements routing, TS type translation, per-leaf emit (classes/enums/types/functions), typemap module, and codegen entry with inlined BAML files.
CI, packaging, native loader, release doc
.github/workflows/*, bridge_nodejs/package.json, bridge_nodejs/native.js, RELEASE.md, setup template
Reusable Node build, optional npm publish, package rename to @boundaryml/baml-core, proto copy step, loader package map updates, and release guide.
Harness, workspace, fixtures, and tests
sdk_tests/**, Cargo.toml, .config/nextest.toml
Renames harness to typescript_node, updates setup scripts/config/docs, adds complex fixtures, and extensive TS/Python tests across features.

Sequence Diagram(s)

sequenceDiagram
  participant Generator as Codegen (Rust)
  participant SDK as Generated TS SDK
  participant Bridge as Bridge JS/TS
  participant NAPI as Rust N-API
  participant Engine as Core Engine

  Generator->>SDK: Emit index.ts, _typemap.ts, _inlinedbaml.ts
  SDK->>Bridge: defineFunction/defineInstanceFunction(...) call
  Bridge->>NAPI: callFunction/Sync(bytes)
  NAPI->>Engine: Execute with union/class coercions
  Engine-->>NAPI: Serialized result or error/panic
  NAPI-->>Bridge: Bytes
  Bridge-->>SDK: Typemap-aware decode or throw BamlError/BamlPanic
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Poem

A rabbit taps npm with gentle paws,
Streams and handles hop through typemap laws.
Rust and Node now share a sunny glade,
Where classes, unions dance unafraid.
With zig and napi, crates aligned—
Release bells ring; artifacts signed.
Hippity-hop, ship it! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sam/nodejs

@vercel
vercel Bot temporarily deployed to Preview – beps May 30, 2026 16:06 Inactive

@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: 05da931edc

ℹ️ 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".

Comment on lines +35 to +38
/** Internal: expose the inner BamlHandle for inbound encode. */
_toHandle(): BamlHandle {
return this._handle;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clone stream handles before re-encoding

When a generated streaming call returns a BamlStream, any next()/final() invocation re-encodes self through _toHandle(). Returning the original BamlHandle key here makes the first pull consume it, because bridge_ctypes::value_decode::inbound_to_external drains every non-host handle with handle_table.drain(handle.key). A second next() or the later final() will then send a stale key and fail with an invalid handle; this should clone/allocate a fresh handle for each encode, like the media wrappers do.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented May 30, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 17.3 MB 7.4 MB file 24.1 MB -6.8 MB (-28.0%) OK
✅ packed-program Linux 🔒 12.7 MB 5.4 MB file 15.1 MB -2.4 MB (-16.2%) OK
✅ baml-cli macOS 🔒 13.2 MB 6.4 MB file 18.2 MB -5.0 MB (-27.4%) OK
✅ packed-program macOS 🔒 9.6 MB 4.7 MB file 11.5 MB -1.9 MB (-16.2%) OK
✅ baml-cli Windows 🔒 14.2 MB 6.5 MB file 19.6 MB -5.4 MB (-27.6%) OK
✅ packed-program Windows 🔒 10.2 MB 4.7 MB file 12.2 MB -2.1 MB (-16.8%) OK
✅ bridge_wasm WASM 11.6 MB 🔒 3.3 MB gzip 3.9 MB -587.5 KB (-15.2%) 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

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 May 30, 2026 16:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle May 30, 2026 16:23 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: 5

🧹 Nitpick comments (2)
baml_language/crates/bex_engine/src/conversion.rs (1)

1314-1347: 💤 Low value

Document the single-class-arm assumption more prominently.

The comment at line 1321 notes this is "sufficient while a union has at most one class member," but if a union has multiple class members (e.g., ClassA | ClassB), find_map returns the first one arbitrarily. This could silently coerce to the wrong type.

Consider adding a debug assertion or returning an error when multiple class arms exist, rather than silently picking the first.

🔧 Suggested enhancement
         (
             value @ (BexExternalValue::Map { .. } | BexExternalValue::Instance { .. }),
             Ty::Union(members, _),
         ) => {
-            if let Some(class_arm) = members.iter().find_map(union_class_arm) {
+            let class_arms: Vec<_> = members.iter().filter_map(union_class_arm).collect();
+            if class_arms.len() > 1 {
+                // Ambiguous: multiple class members in union; leave value unchanged
+                // for downstream type-checking to handle.
+                Ok(value)
+            } else if let Some(class_arm) = class_arms.into_iter().next() {
                 coerce_arg_to_declared_type(value, class_arm)
             } else {
                 Ok(value)
             }
         }
🤖 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_engine/src/conversion.rs` around lines 1314 - 1347,
The union-handling code currently uses members.iter().find_map(union_class_arm)
and silently picks the first class arm, which can misroute values when a union
has multiple class members; update the match arm that handles
(BexExternalValue::Map | Instance, Ty::Union(...)) to detect if more than one
class arm exists (e.g., by checking members.iter().filter(|m|
union_class_arm(m).is_some()).nth(1) or counting) and: if multiple class arms
are found either emit a clear debug_assert/panic in debug builds or return an
Err so the caller sees the ambiguity instead of coercing to an arbitrary class;
keep using coerce_arg_to_declared_type when exactly one class arm is present and
preserve existing Ok(value) behavior otherwise. Ensure references to
union_class_arm, coerce_arg_to_declared_type, and the Union match arm are
updated accordingly.
baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts (1)

21-42: ⚡ Quick win

Strengthen media roundtrip assertions beyond null checks.

These tests currently pass even if fields/type metadata are wrong, as long as a non-null object is returned. Please assert key media properties (or deep equality with source objects) to catch serialization regressions.

🤖 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/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts`
around lines 21 - 42, Replace the weak not-toBeNull assertions in the decode and
encode tests by asserting specific media properties or full deep-equality
against the original objects: call
return_image/return_audio/return_video/return_pdf with URL and capture the
returned object, then assert its key fields (e.g., url/source, mime_type,
size/length, and any type/metadata) match expected values; for round_trip_*
tests assert deep equality between the original media object passed (the
return_* result) and the result of round_trip_*; for round_trip_media construct
the Media instance from the return_* results and assert each field (image_field,
audio_field, video_field, pdf_field) deep-equals the corresponding source object
or check their critical properties rather than only not-toBeNull. Ensure you
reference and update tests around return_image, return_audio, return_video,
return_pdf, round_trip_image, round_trip_audio, round_trip_video,
round_trip_pdf, round_trip_media, and Media to perform these stronger
assertions.
🤖 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 @.github/workflows/build-nodejs-sdk.reusable.yaml:
- Around line 88-108: The workflow only enables Zig and the --cross-compile path
for musl targets, so aarch64-unknown-linux-gnu will run the non-cross branch and
fail to link on x86_64 runners; update the gating logic to treat non-native
Linux targets (e.g., aarch64-unknown-linux-gnu) as cross-compile targets by
extending the conditions that run mlugg/setup-zig and that choose the
--cross-compile branch in the "Install zig (musl cross-compile)" and "Build
native addon" steps (the matrix._.target checks), so that
aarch64-unknown-linux-gnu (and other non-native Linux arches) use the
cross-compile flow and pass the --cross-compile flag to napi build.

In
`@baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts`:
- Line 23: Replace exact float equality assertions with tolerant comparisons:
change tests that call expect(return_float()).toBe(3.14) (and the other float
assertions referenced at the same file, including the ones around lines 29 and
51) to use Jest's toBeCloseTo with a small precision, e.g.
expect(return_float()).toBeCloseTo(3.14, 2); update the assertions for the other
float-returning helpers in the same way so roundtrip float checks are tolerant
to minor serialization/runtime differences.

In `@baml_language/sdks/nodejs/bridge_nodejs/typescript_src/define_function.ts`:
- Around line 54-73: The generated callables in defineFunction and
defineInstanceFunction currently call rt.callFunctionSync / rt.callFunction
directly and may let native errors escape; wrap each
rt.callFunctionSync(bamlFqn, ...) and await rt.callFunction(bamlFqn, ...) in a
try/catch and on error rethrow wrapNativeError(err) before passing the resulting
bytes to decodeCallResult; update both the sync branch (the function returning
(...args) => { ... rt.callFunctionSync(...) ... }) and the async branch (the
async (...args) => { ... await rt.callFunction(...) ... }) to catch native
exceptions and rethrow wrapNativeError(err).

In `@baml_language/sdks/nodejs/bridge_nodejs/typescript_src/errors.ts`:
- Around line 50-63: wrapNativeError currently downgrades BamlPanic to a generic
BamlError; update wrapNativeError to preserve BamlPanic by either checking the
thrown object type first (if (err instanceof BamlPanic) return err) or by
extending PREFIX_MAP to include the panic message pattern (e.g., detect "baml
panic:" and return new BamlPanic(msg)); modify the function near the existing
PREFIX_MAP / wrapNativeError code so BamlPanic instances or panic-formatted
messages are returned as BamlPanic rather than BamlError.

In `@baml_language/sdks/nodejs/codegen_nodejs/src/lib.rs`:
- Around line 70-75: The assert! in to_source_code panics for unsupported
NamingConvention; change to a non-panicking API by updating the to_source_code
signature to return a Result (e.g., Result<String, ErrorType>) and replace the
assert! that checks matches!(naming_convention, NamingConvention::PreserveCase)
with an early-return Err containing a clear error (including the received
naming_convention) when it's unsupported; ensure callers of to_source_code are
updated to handle the Result and define/choose an appropriate ErrorType or use a
boxed dyn Error to represent this failure.

---

Nitpick comments:
In `@baml_language/crates/bex_engine/src/conversion.rs`:
- Around line 1314-1347: The union-handling code currently uses
members.iter().find_map(union_class_arm) and silently picks the first class arm,
which can misroute values when a union has multiple class members; update the
match arm that handles (BexExternalValue::Map | Instance, Ty::Union(...)) to
detect if more than one class arm exists (e.g., by checking
members.iter().filter(|m| union_class_arm(m).is_some()).nth(1) or counting) and:
if multiple class arms are found either emit a clear debug_assert/panic in debug
builds or return an Err so the caller sees the ambiguity instead of coercing to
an arbitrary class; keep using coerce_arg_to_declared_type when exactly one
class arm is present and preserve existing Ok(value) behavior otherwise. Ensure
references to union_class_arm, coerce_arg_to_declared_type, and the Union match
arm are updated accordingly.

In
`@baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts`:
- Around line 21-42: Replace the weak not-toBeNull assertions in the decode and
encode tests by asserting specific media properties or full deep-equality
against the original objects: call
return_image/return_audio/return_video/return_pdf with URL and capture the
returned object, then assert its key fields (e.g., url/source, mime_type,
size/length, and any type/metadata) match expected values; for round_trip_*
tests assert deep equality between the original media object passed (the
return_* result) and the result of round_trip_*; for round_trip_media construct
the Media instance from the return_* results and assert each field (image_field,
audio_field, video_field, pdf_field) deep-equals the corresponding source object
or check their critical properties rather than only not-toBeNull. Ensure you
reference and update tests around return_image, return_audio, return_video,
return_pdf, round_trip_image, round_trip_audio, round_trip_video,
round_trip_pdf, round_trip_media, and Media to perform these stronger
assertions.
🪄 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

Run ID: a65931ee-4425-467b-b44d-40664d31a813

📥 Commits

Reviewing files that changed from the base of the PR and between 066b6cb and 05da931.

⛔ Files ignored due to path filters (17)
  • baml_language/Cargo.lock is excluded by !**/*.lock
  • baml_language/sdks/nodejs/bridge_nodejs/ctx_manager.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/ctx_manager.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/define_function.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/define_function.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/errors.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/errors.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/exit_hook.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/exit_hook.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/index.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/index.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/proto.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/stream.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/stream.js.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/typemap.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/typemap.js.map is excluded by !**/*.map
📒 Files selected for processing (85)
  • .github/workflows/build-nodejs-sdk.reusable.yaml
  • .github/workflows/release-sdk.yaml
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/setup.ps1
  • baml_language/sdk_tests/crates/nodejs_typescript/setup.sh
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_streams.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/harness_setup/src/nodejs_typescript.rs
  • baml_language/sdk_tests/harness_setup/src/templates/package.json
  • baml_language/sdks/nodejs/RELEASE.md
  • baml_language/sdks/nodejs/bridge_nodejs/ctx_manager.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/ctx_manager.js
  • baml_language/sdks/nodejs/bridge_nodejs/define_function.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/define_function.js
  • baml_language/sdks/nodejs/bridge_nodejs/errors.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/errors.js
  • baml_language/sdks/nodejs/bridge_nodejs/exit_hook.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/exit_hook.js
  • baml_language/sdks/nodejs/bridge_nodejs/index.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/index.js
  • baml_language/sdks/nodejs/bridge_nodejs/native.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/native.js
  • baml_language/sdks/nodejs/bridge_nodejs/package.json
  • baml_language/sdks/nodejs/bridge_nodejs/proto
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js
  • baml_language/sdks/nodejs/bridge_nodejs/proto/baml_cffi.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/proto/baml_cffi.js
  • baml_language/sdks/nodejs/bridge_nodejs/src/handle.rs
  • baml_language/sdks/nodejs/bridge_nodejs/src/lib.rs
  • baml_language/sdks/nodejs/bridge_nodejs/src/media.rs
  • baml_language/sdks/nodejs/bridge_nodejs/src/runtime.rs
  • baml_language/sdks/nodejs/bridge_nodejs/stream.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/stream.js
  • baml_language/sdks/nodejs/bridge_nodejs/tests/call_function.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/host_callable.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_decode_handle.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_engine.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_media.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_stream.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_tracing.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_typemap.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typemap.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typemap.js
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/copy-proto.js
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/ctx_manager.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/define_function.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/errors.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/exit_hook.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/index.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/native.d.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/stream.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/typemap.ts
  • baml_language/sdks/nodejs/codegen_nodejs/Cargo.toml
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/class.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/enum_.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/function.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/method.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/mod.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/type_alias.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/typemap_file.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/leaf.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/lib.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/routing.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/translate_ty.rs
💤 Files with no reviewable changes (2)
  • baml_language/sdks/nodejs/bridge_nodejs/proto
  • baml_language/sdks/nodejs/bridge_nodejs/ctx_manager.d.ts

Comment on lines +54 to +73
if (mode === 'sync') {
return (...args: unknown[]): unknown => {
const merged = buildKwargs(args, names, requiredPositionalCount);
const rt = getRuntime();
const argsProto = encodeCallArgs(merged, /* syncMode */ true);
const resultBytes = rt.callFunctionSync(bamlFqn, argsProto, null, null, null);
return decodeCallResult(resultBytes);
};
}
if (mode === 'async') {
return async (...args: unknown[]): Promise<unknown> => {
const merged = buildKwargs(args, names, requiredPositionalCount);
const rt = getRuntime();
const argsProto = encodeCallArgs(merged);
const resultBytes = await rt.callFunction(bamlFqn, argsProto, null, null, null);
return decodeCallResult(resultBytes);
};
}
throw new Error(`mode must be 'sync' or 'async', got ${JSON.stringify(mode)}`);
}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# How wrapNativeError is defined and where it's applied.
fd -t f 'errors.ts' baml_language/sdks/nodejs/bridge_nodejs/typescript_src --exec sed -n '1,120p' {}
echo '--- wrapNativeError call sites ---'
rg -nP '\bwrapNativeError\s*\(' baml_language/sdks/nodejs/bridge_nodejs/typescript_src
echo '--- raw native callFunction(Sync) usages ---'
rg -nP '\b(callFunction|callFunctionSync)\s*\(' baml_language/sdks/nodejs/bridge_nodejs/typescript_src

Repository: BoundaryML/baml

Length of output: 4781


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo_root="."
target_dir="baml_language/sdks/nodejs/bridge_nodejs/typescript_src"

echo "=== define_function.ts relevant sections (include defineInstanceFunction) ==="
sed -n '1,220p' "$target_dir/define_function.ts" | nl -ba | sed -n '1,220p'

echo
echo "=== decodeCallResult implementation (proto) ==="
# Locate proto file that defines decodeCallResult
proto_file="$(fd -t f 'proto.*\.(ts|tsx|js|jsx)$|.*proto.*\.(ts|tsx)$' "$target_dir" | head -n 20 | head -n 1 || true)"
if [ -z "${proto_file}" ]; then
  proto_file="$(fd -t f '.*proto.*\.ts$' "$target_dir" | head -n 20 | head -n 1 || true)"
fi
echo "proto_file=$proto_file"
if [ -n "${proto_file}" ]; then
  rg -n "function decodeCallResult|export function decodeCallResult|decodeCallResult" "$proto_file"
  sed -n '1,240p' "$proto_file" | nl -ba | sed -n '1,240p'
else
  echo "Could not locate proto file via fd; falling back to rg across directory for decodeCallResult definition."
  proto_def_file="$(rg -l "decodeCallResult" "$target_dir" | head -n 20 | head -n 1 || true)"
  echo "proto_def_file=$proto_def_file"
  sed -n '1,240p' "$proto_def_file" | nl -ba | sed -n '1,240p'
fi

echo
echo "=== index.ts callFunction/callFunctionSync wrappers (for error surface) ==="
sed -n '1,230p' "$target_dir/index.ts" | nl -ba | sed -n '1,230p'

Repository: BoundaryML/baml

Length of output: 198


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target_dir="baml_language/sdks/nodejs/bridge_nodejs/typescript_src"

echo "=== define_function.ts (lines 1-220 with line numbers) ==="
sed -n '1,220p' "$target_dir/define_function.ts" | cat -n

echo
echo "=== define_function.ts: rt.callFunction*/decodeCallResult occurrences with context ==="
rg -n --context 3 "rt\.callFunctionSync|rt\.callFunction\(" "$target_dir/define_function.ts"
rg -n --context 3 "decodeCallResult\(" "$target_dir/define_function.ts"

echo
echo "=== locate decodeCallResult definition ==="
decode_file="$(rg -l "decodeCallResult" "$target_dir" | head -n 20 | tr '\n' ' ' )"
echo "decode_files(first 20): $decode_file"
decode_file_actual="$(rg -l "export function decodeCallResult|function decodeCallResult" "$target_dir" | head -n 1 || true)"
echo "decode_file_actual: ${decode_file_actual:-<none>}"

if [ -n "${decode_file_actual:-}" ]; then
  echo
  echo "=== decodeCallResult definition (first ~240 lines around match) ==="
  # Print a window around the first match
  first_match_line="$(rg -n "export function decodeCallResult|function decodeCallResult" "$decode_file_actual" | head -n 1 | cut -d: -f1)"
  start=$(( first_match_line > 80 ? first_match_line-80 : 1 ))
  end=$(( first_match_line + 240 ))
  sed -n "${start},${end}p" "$decode_file_actual" | cat -n
fi

echo
echo "=== index.ts: callFunction/callFunctionSync wrappers (line area around wrapNativeError) ==="
sed -n '90,210p' "$target_dir/index.ts" | cat -n

Repository: BoundaryML/baml

Length of output: 27474


Add wrapNativeError around native runtime calls in generated factories

define_function.ts’s generated callables (both defineFunction and defineInstanceFunction) call rt.callFunctionSync / rt.callFunction directly at lines 59/68 and 104/113, then pass bytes to decodeCallResult—with no wrapNativeError boundary. Any native exception thrown by the runtime will escape untyped, unlike the public callFunction/callFunctionSync entrypoints in index.ts, which catch and rethrow wrapNativeError(err) to preserve the BamlError hierarchy.

Update both factories to wrap the rt.callFunctionSync/rt.callFunction calls in try/catch and rethrow wrapNativeError(err) (keeping decodeCallResult as-is).

🤖 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/nodejs/bridge_nodejs/typescript_src/define_function.ts`
around lines 54 - 73, The generated callables in defineFunction and
defineInstanceFunction currently call rt.callFunctionSync / rt.callFunction
directly and may let native errors escape; wrap each
rt.callFunctionSync(bamlFqn, ...) and await rt.callFunction(bamlFqn, ...) in a
try/catch and on error rethrow wrapNativeError(err) before passing the resulting
bytes to decodeCallResult; update both the sync branch (the function returning
(...args) => { ... rt.callFunctionSync(...) ... }) and the async branch (the
async (...args) => { ... await rt.callFunction(...) ... }) to catch native
exceptions and rethrow wrapNativeError(err).

Comment on lines +70 to +75
// Only `PreserveCase` is wired up so far.
assert!(
matches!(naming_convention, NamingConvention::PreserveCase),
"codegen_nodejs only supports naming_convention = PreserveCase \
(got {naming_convention})",
);

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Consider returning an error instead of panicking for unsupported naming convention.

The assert! will panic if a different naming convention is passed. Since to_source_code is a public function, a Result return or compile-time enforcement would be safer than a runtime panic.

🔧 Suggested fix
 pub fn to_source_code(
     pool: &SymbolPool,
     user_baml_files: &[UserBamlFile],
     naming_convention: NamingConvention,
-) -> HashMap<PathBuf, String> {
-    // Only `PreserveCase` is wired up so far.
-    assert!(
-        matches!(naming_convention, NamingConvention::PreserveCase),
-        "codegen_nodejs only supports naming_convention = PreserveCase \
-         (got {naming_convention})",
-    );
+) -> Result<HashMap<PathBuf, String>, String> {
+    if !matches!(naming_convention, NamingConvention::PreserveCase) {
+        return Err(format!(
+            "codegen_nodejs only supports naming_convention = PreserveCase \
+             (got {naming_convention})"
+        ));
+    }
🤖 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/nodejs/codegen_nodejs/src/lib.rs` around lines 70 - 75,
The assert! in to_source_code panics for unsupported NamingConvention; change to
a non-panicking API by updating the to_source_code signature to return a Result
(e.g., Result<String, ErrorType>) and replace the assert! that checks
matches!(naming_convention, NamingConvention::PreserveCase) with an early-return
Err containing a clear error (including the received naming_convention) when
it's unsupported; ensure callers of to_source_code are updated to handle the
Result and define/choose an appropriate ErrorType or use a boxed dyn Error to
represent this failure.

@codspeed

codspeed Bot commented May 30, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 13 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing sam/nodejs (a0920fd) with canary (26c4329)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 19:02 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: 2

♻️ Duplicate comments (1)
.github/workflows/build-nodejs-sdk.reusable.yaml (1)

88-90: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Route aarch64-unknown-linux-gnu through the explicit cross-compile branch.

This matrix includes aarch64-unknown-linux-gnu, but only *musl* targets install the extra cross toolchain and pass --cross-compile. NAPI-RS documents aarch64-unknown-linux-gnu as part of its cross-compilation flow, so the current GNU ARM64 leg is still likely to fail unless it is handled there too. (napi.rs)

Also applies to: 100-108

🤖 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 @.github/workflows/build-nodejs-sdk.reusable.yaml around lines 88 - 90, The
workflow only runs the "Install zig (musl cross-compile)" step when
contains(matrix._.target, 'musl'), which skips the aarch64 GNU target; update
the conditional(s) that reference matrix._.target (e.g., the "Install zig (musl
cross-compile)" step and the similar blocks around lines 100-108) to also match
'aarch64-unknown-linux-gnu' (or a pattern that includes it) so that the
aarch64-unknown-linux-gnu matrix entry follows the explicit cross-compile branch
and receives the zig/toolchain install and --cross-compile behavior.
🧹 Nitpick comments (1)
.github/workflows/release-sdk.yaml (1)

100-102: 🏗️ Heavy lift

Prefer npm trusted publishing over NPM_TOKEN in this release job.

This job already runs on a GitHub-hosted runner and requests id-token: write. npm’s current guidance is to prefer trusted publishing over long-lived tokens, and OIDC-based publishing from GitHub Actions automatically generates provenance for public packages, which would let you remove NPM_TOKEN once the package is configured on npm. (docs.npmjs.com)

Also applies to: 147-150

🤖 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 @.github/workflows/release-sdk.yaml around lines 100 - 102, The release job
should use GitHub Actions OIDC trusted publishing instead of the long-lived
NPM_TOKEN secret: remove usage of NPM_TOKEN from the release job, keep/ensure
the permissions block includes id-token: write (the existing "permissions" block
with "id-token: write"), and update the publish step to use OIDC-based
publishing by switching to actions/setup-node (v3) configured for the npm
registry (e.g., registry-url: https://registry.npmjs.org) and run npm publish
without injecting NPM_TOKEN; also ensure your npm package is configured on npmjs
to accept GitHub Actions OIDC trusted publishers so the workflow can publish via
OIDC.
🤖 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 @.github/workflows/build-nodejs-sdk.reusable.yaml:
- Line 70: The workflow uses tag-pinned GitHub Actions (e.g.,
actions/checkout@v6, actions/setup-node@v4, pnpm/action-setup@v4,
mlugg/setup-zig@v1, actions/upload-artifact@v7) which should be replaced with
full 40-character commit SHAs for supply-chain hardening; locate each referenced
action in the workflow, look up the corresponding repository and the commit that
the current tag points to (or use the latest vetted commit), and replace the tag
(e.g., `@v6`) with the full commit SHA (e.g., @<40-char-sha>), then commit the
updated workflow and run/validate the CI to ensure the actions still behave as
expected.

In @.github/workflows/release-sdk.yaml:
- Around line 106-107: The workflow uses tag-pinned actions
(actions/checkout@v6, actions/setup-node@v4, pnpm/action-setup@v4,
actions/download-artifact@v8) which should be replaced with full commit SHA
pins; update each action reference to the canonical full commit SHA for the
version you intend to use (e.g., actions/checkout@<full-sha>), verify the SHAs
against the official action repositories, and ensure the commit SHAs are used
consistently for all occurrences of these action references in the workflow.

---

Duplicate comments:
In @.github/workflows/build-nodejs-sdk.reusable.yaml:
- Around line 88-90: The workflow only runs the "Install zig (musl
cross-compile)" step when contains(matrix._.target, 'musl'), which skips the
aarch64 GNU target; update the conditional(s) that reference matrix._.target
(e.g., the "Install zig (musl cross-compile)" step and the similar blocks around
lines 100-108) to also match 'aarch64-unknown-linux-gnu' (or a pattern that
includes it) so that the aarch64-unknown-linux-gnu matrix entry follows the
explicit cross-compile branch and receives the zig/toolchain install and
--cross-compile behavior.

---

Nitpick comments:
In @.github/workflows/release-sdk.yaml:
- Around line 100-102: The release job should use GitHub Actions OIDC trusted
publishing instead of the long-lived NPM_TOKEN secret: remove usage of NPM_TOKEN
from the release job, keep/ensure the permissions block includes id-token: write
(the existing "permissions" block with "id-token: write"), and update the
publish step to use OIDC-based publishing by switching to actions/setup-node
(v3) configured for the npm registry (e.g., registry-url:
https://registry.npmjs.org) and run npm publish without injecting NPM_TOKEN;
also ensure your npm package is configured on npmjs to accept GitHub Actions
OIDC trusted publishers so the workflow can publish via OIDC.
🪄 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

Run ID: cae07649-cb96-4fad-9b86-e7acd909be3b

📥 Commits

Reviewing files that changed from the base of the PR and between 05da931 and 34cf162.

⛔ Files ignored due to path filters (1)
  • baml_language/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/build-nodejs-sdk.reusable.yaml
  • .github/workflows/release-sdk.yaml
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
✅ Files skipped from review due to trivial changes (1)
  • baml_language/crates/baml_cli/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/crates/baml_cli/src/generate.rs

Add-Content -Path "$env:GITHUB_PATH" -Value "$env:USERPROFILE\.cargo\bin" -Encoding utf8
}

- uses: actions/checkout@v6

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin these GitHub Actions references to full commit SHAs.

In .github/workflows/build-nodejs-sdk.reusable.yaml, these uses: entries are tag-pinned only (no full 40-hex commit SHA): actions/checkout@v6, actions/setup-node@v4, pnpm/action-setup@v4, mlugg/setup-zig@v1, and actions/upload-artifact@v7. GitHub’s secure-use guidance recommends full-SHA pinning for supply-chain hardening. https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 70-70: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 70-70: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 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 @.github/workflows/build-nodejs-sdk.reusable.yaml at line 70, The workflow
uses tag-pinned GitHub Actions (e.g., actions/checkout@v6,
actions/setup-node@v4, pnpm/action-setup@v4, mlugg/setup-zig@v1,
actions/upload-artifact@v7) which should be replaced with full 40-character
commit SHAs for supply-chain hardening; locate each referenced action in the
workflow, look up the corresponding repository and the commit that the current
tag points to (or use the latest vetted commit), and replace the tag (e.g., `@v6`)
with the full commit SHA (e.g., @<40-char-sha>), then commit the updated
workflow and run/validate the CI to ensure the actions still behave as expected.

Comment on lines +106 to +107
- uses: actions/checkout@v6
- uses: actions/setup-node@v4

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/release-sdk.yaml"

echo "== Lines 80-160 =="
nl -ba "$file" | sed -n '80,160p'

echo
echo "== Find all action uses in this workflow =="
rg -n "^\s*uses:\s" "$file"

Repository: BoundaryML/baml

Length of output: 139


🌐 Web query:

Pin GitHub Actions to full commit SHA vs tag for supply chain hardening, and relevant GitHub policy/recommendation docs

💡 Result:

Recommendation (supply-chain hardening for GitHub Actions): Pin third-party (and ideally all) GitHub Actions to a full-length commit SHA, not a tag. GitHub states that pinning to a full-length commit SHA is currently the only way to use an action as an immutable release, and that this mitigates the risk of a bad actor adding a backdoor because they would need to generate a SHA-1 collision for a valid Git object payload [1][2]. Pinning to a tag is only appropriate if you trust the creator; even then, tags can be moved or deleted if an attacker gains access to the action’s repository [1][2]. How to implement in workflows (secure pattern) 1) Replace uses: owner/action@ with uses: owner/action@<40-hex-sha> Example: - uses: actions/checkout@11bd719 # v4.2.2 This format is explicitly documented as the SHA pinning approach in GitHub’s security hardening guidance and in related enforcement examples [2][3]. 2) Keep the human-readable original version as a comment (optional but common): use: owner/action@ # vX.Y.Z. This preserves ergonomics while retaining immutability (and supports automated updating approaches that look for that comment) [4]. Policy / enforcement controls (so you don’t rely on humans) GitHub provides administrative policy to require SHA pinning: - GitHub’s Actions security hardening documentation describes configuring settings/policies so actions must be pinned to a full-length commit SHA [5][2]. - GitHub’s 2025-08-15 changelog notes new capabilities that allow administrators to enforce SHA pinning through the “allowed actions” policy; workflows that try to use an action that isn’t pinned will fail. The policy checks for a full commit SHA [6]. - For enterprise policy, GitHub documents: “Require actions to be pinned to a full-length commit SHA … This includes actions from your enterprise and actions authored by GitHub” (reusable workflows may still be referenced by tag depending on policy scope) [5]. Notes on tags vs SHAs (why this hardening matters) - GitHub’s secure use guidance: tag pinning is convenient but risky because tags are mutable; commit-SHA pinning is the immutable option [1][2]. Optional automation to manage the maintenance burden - GitHub/marketplace ecosystem includes “ensure SHA pinned actions” style checks that fail CI if actions aren’t pinned to full-length SHAs (useful as a guardrail alongside the GitHub policy). For example, “Ensure SHA Pinned Actions” is designed to throw an error if any referenced GitHub Action is not pinned to a full-length commit SHA [4][7]. Cited GitHub sources (primary) [1] https://docs.github.com/en/actions/reference/security/secure-use [2] https://github.com/github/docs/blob/962a1c8dccb8c0f66548b324e5b921b5e4fbc3d6/content/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions.md [6] https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/ [5] https://github.com/github/docs/blob/main/content/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md [4] https://github.com/marketplace/actions/ensure-sha-pinned-actions [7] https://github.com/step-security/github-actions-ensure-sha-pinned-actions [3] https://githubdocs.cn/en/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/release-sdk.yaml"

echo "== File exists? =="
test -f "$file" && echo "yes" || (echo "missing: $file" && exit 1)

echo
echo "== Lines 90-130 (with numbers) =="
awk 'NR>=90 && NR<=130 { printf "%d:%s\n", NR, $0 }' "$file"

echo
echo "== All uses: lines in this workflow (with numbers) =="
awk '{ if ($0 ~ /^[[:space:]]*uses:[[:space:]]*/){ printf "%d:%s\n", NR, $0 } }' "$file"

Repository: BoundaryML/baml

Length of output: 1875


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/release-sdk.yaml"

echo "== Lines 130-210 (with numbers) =="
awk 'NR>=130 && NR<=210 { printf "%d:%s\n", NR, $0 }' "$file"

echo
echo "== Search for NODE_AUTH_TOKEN and NPM_TOKEN usage =="
rg -n "NODE_AUTH_TOKEN|NPM_TOKEN" "$file"

Repository: BoundaryML/baml

Length of output: 1290


Pin these action references to full commit SHAs.

In .github/workflows/release-sdk.yaml (lines 106-107; also 111-115), the workflow uses tag-pinned actions (actions/checkout@v6, actions/setup-node@v4, pnpm/action-setup@v4, actions/download-artifact@v8). Tag pinning can be blocked by GitHub’s full-SHA policy and weakens action supply-chain hardening. https://github.com/github/docs/blob/962a1c8dccb8c0f66548b324e5b921b5e4fbc3d6/content/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions.md

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 106-106: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 106-106: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 107-107: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 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 @.github/workflows/release-sdk.yaml around lines 106 - 107, The workflow uses
tag-pinned actions (actions/checkout@v6, actions/setup-node@v4,
pnpm/action-setup@v4, actions/download-artifact@v8) which should be replaced
with full commit SHA pins; update each action reference to the canonical full
commit SHA for the version you intend to use (e.g.,
actions/checkout@<full-sha>), verify the SHAs against the official action
repositories, and ensure the commit SHAs are used consistently for all
occurrences of these action references in the workflow.

@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 19:12 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts (1)

144-194: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject unsupported built-in objects before the generic object fallback.

Widening this branch from plain objects to any object means values like new Date(), new Map(), new Set(), new URL(), new Error(), or a Promise now serialize as an empty or partial mapValue because Object.entries(...) sees little or no state. That silently corrupts inputs where the old code would have thrown.

Please keep the special handling for generated class instances, but restore a guard so unsupported non-plain objects still fail fast.

Suggested direction
-    } else if (value !== null && typeof value === 'object') {
+    } else if (value !== null && typeof value === 'object') {
         const proto = Object.getPrototypeOf(value);
-        const isClassInstance = proto !== Object.prototype && proto !== null;
+        const isPlainObject = proto === Object.prototype || proto === null;
+        const isClassInstance = !isPlainObject;
+
+        if (!isPlainObject && !isClassInstance) {
+            throw new TypeError(
+                `Cannot encode value of type ${Object.prototype.toString.call(value)} to protobuf`
+            );
+        }
+
+        if (!isPlainObject) {
+            const ctor = (value as object).constructor;
+            const hasKnownFqn = getTypeMap().jsTypeToBamlType(ctor) != null;
+            const hasHandleField = Object.values(value).some(v => v instanceof BamlHandle);
+            if (!hasKnownFqn && !hasHandleField) {
+                throw new TypeError(
+                    `Cannot encode value of type ${Object.prototype.toString.call(value)} to protobuf`
+                );
+            }
+        }
🤖 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/nodejs/bridge_nodejs/typescript_src/proto.ts` around lines
144 - 194, The current generic object branch accepts any object and will
silently serialize built-ins (Date/Map/Set/URL/Error/Promise) as empty/partial
maps; update the object-handling logic in the same function that uses
Object.getPrototypeOf/value checks (the isClassInstance branch,
getTypeMap().jsTypeToBamlType, and the BamlHandle checks) to early-reject
unsupported non-plain objects: after computing proto and isClassInstance, if
proto !== Object.prototype && proto !== null and the value isn't a recognized
codegen class (no fqn via getTypeMap().jsTypeToBamlType) and isn't a
handle-backed stdlib object (the existing Object.values(...).some(v => v
instanceof BamlHandle) path), throw a clear error naming the unsupported
constructor (e.g. value.constructor?.name) instead of falling back to encoding
as a map; keep the existing class instance encoding (classFields /
iv.classValue) and the plain-object mapValue path unchanged.
🤖 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/nodejs/RELEASE.md`:
- Around line 24-26: Replace the incorrect repo paths in RELEASE.md: change
occurrences of "sdks/nodejs/bridge_nodejs/package.json" to
"bridge_nodejs/package.json" and change occurrences of
"crates/baml_cli/src/generate.rs" to "crates/baml_cli/generate.rs" (also update
the other instance around lines 57-58) so the guide matches the layout used
elsewhere in the PR.

---

Outside diff comments:
In `@baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts`:
- Around line 144-194: The current generic object branch accepts any object and
will silently serialize built-ins (Date/Map/Set/URL/Error/Promise) as
empty/partial maps; update the object-handling logic in the same function that
uses Object.getPrototypeOf/value checks (the isClassInstance branch,
getTypeMap().jsTypeToBamlType, and the BamlHandle checks) to early-reject
unsupported non-plain objects: after computing proto and isClassInstance, if
proto !== Object.prototype && proto !== null and the value isn't a recognized
codegen class (no fqn via getTypeMap().jsTypeToBamlType) and isn't a
handle-backed stdlib object (the existing Object.values(...).some(v => v
instanceof BamlHandle) path), throw a clear error naming the unsupported
constructor (e.g. value.constructor?.name) instead of falling back to encoding
as a map; keep the existing class instance encoding (classFields /
iv.classValue) and the plain-object mapValue path unchanged.
🪄 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

Run ID: 5a4aea65-6f41-40f7-9791-2dd59332c642

📥 Commits

Reviewing files that changed from the base of the PR and between 34cf162 and 806c11c.

⛔ Files ignored due to path filters (3)
  • baml_language/Cargo.lock is excluded by !**/*.lock
  • baml_language/sdks/nodejs/bridge_nodejs/proto.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js.map is excluded by !**/*.map
📒 Files selected for processing (29)
  • .github/workflows/build-nodejs-sdk.reusable.yaml
  • .github/workflows/release-sdk.yaml
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/llm_functions/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_streams.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdks/nodejs/RELEASE.md
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts
🚧 Files skipped from review as they are similar to previous changes (22)
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_streams.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/main.test.ts

Comment thread baml_language/sdks/nodejs/RELEASE.md Resolved
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 1, 2026 19:30 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 1, 2026 19:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 21:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 1, 2026 21:40 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 1, 2026 21:41 Inactive
coderabbitai[bot]
coderabbitai Bot previously requested changes Jun 1, 2026

@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

♻️ Duplicate comments (1)
baml_language/sdks/nodejs/RELEASE.md (1)

24-26: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix path inconsistencies in the release guide.

The document inconsistently refers to paths: line 30 uses bridge_nodejs/package.json (relative) while line 25 uses the full sdks/nodejs/bridge_nodejs/package.json. For consistency and to match the relative path style used elsewhere in the document, these should be updated to relative paths.

📝 Suggested changes

Line 25: Change sdks/nodejs/bridge_nodejs/package.json to bridge_nodejs/package.json

Line 58: Verify and potentially shorten crates/baml_cli/src/generate.rs to match the relative path style.

Also applies to: 57-58

🤖 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/nodejs/RELEASE.md` around lines 24 - 26, Update the
inconsistent file path references in the release guide: replace the absolute
path reference `sdks/nodejs/bridge_nodejs/package.json` with the relative
`bridge_nodejs/package.json` wherever it appears in RELEASE.md and also shorten
`crates/baml_cli/src/generate.rs` to the relative `baml_cli/src/generate.rs` (or
to `src/generate.rs` if consistent with the rest of the document) so all path
mentions follow the same relative style; ensure occurrences near the existing
mentions of `version` and the generate script are updated.
🤖 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/nodejs/RELEASE.md`:
- Line 1: The CI fails because the Node.js SDK RELEASE.md (the file with header
"# Releasing `@boundaryml/baml-core` (Node.js SDK)") isn't listed in the
markdown whitelist; open the baml_language/.markdown-whitelist file and add the
entry sdks/nodejs/RELEASE.md (exact relative path) to the list so the file is
allowed by the CI, commit the change, and rerun CI.

---

Duplicate comments:
In `@baml_language/sdks/nodejs/RELEASE.md`:
- Around line 24-26: Update the inconsistent file path references in the release
guide: replace the absolute path reference
`sdks/nodejs/bridge_nodejs/package.json` with the relative
`bridge_nodejs/package.json` wherever it appears in RELEASE.md and also shorten
`crates/baml_cli/src/generate.rs` to the relative `baml_cli/src/generate.rs` (or
to `src/generate.rs` if consistent with the rest of the document) so all path
mentions follow the same relative style; ensure occurrences near the existing
mentions of `version` and the generate script are updated.
🪄 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

Run ID: d1c1f924-b7f8-4a77-a8f5-4cabcc9db7a9

📥 Commits

Reviewing files that changed from the base of the PR and between 806c11c and 5a8509c.

⛔ Files ignored due to path filters (4)
  • baml_language/Cargo.lock is excluded by !**/*.lock
  • baml_language/sdks/nodejs/bridge_nodejs/proto.d.ts.map is excluded by !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js.map is excluded by !**/*.map
  • baml_language/sdks/python/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (39)
  • .github/workflows/build-nodejs-sdk.reusable.yaml
  • .github/workflows/release-sdk.yaml
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/llm_functions/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_complex_models.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_streams.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/crates/python_pydantic2/type_shapes/customizable/test_complex_models.py
  • baml_language/sdk_tests/crates/python_pydantic2/type_shapes/customizable/test_main.py
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_complex_models/types.baml
  • baml_language/sdks/nodejs/RELEASE.md
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/function.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/mod.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/typemap_file.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/lib.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/routing.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/translate_ty.rs
✅ Files skipped from review due to trivial changes (2)
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/sdk_tests/crates/python_pydantic2/type_shapes/customizable/test_main.py
🚧 Files skipped from review as they are similar to previous changes (27)
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/lib.rs
  • baml_language/crates/baml_cli/Cargo.toml
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/function.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/typemap_file.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/translate_ty.rs
  • baml_language/sdk_tests/crates/nodejs_typescript/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts
  • baml_language/sdks/nodejs/bridge_nodejs/proto.js

Comment thread baml_language/sdks/nodejs/RELEASE.md Resolved
@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 23:39 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 23:46 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 1, 2026 23:49 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/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts (1)

97-104: ⚡ Quick win

Assertion is weaker than the test's stated intent.

The title claims lorem exposes the $stream companion classes (plural), but .some() passes when only one of Resume$stream / StreamingDoc$stream is present, so a regression that drops one companion would go undetected. Use .every() to assert both.

♻️ Proposed change
-    const hasAny = ["Resume$stream", "StreamingDoc$stream"].some(
-      (name) => name in lorem,
-    );
-    expect(hasAny).toBe(true);
+    const hasAll = ["Resume$stream", "StreamingDoc$stream"].every(
+      (name) => name in lorem,
+    );
+    expect(hasAll).toBe(true);
🤖 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/crates/typescript_node/llm_functions/customizable/main.test.ts`
around lines 97 - 104, The test titled "lorem exposes the `$stream` companion
classes beside their base type" currently uses Array.some, which only requires
one of the companion names to exist; update the assertion to require both by
replacing the .some(...) check with .every(...) so that both "Resume$stream" and
"StreamingDoc$stream" must exist in the lorem object (keep the test name and
expect(...) toBe(true) semantics but use every to compute hasAll).
🤖 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/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts`:
- Around line 97-104: The test titled "lorem exposes the `$stream` companion
classes beside their base type" currently uses Array.some, which only requires
one of the companion names to exist; update the assertion to require both by
replacing the .some(...) check with .every(...) so that both "Resume$stream" and
"StreamingDoc$stream" must exist in the lorem object (keep the test name and
expect(...) toBe(true) semantics but use every to compute hasAll).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 52eb76b9-d8e1-418a-baf4-29eb285a0efa

📥 Commits

Reviewing files that changed from the base of the PR and between 5a8509c and c9cc601.

⛔ Files ignored due to path filters (1)
  • baml_language/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (51)
  • baml_language/.config/nextest.toml
  • baml_language/Cargo.toml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/sdk_tests/README.md
  • baml_language/sdk_tests/crates/python_pydantic2/function_calls/customizable/test_methods_on_classes.py
  • baml_language/sdk_tests/crates/python_pydantic2/setup.sh
  • baml_language/sdk_tests/crates/typescript_node/Cargo.toml
  • baml_language/sdk_tests/crates/typescript_node/build.rs
  • baml_language/sdk_tests/crates/typescript_node/docstrings_etc/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/methods_on_classes.test.ts
  • baml_language/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/setup.ps1
  • baml_language/sdk_tests/crates/typescript_node/setup.sh
  • baml_language/sdk_tests/crates/typescript_node/src/lib.rs
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_complex_models.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_forward_refs.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_streams.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_methods_on_classes/types.baml
  • baml_language/sdk_tests/harness_runner/Cargo.toml
  • baml_language/sdk_tests/harness_runner/src/lib.rs
  • baml_language/sdk_tests/harness_setup/Cargo.toml
  • 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/typescript_node.rs
  • baml_language/sdks/nodejs/RELEASE.md
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/function.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/method.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/mod.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/typemap_file.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/leaf.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/lib.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/routing.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/translate_ty.rs
💤 Files with no reviewable changes (18)
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_void.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_media.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_recursion.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_optional.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_symbol_collisions.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_generics.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_class_refs.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_literals.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_primitives.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_aliases.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_routing.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_enums.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_unions.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_lists.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_handles.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/roundtrip_forward_refs.test.ts
✅ Files skipped from review due to trivial changes (9)
  • baml_language/sdk_tests/harness_runner/Cargo.toml
  • baml_language/sdk_tests/crates/typescript_node/Cargo.toml
  • baml_language/sdk_tests/harness_setup/src/python_pydantic2.rs
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_methods_on_classes/types.baml
  • baml_language/sdk_tests/crates/python_pydantic2/setup.sh
  • baml_language/sdk_tests/harness_setup/Cargo.toml
  • baml_language/sdk_tests/crates/typescript_node/src/lib.rs
  • baml_language/sdk_tests/README.md
  • baml_language/sdks/nodejs/RELEASE.md
🚧 Files skipped from review as they are similar to previous changes (7)
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/function.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/typemap_file.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/method.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/routing.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/translate_ty.rs
  • baml_language/sdks/nodejs/codegen_nodejs/src/emit/mod.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 2, 2026 00:07 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 2, 2026 05:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 2, 2026 20:08 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 2, 2026 20:25 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 2, 2026 20:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 2, 2026 20:42 Inactive
@sxlijin
sxlijin force-pushed the sam/nodejs branch 2 times, most recently from 60a438d to b9b792b Compare June 2, 2026 20:55
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 2, 2026 20:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 2, 2026 20:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 2, 2026 21:01 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 2, 2026 21:35 Inactive

This branch was previously deployed

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