Skip to content

fix(cli): keep default generated SDK inside project - #4522

Open
sxlijin wants to merge 1 commit into
canaryfrom
sxlijin/gh-4376-sdkgen-rust-default-output-dir-writes
Open

fix(cli): keep default generated SDK inside project#4522
sxlijin wants to merge 1 commit into
canaryfrom
sxlijin/gh-4376-sdkgen-rust-default-output-dir-writes

Conversation

@sxlijin

@sxlijin sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • default an omitted output_dir to the BAML project root so the generated baml_sdk stays inside the project
  • preserve explicit output_dir behavior
  • add resolver-level and real CLI filesystem regressions, and update the generator documentation

Root cause

Generator configuration moved from source files, where paths were relative to baml_src, to baml.toml, where paths resolve relative to the project root. The former .. default was retained during that migration, changing its effective destination to the parent of the project.

Validation

  • cargo test -p baml_cli generator_output_defaults_to_project_root
  • cargo test -p baml_cli render_keyword_generator
  • cargo test -p baml_cli --test exit_code_e2e generate_rust_default_output_stays_inside_project
  • cargo test -p baml_bridge --lib
  • cargo clippy -p baml_cli --all-targets -- -D warnings
  • cargo fmt --check -- --config imports_granularity=Crate --config group_imports=StdExternalCrate

Fixes #4376

Summary by CodeRabbit

  • Bug Fixes

    • Generator output now defaults to the project directory instead of its parent directory.
    • Rust SDK files are created inside the project’s baml_sdk folder by default.
    • Java generation documentation now reflects the updated default output location.
  • Documentation

    • Updated generator configuration guidance to clarify that output_dir defaults to the current project directory.

@vercel

vercel Bot commented Aug 19, 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 Aug 19, 2026 2:27am
promptfiddle2 Ready Ready Preview Aug 19, 2026 2:27am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a192a9b3-581c-4c88-89a2-af1558ed6759

📥 Commits

Reviewing files that changed from the base of the PR and between 0f130a2 and b9917e3.

⛔ Files ignored due to path filters (1)
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_keyword_generator.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • baml_language/crates/baml_builtins2/keyword_docs/baml_keywords.yaml
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/sdks/agent-docs/bridge-ref/ref-java-packaging.md

Included review availability: Your plan provides up to 8 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The generator default output directory changes from the project parent to the project root. Rust tests verify that baml_sdk is created inside the project. Generator documentation reflects the new default.

Changes

Generator output path

Layer / File(s) Summary
Default output path contract
baml_language/crates/baml_cli/src/generate.rs, baml_language/crates/baml_builtins2/keyword_docs/baml_keywords.yaml, baml_language/sdks/agent-docs/bridge-ref/ref-java-packaging.md
The default output_dir is . instead of ... The target-specific baml_sdk suffix remains unchanged.
Project-local path validation
baml_language/crates/baml_cli/src/generate.rs, baml_language/crates/baml_cli/tests/exit_code_e2e.rs
Tests verify successful Rust generation in <project>/baml_sdk and reject output in the project parent directory.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to b9917

When output_dir is omitted, generated SDK files now remain under the project root while explicit paths continue to work. The change is bounded and mergeable with owner awareness that the required workspace-wide Rust library test should be run before merging.

Suggested reviewers: antoniosarosi, aaronvg

Poem

A rabbit checks the SDK path,
No files hop beyond the bath.
The project keeps its code in sight,
baml_sdk lands just right.
Test paws confirm the path is tight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: keeping the default generated SDK inside the project.
Linked Issues check ✅ Passed The changes address issue #4376 by defaulting generated SDK output inside the project and adding regression tests for the Rust path.
Out of Scope Changes check ✅ Passed The documentation updates and regression tests directly support the output-directory fix and are within the linked issue scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 sxlijin/gh-4376-sdkgen-rust-default-output-dir-writes

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

Copy link
Copy Markdown

Binary size checks passed

7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
baml-cli Linux 🔒 31.8 MB 12.6 MB file 31.7 MB +94.1 KB (+0.3%) OK
packed-program Linux 🔒 25.0 MB 9.2 MB file 24.9 MB +104.2 KB (+0.4%) OK
baml-cli macOS 🔒 25.5 MB 11.1 MB file 25.5 MB +32.3 KB (+0.1%) OK
packed-program macOS 🔒 20.6 MB 8.2 MB file 20.6 MB +91.4 KB (+0.4%) OK
baml-cli Windows 🔒 27.3 MB 11.3 MB file 27.2 MB +100.8 KB (+0.4%) OK
packed-program Windows 🔒 21.8 MB 8.3 MB file 21.7 MB +90.7 KB (+0.4%) OK
bridge_wasm WASM 21.3 MB 🔒 5.4 MB gzip 5.3 MB +49.1 KB (+0.9%) 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

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 38 minutes.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@sxlijin have exceeded the limit for the number of chat messages per hour. Please wait 0 minutes and 17 seconds before sending another message.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 50 seconds.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 31 seconds.

@sxlijin

sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

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.

sdkgen_rust: default output_dir writes OUTSIDE the project directory (<project>/../baml_sdk)

1 participant