Skip to content

fix: make generated gitignore configurable - #4520

Open
sxlijin wants to merge 1 commit into
canaryfrom
sxlijin/gh-4373-sdkgen-rust-generated-gitignore-makes-git
Open

fix: make generated gitignore configurable#4520
sxlijin wants to merge 1 commit into
canaryfrom
sxlijin/gh-4373-sdkgen-rust-generated-gitignore-makes-git

Conversation

@sxlijin

@sxlijin sxlijin commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a gitignore = false generator setting while preserving the current default
  • safely remove the writer-owned catch-all when the setting is disabled and preserve custom .gitignore files on subsequent generation
  • document the setting for committed Rust SDK crates

Root cause

The shared SDK output writer always installed a catch-all .gitignore, so a normal git add of a generated crate silently staged only that file.

Validation

  • cargo fmt --all -- --config imports_granularity="Crate" --config group_imports="StdExternalCrate"
  • cargo clippy -p baml_cli --all-targets --all-features -- -D warnings
  • cargo test -p baml_codegen_types --lib
  • cargo test -p baml_cli --lib generator_gitignore
  • cargo test -p baml_cli generate_rust_can_disable_generated_gitignore --test exit_code_e2e
  • cargo test -p sdkgen_csharp --lib
  • GitHub Actions: all 53 executed checks pass across Linux, Windows, macOS, musl, wasm, SDK, snapshot, documentation, MSRV, pre-commit, and size gates

Fixes #4373

@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:30am
promptfiddle2 Ready Ready Preview Aug 19, 2026 2:30am

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: 08d3b1e8-b52b-4930-bce3-4e0638307a12

📥 Commits

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

📒 Files selected for processing (7)
  • baml_language/crates/baml_cli/src/generate.rs
  • baml_language/crates/baml_cli/src/manifest.rs
  • baml_language/crates/baml_cli/tests/exit_code_e2e.rs
  • baml_language/crates/baml_codegen_types/src/generator_fields.rs
  • baml_language/crates/baml_codegen_types/src/output_writer.rs
  • baml_language/sdks/csharp/sdkgen_csharp/src/lib.rs
  • baml_language/sdks/rust/bridge_rust/README.md

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


📝 Walkthrough

Walkthrough

The generator configuration now supports gitignore = false. The setting defaults to true, reaches C# and other output writers, persists in manifests when disabled, and preserves user-managed .gitignore files. Tests and Rust SDK documentation cover the behavior.

Changes

Generated output writer

Layer / File(s) Summary
Writer policy and defaults
baml_language/crates/baml_codegen_types/src/generator_fields.rs, baml_language/crates/baml_codegen_types/src/output_writer.rs
OutputWriterOptions controls generated .gitignore creation. The default remains enabled. Disabled generation preserves a user-managed root .gitignore.
Manifest parsing and CLI propagation
baml_language/crates/baml_cli/src/manifest.rs, baml_language/crates/baml_cli/src/generate.rs
The CLI reads the optional gitignore setting, defaults it to true, serializes explicit false, and passes the policy to output writers.
SDK integration and validation
baml_language/sdks/csharp/sdkgen_csharp/src/lib.rs, baml_language/crates/baml_cli/tests/exit_code_e2e.rs, baml_language/sdks/rust/bridge_rust/README.md
C# exposes generate_into_with_options. Rust end-to-end coverage verifies that disabled generation omits .gitignore. The README documents the configuration.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 0e62c

The change makes the generated .gitignore optional while preserving the current default behavior and supporting custom files on later generation; no actionable merge-blocking risk remains after normal checks.

Sequence Diagram(s)

sequenceDiagram
  participant Manifest
  participant CLI
  participant Generator
  participant OutputWriter
  participant Filesystem
  Manifest->>CLI: provide gitignore setting
  CLI->>Generator: store gitignore policy
  Generator->>OutputWriter: write generated output with options
  OutputWriter->>Filesystem: create or preserve .gitignore
Loading

Suggested reviewers: hellovai, 2kai2kai2

Poem

A rabbit sets the switch just right,
The crate can show its files in sight.
A hidden star may stay away,
While user files remain each day.
Config and tests now hop in line.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested gitignore = false option, preserves the default, and documents committed generated Rust crates [#4373].
Out of Scope Changes check ✅ Passed The implementation, tests, API propagation, manifest support, and Rust documentation all directly support the linked issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: configurable generated .gitignore behavior.
✨ 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-4373-sdkgen-rust-generated-gitignore-makes-git

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 +99.9 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 +105.4 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 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 performed

Review finished.

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.

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: generated .gitignore ('*') makes 'git add' of the generated crate a silent no-op — document or make it configurable

1 participant