feat: implement baml toolchain pin - #4386
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesThe CLI adds Toolchain selection and compatibility
Estimated code review effort: 4 (Complex) | ~45 minutes Mergeability Score: ⚪ Minimal · up to The PR adds project-local toolchain pinning and updates version-skew guidance, with the stated validation checks passing; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant User
participant BamlCLI
participant baml.toml
participant ToolchainState
User->>BamlCLI: Run baml toolchain pin
BamlCLI->>baml.toml: Find nearest manifest
BamlCLI->>baml.toml: Replace version, channel, or path
BamlCLI->>ToolchainState: Validate or install selector
ToolchainState-->>BamlCLI: Return active toolchain state
BamlCLI-->>User: Report pinning result
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
Binary size checks passed✅ 7 passed
Generated by |
baml toolchain pin
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18f95a73ea
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
baml_language/crates/bridge_cffi/src/identity.rs (1)
64-75: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd unit coverage for every package label.
package_kindsupplies user-visible repair guidance throughformat_version_skew, but the provided tests exercise onlyBridgeLanguage::Python. Add a table-driven unit test forNodeJs,Web,Python,Go,Rust,CSharp,Cpp,Java, andSwift.As per coding guidelines, prefer Rust unit tests over integration tests where possible.
🤖 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/bridge_cffi/src/identity.rs` around lines 64 - 75, Add a Rust unit test alongside package_kind that table-drives every BridgeLanguage variant—NodeJs, Web, Python, Go, Rust, CSharp, Cpp, Java, and Swift—and asserts the expected package label returned by package_kind. Keep the test focused on this method and use the existing unit-test module conventions.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@baml_language/crates/baml/tests/toolchain_pin_e2e.rs`:
- Around line 144-164: Update the toolchain pin command in the test around
local_cli to pass the platform-selected executable path, using baml-cli.exe on
Windows and baml-cli elsewhere, so it matches the fixture created by the test.
In `@baml_language/crates/bridge_cffi/src/lib.rs`:
- Around line 284-290: Update the startup version-skew error message in the
bridge failure path to use direction-neutral remediation: instruct users to
install a bridge package version compatible with BAML toolchain {generated}
instead of telling them to upgrade it. Also update
older_generated_toolchain_reports_complete_repair_guidance to assert the revised
wording and complete repair guidance while preserving the existing
pin-and-regenerate option.
---
Nitpick comments:
In `@baml_language/crates/bridge_cffi/src/identity.rs`:
- Around line 64-75: Add a Rust unit test alongside package_kind that
table-drives every BridgeLanguage variant—NodeJs, Web, Python, Go, Rust, CSharp,
Cpp, Java, and Swift—and asserts the expected package label returned by
package_kind. Keep the test focused on this method and use the existing
unit-test module conventions.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d7a7275-588d-4b40-a9a6-585dfdc6d61a
⛔ Files ignored due to path filters (1)
baml_language/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
baml_language/crates/baml/Cargo.tomlbaml_language/crates/baml/src/main.rsbaml_language/crates/baml/tests/toolchain_pin_e2e.rsbaml_language/crates/bridge_cffi/src/identity.rsbaml_language/crates/bridge_cffi/src/lib.rsbaml_language/sdks/python/tests/test_engine.py
|
@coderabbitai review Addressed both actionable inline findings in |
|
🧠 Learnings used
|
Summary
baml toolchain pin <canary|nightly|version|path>to select a project-local toolchain in the nearestbaml.tomlbaml toolchain usetoolchain.version,toolchain.channel, ortoolchain.pathselectorsWhy
The existing version-skew error told users to pin
toolchain.versionmanually or change their machine-wide default withbaml toolchain use. BAML did not provide a command that performed the project-local edit.This makes the primary recovery path directly executable, supports the same selector forms as
baml toolchain use, and keeps the alternative bridge-upgrade guidance specific to the active SDK ecosystem.Behavior
The command:
baml.tomlfrom the current directory[toolchain]key:version,channel, orpathValidation
cargo test -p baml -p bridge_cffi— 43 wrapper unit tests, 5 wrapper integration tests, 37 bridge unit tests, and bridge ABI/header/unhandled-spawn tests passedcargo clippy -p baml -p bridge_cffi --all-targets -- -D warningscargo fmt --all -- --checkuv run maturin develop --uvuv run pytest -n 0 tests/test_engine.py::TestBasics::test_generated_bytecode_version_skew_fails_before_deserialization -q— 1 passeduv run ruff check tests/test_engine.pygit diff --checkLinear: B-1123
Follow-up to #4315 and #4380.
Summary by CodeRabbit
New Features
baml toolchain pinto select a project-specific toolchain by version, release channel, or local executable path.Bug Fixes