Skip to content

feat(node): align TypeScript SDK with Python and harden publishing#4035

Open
aaronvg wants to merge 6 commits into
canaryfrom
aaron/ts-bridge
Open

feat(node): align TypeScript SDK with Python and harden publishing#4035
aaronvg wants to merge 6 commits into
canaryfrom
aaron/ts-bridge

Conversation

@aaronvg

@aaronvg aaronvg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

  • Bring the TypeScript/Node generated API and bridge behavior into parity with Python across required and optional arguments, generics, generated class values, async host callbacks, cancellation, structured errors, and value round trips.
  • Add a Python-to-TypeScript test-ID parity ratchet, with language_specific reserved for runtime-specific contracts.
  • Add shared regression coverage for large integral floats, callable-valued class fields, and unsafe integers nested in thrown errors and panics.
  • Add Node-specific regression coverage for missing host tracebacks, cross-realm plain records, and rejecting unsafe JavaScript numbers in BAML int slots.
  • Harden Node release publishing around frozen schema-v2 inputs, centralized platform metadata, exact tarball verification, native-package-first publishing, integrity-aware reruns, and umbrella-package publication last.
  • Remove NPM_DIST_TAG_TOKEN and reusable-workflow secret wiring; canary and nightly now publish the umbrella package to the public latest tag only after native package integrity is verified.

Why

Python is the bridge completeness reference. TypeScript had gaps in both generated call forms and runtime value conversion, while the release workflow could publish an umbrella package before proving that its native dependencies were the exact expected artifacts.

The new shared tests make cross-language drift visible by requiring matching test IDs. JavaScript-only edge cases stay in language_specific so they test the Node representation boundary without forcing irrelevant behavior onto other bridges.

Important compatibility fixes

  • Integral-looking JavaScript numbers outside the safe-integer range encode as BAML floats, while BAML int slots reject float-backed values instead of accepting an imprecise integer.
  • Generated class instance methods are omitted using exact sdkgen metadata, so callable-valued class fields still cross the host boundary as data.
  • Unsafe ints nested in structured thrown values fail loudly in Node instead of silently replacing error.value with undefined.
  • A missing JavaScript traceback remains BAML null rather than becoming an empty string.
  • Plain records from another Node VM realm remain structural maps; actual unregistered class instances still require type metadata.

Validation

  • cargo nextest run -p sdkgen_typescript_node -p sdk_test_python_pydantic2 -p sdk_test_typescript_node --no-fail-fast (75/75 passed)
  • cargo nextest run -p bex_engine -E 'test(numeric_coercion_tests)' --no-fail-fast (2/2 passed)
  • python3 -m unittest scripts.tests.test_baml_release_contract (6/6 passed)
  • scripts/baml-release-platforms check
  • cargo fmt --all -- --check
  • git diff --check

Note

High Risk
Changes span release publishing (integrity, tags, reruns), cross-platform CI matrices, and FFI type coercion at the engine boundary—any regression affects published npm artifacts or runtime call safety.

Overview
Aligns the TypeScript/Node SDK with Python through expanded Vitest coverage (errors, generics, inference, host callables, cancellation, raises/docstrings, LLM shorthand API keys) renamed to match Python test_* IDs, plus a Rust python_and_typescript_common_case_ids_match_by_fixture ratchet and language_specific/ for Node-only contracts. Python reference tests grow in parallel (media roundtrips, bigint, generic boxes, unsafe ints in errors/panics, callable class fields).

Tightens FFI numeric safety in coerce_numeric_to_declared_type: integral-looking floats no longer coerce into BAML int slots (with engine unit tests).

Overhauls Node SDK release CI: build matrices come from release/platforms.json via baml-release-platforms; workflows require frozen release_plan_json and source_sha. Node build assembles, packs, checksums, and native-matrix smoke-tests exact tarballs before publish; publish consumes nodejs-verified-packages, publishes native leaves under an internal tag with integrity-aware idempotency, then the umbrella on the public channel, and adds post-publish registry install verification. Language release planning uses run-stable frozen plans, validates platforms, and feeds dynamic toolchain/wrapper matrices; manifests are generated from --plan release-plan.json.

Reviewed by Cursor Bugbot for commit ea7ccbe. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features
    • Added per-call cancellation support to the Node.js SDK using call options (context/signal) for both sync and async calls.
  • Bug Fixes
    • Improved numeric safety by rejecting unsafe-precision integers and preventing float-encoded integral values from being accepted as integers.
    • Strengthened runtime behavior for cyclic data encoding and standardized native error/panic wrapping.
  • Documentation
    • Updated SDK test harness/fixture guidance and TypeScript–Python parity documentation.
  • Release Improvements
    • Revamped release planning and npm publishing with dynamic platform matrices, pre-publish artifact verification, and integrity-aware/idempotent publishes.

@vercel

vercel Bot commented Jul 15, 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 16, 2026 12:32am
promptfiddle Ready Ready Preview, Comment Jul 16, 2026 12:32am
promptfiddle2 Ready Ready Preview, Comment Jul 16, 2026 12:32am

Request Review

@coderabbitai

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

The pull request centralizes release platform configuration, adds verified Node.js package assembly and publishing, hardens Node bridge behavior, and expands Python/TypeScript SDK coverage with parity enforcement.

Changes

Release pipeline and contracts

Layer / File(s) Summary
Dynamic release planning and package verification
.github/workflows/*, release/platforms.json, scripts/baml-*, scripts/tests/*
Release plans use schema 2 metadata, platform matrices are generated dynamically, and Node packages are assembled, checksum-validated, smoke-tested, and published from verified tarballs.
Release smoke verification
scripts/verify-node-release-package.mjs
The bridge version, import timing, generated sync/async calls, and repeated version calls are checked against configured budgets.

Node runtime and generated bindings

Layer / File(s) Summary
Bridge runtime behavior
baml_language/sdks/nodejs/bridge_nodejs/typescript_src/*
Native failures become structured SDK panics, calls accept per-call signals and partial generic bindings, host-value lookup distinguishes missing values from undefined, and protocol encoding detects cycles and unsafe integers.
TypeScript callable generation
baml_language/sdks/nodejs/sdkgen_typescript_node/src/*
Generated callables expose $ctx, $signal, and partial $types; host callbacks accept promise-like returns, and class metadata and generic method signatures are refined.

SDK validation

Layer / File(s) Summary
Cross-language SDK contracts
baml_language/sdk_tests/fixtures/*, baml_language/sdk_tests/crates/python_pydantic2/*, baml_language/sdk_tests/crates/typescript_node/*
Fixtures and tests add coverage for bigint, unsafe integers, exact media representations, host callables, cancellation, errors, generic inference, and language-specific round trips.
Parity and harness maintenance
baml_language/sdk_tests/crates/typescript_node/src/*, baml_language/sdk_tests/harness_setup/src/*, baml_language/sdk_tests/*README.md, baml_language/sdk_tests/*DEVELOPMENT.md
TypeScript test identifiers are checked against Python fixture identifiers, Node gap budgets are enforced, nested overlays are copied, stale fixtures are skipped, and SDK test documentation describes updated conventions.

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

Possibly related PRs

Poem

A rabbit packed tarballs tight,
Checked every hash by moonlit light.
Signals hopped through calls with care,
Bigints bounded errors there.
“Ship the verified bridge!” I cheer—
With tests in tow, the path is clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% 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
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main themes: Node/Python SDK parity and publishing workflow hardening.
✨ 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 aaron/ts-bridge

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 15, 2026

Copy link
Copy Markdown

Binary size checks passed

7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
baml-cli Linux 🔒 22.8 MB 9.7 MB file 22.8 MB +51.6 KB (+0.2%) OK
packed-program Linux 🔒 16.3 MB 6.8 MB file 16.3 MB +16.4 KB (+0.1%) OK
baml-cli macOS 🔒 17.5 MB 8.5 MB file 17.5 MB +33.2 KB (+0.2%) OK
packed-program macOS 🔒 12.6 MB 6.0 MB file 12.6 MB -16.5 KB (-0.1%) OK
baml-cli Windows 🔒 19.1 MB 8.7 MB file 18.7 MB +409.1 KB (+2.2%) OK
packed-program Windows 🔒 13.5 MB 6.1 MB file 13.5 MB -2.6 KB (-0.0%) OK
bridge_wasm WASM 15.1 MB 🔒 4.3 MB gzip 4.3 MB +1.2 KB (+0.0%) 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: 8

🧹 Nitpick comments (2)
baml_language/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts (1)

122-164: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using Vitest's vi.stubEnv for environment variable testing.

Directly mutating process.env and cleaning it up in a try...finally block is functionally correct. However, using Vitest's built-in vi.stubEnv simplifies the logic and provides better test hygiene out of the box.

♻️ Proposed refactor for API key tests
  it("test_extract_resume_build_request_includes_openai_api_key", () => {
    vi.stubEnv("OPENAI_API_KEY", "sk-openai-shorthand-test");
    const request = lorem.ExtractResume$build_request("Some resume text");
    expect(lowerCaseHeaders(request.headers).authorization).toBe(
      "Bearer sk-openai-shorthand-test",
    );
    vi.unstubAllEnvs();
  });

  // Similarly apply this pattern to the other tests in this block.

Note: You would also need to add vi to your vitest imports at the top of the file: import { describe, expect, it, vi } from "vitest";

🤖 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 122 - 164, Refactor the three API-key tests in the “llm_functions —
shorthand client API keys” describe block to use Vitest’s vi.stubEnv and
vi.unstubAllEnvs instead of direct process.env mutation and try/finally cleanup.
Add vi to the existing Vitest import, and ensure each test restores stubbed
environment variables after its assertions.
baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_calls.test.ts (1)

219-223: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the inferred type binding, not only the returned value.

This test still passes if GenericBox.new(5) loses its inferred metadata. Check $types to cover the behavior named by the test.

Proposed fix
     expect(box).toBeInstanceOf(GenericBox);
+    expect(box.$types).toEqual({ T: "int" });
     expect(box.value).toBe(5);
🤖 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/function_calls/customizable/generic_calls.test.ts`
around lines 219 - 223, Update the test_generic_static_infers_binding test to
inspect GenericBox.$types and assert that the inferred type binding for the
value is preserved, in addition to the existing instance and value 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/build2-nodejs-sdk.reusable.yaml:
- Around line 248-251: Update the release-tool setup in the workflow around the
napi_version, attw_version, and napi pre-publish commands to use the
repository’s pnpm lockfile: add an explicit frozen pnpm install despite
install-dependencies being false, remove the global npm installation, and invoke
both `@napi-rs/cli` and `@arethetypeswrong/cli` through pnpm exec. Apply the same
pnpm exec usage at the additional tool invocation near the referenced later
section.

In @.github/workflows/publish2-nodejs-sdk.yaml:
- Around line 106-107: Update the release-plan validation step containing the
source_sha and channel checks to pass workflow inputs through the step
environment, then compare jq results against those environment variables. Remove
direct GitHub expression interpolation from the shell commands so
quote-containing inputs cannot alter shell syntax.

In
`@baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/cancellation.test.ts`:
- Around line 80-92: Update test_async_cancel_via_task_group_sibling to await
and assert the pending SleepMs_async promise rejects due to cancellation, rather
than relying only on Promise.all rejecting from failSoon. Preserve the expected
"cancel siblings" assertion for failSoon while avoiding the abort-before-reject
race, and verify the in-flight sibling does not complete normally.

In
`@baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/errors.test.ts`:
- Around line 164-169: Update the byte extraction logic around the source lookup
in the customizable errors test to match the complete new Uint8Array([...])
wrapper and capture only its array contents. Replace the separate open/close
index parsing with the matched byte-array content, then preserve the existing
numeric conversion into Uint8Array.

In `@baml_language/sdk_tests/crates/typescript_node/setup.sh`:
- Around line 60-63: Update the fixture iteration logic in setup.ps1 to mirror
the stale-fixture guard from setup.sh: derive fixture_name from the generated
directory and skip it when ../../fixtures/$fixture_name does not exist,
preventing installation of removed fixtures on Windows.

In `@release/platforms.json`:
- Around line 49-54: Update the node_build configuration for
aarch64-unknown-linux-musl to pin the downloaded aarch64-linux-musl-cross.tgz
archive with its SHA-256 checksum, store the expected digest in the release
contract, and validate the archive before the existing tar extraction runs.

In `@scripts/baml-release-manifests`:
- Around line 72-80: The release manifest generator must use the canonical
schema-2 plan loader before reading plan fields, replacing its local
schema/version checks with that validated result; update
scripts/baml-release-manifests lines 72-80 accordingly. Update
scripts/tests/test_baml_release_contract.py lines 218-224 to provide every
mandatory provenance field and values accepted by the canonical loader,
preserving the contract test’s existing purpose.
- Around line 82-94: Update the VSIX lookup before constructing the toolchain
manifest to target exactly baml-language-{version}.vsix in args.vsix_dir, rather
than selecting an arbitrary *.vsix via next and glob. Preserve the existing
missing-artifact SystemExit behavior and continue passing the exact artifact to
artifact_url and sha256.

---

Nitpick comments:
In
`@baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_calls.test.ts`:
- Around line 219-223: Update the test_generic_static_infers_binding test to
inspect GenericBox.$types and assert that the inferred type binding for the
value is preserved, in addition to the existing instance and value assertions.

In
`@baml_language/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts`:
- Around line 122-164: Refactor the three API-key tests in the “llm_functions —
shorthand client API keys” describe block to use Vitest’s vi.stubEnv and
vi.unstubAllEnvs instead of direct process.env mutation and try/finally cleanup.
Add vi to the existing Vitest import, and ensure each test restores stubbed
environment variables after its 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: ebbb9e6f-21e2-45e4-be77-a22bb0d08eeb

📥 Commits

Reviewing files that changed from the base of the PR and between ab43021 and 39ed3ae.

⛔ Files ignored due to path filters (20)
  • baml_language/sdks/nodejs/bridge_nodejs/dist/define_function.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/define_function.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/define_function.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/define_function.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/errors.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/errors.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/errors.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/errors.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/proto.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/python/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (77)
  • .github/workflows/build2-nodejs-sdk.reusable.yaml
  • .github/workflows/build2-python-sdk.reusable.yaml
  • .github/workflows/ci.yaml
  • .github/workflows/publish2-nodejs-sdk.yaml
  • .github/workflows/release-baml-language.yml
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/sdk_tests/DEVELOPMENT.md
  • baml_language/sdk_tests/README.md
  • baml_language/sdk_tests/crates/python_pydantic2/function_calls/customizable/test_errors.py
  • baml_language/sdk_tests/crates/python_pydantic2/function_calls/customizable/test_host_callables.py
  • baml_language/sdk_tests/crates/python_pydantic2/setup.sh
  • baml_language/sdk_tests/crates/python_pydantic2/type_shapes/customizable/roundtrip_tests/test_media.py
  • baml_language/sdk_tests/crates/python_pydantic2/type_shapes/customizable/roundtrip_tests/test_primitives.py
  • baml_language/sdk_tests/crates/typescript_node/docstrings_etc/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/cancellation.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/errors.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_calls.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_inference.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/host_callables.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/language_specific/cancellation.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/language_specific/host_callables.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/language_specific/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/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/function_calls/customizable/optional_args.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/raises.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/stdlib_entrypoints.test.ts
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/union_throws.test.ts
  • baml_language/sdk_tests/crates/typescript_node/llm_functions/customizable/main.test.ts
  • baml_language/sdk_tests/crates/typescript_node/llm_functions/customizable/streaming_e2e.test.ts
  • 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/src/parity.rs
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/language_specific/roundtrip_complex_models.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/language_specific/roundtrip_maps.test.ts
  • baml_language/sdk_tests/crates/typescript_node/type_shapes/customizable/language_specific/roundtrip_primitives.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_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/crates/typescript_node/type_shapes/customizable/test_generic.test.ts
  • 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_throws_test/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_media/types.baml
  • baml_language/sdk_tests/fixtures/type_shapes/baml_src/ns_primitives/types.baml
  • baml_language/sdk_tests/harness_setup/src/lib.rs
  • baml_language/sdks/nodejs/bridge_nodejs/package.json
  • baml_language/sdks/nodejs/bridge_nodejs/tests/native_setup_errors.test.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/host_value_registry.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/index.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts
  • baml_language/sdks/nodejs/sdkgen_typescript_node/src/leaf.rs
  • baml_language/sdks/nodejs/sdkgen_typescript_node/src/translate_ty.rs
  • release/platforms.json
  • scripts/baml-language-version
  • scripts/baml-release-manifests
  • scripts/baml-release-platforms
  • scripts/tests/test_baml_release_contract.py
  • scripts/verify-node-release-package.mjs
💤 Files with no reviewable changes (1)
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/union_throws.test.ts

Comment thread .github/workflows/build2-nodejs-sdk.reusable.yaml Outdated
Comment thread .github/workflows/publish2-nodejs-sdk.yaml Outdated
Comment on lines +60 to +63
fixture_name="${fixture_dir%/generated}"
# Ignore generated output left behind after a shared fixture is removed.
# Build.rs only refreshes fixtures that still exist under sdk_tests/fixtures.
[[ -d "../../fixtures/$fixture_name" ]] || continue

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
setup_ps1="$(fd -a '^setup\.ps1$' baml_language/sdk_tests/crates/typescript_node | head -n1)"
test -n "$setup_ps1" && rg -n -C4 'fixtures|generated|Test-Path' "$setup_ps1"

Repository: BoundaryML/baml

Length of output: 847


🏁 Script executed:

#!/bin/bash
setup_ps1="$(fd -a '^setup\.ps1$' baml_language/sdk_tests/crates/typescript_node | head -n1)"
echo "setup_ps1=$setup_ps1"
if [ -n "$setup_ps1" ]; then
  nl -ba "$setup_ps1" | sed -n '1,130p'
fi

Repository: BoundaryML/baml

Length of output: 275


🏁 Script executed:

#!/bin/bash
setup_ps1="$(fd -a '^setup\.ps1$' baml_language/sdk_tests/crates/typescript_node | head -n1)"
if [ -n "$setup_ps1" ]; then
  echo "=== fixture-related lines ==="
  rg -n -C6 'fixture|fixtures|generated|Test-Path|Join-Path|Get-ChildItem' "$setup_ps1"
fi

Repository: BoundaryML/baml

Length of output: 2657


Mirror the stale-fixture guard in setup.ps1 (lines 64-66). Add the ../../fixtures/$fixture_name existence check here too; otherwise Windows still installs generated dirs for fixtures that have been 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/crates/typescript_node/setup.sh` around lines 60 -
63, Update the fixture iteration logic in setup.ps1 to mirror the stale-fixture
guard from setup.sh: derive fixture_name from the generated directory and skip
it when ../../fixtures/$fixture_name does not exist, preventing installation of
removed fixtures on Windows.

Comment thread release/platforms.json
Comment thread scripts/baml-release-manifests Outdated
Comment thread scripts/baml-release-manifests Outdated

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

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/sdkgen_typescript_node/src/leaf.rs (1)

638-657: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add a unit test for the type-alias descriptor output
Add an assertion for the new export const {Name} = { typeAlias: ... } as const; line in src/leaf.rs so the runtime descriptor shape stays locked down.

🤖 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/sdkgen_typescript_node/src/leaf.rs` around lines
638 - 657, Add a unit test covering render_type_alias that asserts the generated
output includes the runtime descriptor line in the exact `export const {Name} =
{ typeAlias: ... } as const;` shape, using the source identifier expected for
the alias. Keep the existing type-alias assertion and verify this descriptor
output alongside it.

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/nodejs/bridge_nodejs/typescript_src/wire_ty.ts`:
- Around line 212-227: Update outboundLiteral’s int handling to preserve wire
int64 values that exceed Number.MAX_SAFE_INTEGER as bigint literals instead of
converting them imprecisely or returning undefined. Use the existing
literalWireTy bigint representation and retain number output for safely
representable integers.

In `@baml_language/sdks/python/src/baml_bridge/proto.py`:
- Around line 475-483: Update the non-type fallback in the type conversion logic
to preserve parameterization: after resolving the alias name through
get_type_map().py_type_to_baml_type, populate ty.type_alias.type_args from
typing.get_args(py_type) before returning. Keep the existing alias-name
resolution and recursive-alias behavior unchanged for unparameterized aliases.
- Around line 468-473: The typing.Literal handling in the relevant type-encoding
function only supports one value and discards multi-value literals. Update the
origin is typing.Literal branch to encode each argument as a single-value
literal option in ty.union.options, reusing _fill_wire_literal for each arm,
while preserving the existing direct encoding for one value and unknown fallback
for unsupported cases.

---

Outside diff comments:
In `@baml_language/sdks/nodejs/sdkgen_typescript_node/src/leaf.rs`:
- Around line 638-657: Add a unit test covering render_type_alias that asserts
the generated output includes the runtime descriptor line in the exact `export
const {Name} = { typeAlias: ... } as const;` shape, using the source identifier
expected for the alias. Keep the existing type-alias assertion and verify this
descriptor output alongside it.
🪄 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: c77168dc-bd75-41a4-8d3a-c04bc46f7ff4

📥 Commits

Reviewing files that changed from the base of the PR and between 7ef7d40 and 6a9bacf.

⛔ Files ignored due to path filters (11)
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/index.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/typemap.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/typemap.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/typemap.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/typemap.js.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/wire_ty.d.ts is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/wire_ty.d.ts.map is excluded by !**/dist/**, !**/*.map
  • baml_language/sdks/nodejs/bridge_nodejs/dist/wire_ty.js is excluded by !**/dist/**
  • baml_language/sdks/nodejs/bridge_nodejs/dist/wire_ty.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (13)
  • baml_language/sdk_tests/crates/python_pydantic2/function_calls/customizable/test_generic_calls.py
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_calls.test.ts
  • baml_language/sdk_tests/fixtures/function_calls/baml_src/ns_generic_tests/types.baml
  • baml_language/sdks/nodejs/bridge_nodejs/tests/test_wire_ty.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/index.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/typemap.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/wire_ty.ts
  • baml_language/sdks/nodejs/sdkgen_typescript_node/src/emit/type_alias.rs
  • baml_language/sdks/nodejs/sdkgen_typescript_node/src/leaf.rs
  • baml_language/sdks/python/src/baml_bridge/proto.py
  • baml_language/sdks/python/src/baml_bridge/typemap.py
  • baml_language/sdks/python/tests/test_proto_generics.py
  • baml_language/sdks/python/tests/test_typemap.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • baml_language/sdk_tests/crates/typescript_node/function_calls/customizable/generic_calls.test.ts
  • baml_language/sdks/nodejs/bridge_nodejs/typescript_src/index.ts

Comment thread baml_language/sdks/nodejs/bridge_nodejs/typescript_src/wire_ty.ts
Comment thread baml_language/sdks/python/src/baml_bridge/proto.py
Comment thread baml_language/sdks/python/src/baml_bridge/proto.py Outdated
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