fix(codegen-python): generate pydantic-friendly type aliases#3478
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughEmits recursive type aliases as typing_extensions.TypeAliasType with same-leaf forward-ref quoting; updates TranslateCtx/name rendering, leaf emission and imports, unit tests, and adds a type_shapes rig crate with build.rs, many BAML fixtures, and Python smoke tests. ChangesRecursive Type Alias Implementation & Testing
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 906fe5396a
ℹ️ 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".
| let _ = fs::remove_file(&dst); | ||
| } | ||
| #[cfg(unix)] | ||
| std::os::unix::fs::symlink(&src, &dst).unwrap_or_else(|_| { |
There was a problem hiding this comment.
Write generated test files portably
In a fresh checkout, this symlinks generated/test_main.py to the absolute CARGO_MANIFEST_DIR path from the machine that ran codegen; the committed tree already records /Users/sam/baml2/..., so anyone running type_shapes/generated/test.sh directly gets a broken test_main.py and pytest exits with no tests. Copy the customizable file or create a relative symlink before committing generated output.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
baml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml (1)
10-14: 💤 Low value
OptionalContainerhas no correspondingPass…function — intentional gap or omission?Every other ns_* module in the suite appears to pair container classes with a
Pass…function to exercise round-trip codegen.OptionalContaineris defined but has noPassOptionalContainercounterpart. If this is deliberate (testing the class shape in isolation), a brief comment noting that would prevent confusion for future contributors.💡 Suggested addition (if a pass-through is desired)
function PassOptionalUnion(u: (int | string)?) -> (int | string)? { u } + +function PassOptionalContainer(c: OptionalContainer?) -> OptionalContainer? { + c +}🤖 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/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml` around lines 10 - 14, The file defines OptionalContainer but lacks the corresponding pass-through function; either add a PassOptionalContainer function to the ns_optional test module to exercise round-trip codegen for the OptionalContainer class (match the naming/pattern used by other ns_* modules) or add a brief comment above OptionalContainer stating the omission is intentional and this class is tested in isolation; reference the OptionalContainer class and the expected PassOptionalContainer function in your change so future reviewers can see the intent.baml_language/rig_tests/crates/type_shapes/src/lib.rs (1)
11-29: 💤 Low valueConsider
Option<&str>instead of an empty-string sentinel for the optional argument.Using
""as a sentinel and guarding it with!arg.is_empty()works but is less explicit than anOption. This is a purely stylistic nit in a test module; no functional impact.♻️ Proposed refactor
- #[cfg(windows)] - let (script_name, command, arg) = ("test.ps1", "powershell", "-File"); - - #[cfg(not(windows))] - let (script_name, command, arg) = ("test.sh", "bash", ""); - - let test_script = dir.join(script_name); - - assert!( - test_script.exists(), - "{} not found in generated directory", - script_name - ); - - // Run the test script - let mut cmd = Command::new(command); - if !arg.is_empty() { - cmd.arg(arg); - } + #[cfg(windows)] + let (script_name, command, flag) = ("test.ps1", "powershell", Some("-File")); + + #[cfg(not(windows))] + let (script_name, command, flag): (&str, &str, Option<&str>) = ("test.sh", "bash", None); + + let test_script = dir.join(script_name); + + assert!( + test_script.exists(), + "{} not found in generated directory", + script_name + ); + + // Run the test script + let mut cmd = Command::new(command); + if let Some(f) = flag { + cmd.arg(f); + }🤖 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/rig_tests/crates/type_shapes/src/lib.rs` around lines 11 - 29, The test uses an empty-string sentinel for the optional shell argument; change the tuple to use Option<&str> for arg (e.g. let (script_name, command, arg): (&str, &str, Option<&str>) = ("test.ps1","powershell", Some("-File")) and ("test.sh","bash", None)), then update the Command builder (variable cmd) to add the argument with if let Some(a) = arg { cmd.arg(a); } so the presence/absence is explicit; keep script_name, command and test_script logic unchanged.baml_language/rig_tests/crates/type_shapes/build.rs (1)
205-208: ⚡ Quick winKeep the Windows test script aligned with the Unix checks.
test.shrunspyright, buttest.ps1skips it. That leaves a Windows-only gap in the rig's main type-validation signal.Proposed fix
Write-Host "==> Running ruff lint..." uv run ruff check --config pyproject.toml baml_sdk +Write-Host "==> Running pyright..." +uv run pyright baml_sdk Write-Host "==> Running pytest..." uv run pytest -v🤖 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/rig_tests/crates/type_shapes/build.rs` around lines 205 - 208, The Windows test script currently runs ruff and pytest but omits the pyright type check present in the Unix test.sh; update the PowerShell block (the lines with Write-Host and the uv run commands) to add the pyright invocation (e.g., add a line like "uv run pyright --project pyrightconfig.json" or the project's equivalent) between the ruff and pytest commands so Windows runs the same pyright type validation as Unix.
🤖 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/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml`:
- Around line 7-9: The header comment incorrectly says the "instantiation
differs from declaration" case occurs inside GenericLinkedList<T>; update the
comment to instead reference the actual case exercised by
DifferingInstantiation.list (which contains next:
GenericLinkedList<Wrapper<int>> differing from GenericLinkedList<T>), or reword
the header to point to DifferingInstantiation.list and describe the rendered
output (Union["GenericLinkedList[Wrapper[int]]", None]); ensure the symbols
GenericLinkedList and DifferingInstantiation.list are mentioned so the comment
aligns with the codegen surface.
In `@baml_language/rig_tests/crates/type_shapes/build.rs`:
- Around line 93-108: The Windows symlink branch using
std::os::windows::fs::symlink_file may fail on CI; change the unwrap_or_else
panic to attempt a fallback copy using std::fs::copy(src, &dst) when
symlink_file returns Err, and only panic if the copy also fails; do the same for
the unix branch if you want parity, and include src, dst and
file_name.to_string_lossy() in the final panic message so failures show both
operations and the file path.
- Around line 215-226: The build script only registers individual files but not
the directories themselves, so adding new files won't trigger Cargo; update
watch_dir to first emit println!("cargo:rerun-if-changed={}", dir.display()) for
the directory (so Cargo watches the directory itself) and then iterate
walk_files(dir) to emit entries for each file; change calls that use watch_dir
(e.g., where baml_src and customizable_dir are passed) remain the same but now
both the directory and its current contents are registered for rebuilds.
In `@baml_language/rig_tests/crates/type_shapes/src/lib.rs`:
- Line 34: The panic on spawn failure discards the std::io::Error via the
closure |_|; update the unwrap_or_else call (the closure attached to spawn
result where script_name is used) to capture the error (e) and include it in the
panic message so the OS error is shown (e.g., panic!("Failed to run {}: {}",
script_name, e)). Locate the unwrap_or_else(...) call near the spawn/command
invocation and replace the |_| closure with a closure that takes the error and
includes it in the panic.
---
Nitpick comments:
In `@baml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml`:
- Around line 10-14: The file defines OptionalContainer but lacks the
corresponding pass-through function; either add a PassOptionalContainer function
to the ns_optional test module to exercise round-trip codegen for the
OptionalContainer class (match the naming/pattern used by other ns_* modules) or
add a brief comment above OptionalContainer stating the omission is intentional
and this class is tested in isolation; reference the OptionalContainer class and
the expected PassOptionalContainer function in your change so future reviewers
can see the intent.
In `@baml_language/rig_tests/crates/type_shapes/build.rs`:
- Around line 205-208: The Windows test script currently runs ruff and pytest
but omits the pyright type check present in the Unix test.sh; update the
PowerShell block (the lines with Write-Host and the uv run commands) to add the
pyright invocation (e.g., add a line like "uv run pyright --project
pyrightconfig.json" or the project's equivalent) between the ruff and pytest
commands so Windows runs the same pyright type validation as Unix.
In `@baml_language/rig_tests/crates/type_shapes/src/lib.rs`:
- Around line 11-29: The test uses an empty-string sentinel for the optional
shell argument; change the tuple to use Option<&str> for arg (e.g. let
(script_name, command, arg): (&str, &str, Option<&str>) =
("test.ps1","powershell", Some("-File")) and ("test.sh","bash", None)), then
update the Command builder (variable cmd) to add the argument with if let
Some(a) = arg { cmd.arg(a); } so the presence/absence is explicit; keep
script_name, command and test_script logic 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: e8d224be-d490-4e0f-9ea9-193327e9692a
⛔ Files ignored due to path filters (127)
baml_language/Cargo.lockis excluded by!**/*.lockbaml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/_inlinedbaml.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/py.typedis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/pyproject.tomlis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test.ps1is excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test.shis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test_main.pyis excluded by!**/generated/**
📒 Files selected for processing (25)
baml_language/rig_tests/crates/.gitignorebaml_language/rig_tests/crates/type_shapes/Cargo.tomlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/root.bamlbaml_language/rig_tests/crates/type_shapes/build.rsbaml_language/rig_tests/crates/type_shapes/customizable/test_main.pybaml_language/rig_tests/crates/type_shapes/src/lib.rs
| // - "instantiation differs from declaration" — inside GenericLinkedList<T>, | ||
| // `next: GenericLinkedList<Wrapper<int>>` (different T arg) → rendered | ||
| // as `Union["GenericLinkedList[Wrapper[int]]", None]`. |
There was a problem hiding this comment.
Header comment doesn't match the code it points at.
The bullet describes next: GenericLinkedList<Wrapper<int>> inside GenericLinkedList<T>, but the actual class at lines 15-18 has next GenericLinkedList<T>? (same T). The "differing instantiation" case is exercised by DifferingInstantiation.list at lines 45-47, not on GenericLinkedList itself. Worth fixing so the header accurately maps to where the codegen surface actually appears, since this file is meant to be diffed against generated Python.
📝 Suggested doc fix
-// - "instantiation differs from declaration" — inside GenericLinkedList<T>,
-// `next: GenericLinkedList<Wrapper<int>>` (different T arg) → rendered
-// as `Union["GenericLinkedList[Wrapper[int]]", None]`.
+// - "instantiation differs from declaration" — `DifferingInstantiation.list`
+// of type `GenericLinkedList<Wrapper<int>>` instantiates the recursive
+// generic with a non-TypeVar arg at a non-declaration site → rendered
+// as `"GenericLinkedList[Wrapper[int]]"`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // - "instantiation differs from declaration" — inside GenericLinkedList<T>, | |
| // `next: GenericLinkedList<Wrapper<int>>` (different T arg) → rendered | |
| // as `Union["GenericLinkedList[Wrapper[int]]", None]`. | |
| // - "instantiation differs from declaration" — `DifferingInstantiation.list` | |
| // of type `GenericLinkedList<Wrapper<int>>` instantiates the recursive | |
| // generic with a non-TypeVar arg at a non-declaration site → rendered | |
| // as `"GenericLinkedList[Wrapper[int]]"`. |
🤖 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/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml`
around lines 7 - 9, The header comment incorrectly says the "instantiation
differs from declaration" case occurs inside GenericLinkedList<T>; update the
comment to instead reference the actual case exercised by
DifferingInstantiation.list (which contains next:
GenericLinkedList<Wrapper<int>> differing from GenericLinkedList<T>), or reword
the header to point to DifferingInstantiation.list and describe the rendered
output (Union["GenericLinkedList[Wrapper[int]]", None]); ensure the symbols
GenericLinkedList and DifferingInstantiation.list are mentioned so the comment
aligns with the codegen surface.
| #[cfg(unix)] | ||
| std::os::unix::fs::symlink(&src, &dst).unwrap_or_else(|_| { | ||
| panic!( | ||
| "Failed to symlink {} from {}", | ||
| file_name.to_string_lossy(), | ||
| src.display() | ||
| ) | ||
| }); | ||
| #[cfg(windows)] | ||
| std::os::windows::fs::symlink_file(&src, &dst).unwrap_or_else(|_| { | ||
| panic!( | ||
| "Failed to symlink {} from {}", | ||
| file_name.to_string_lossy(), | ||
| src.display() | ||
| ) | ||
| }); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the build.rs file
find . -name "build.rs" -path "*/type_shapes/*" | head -5Repository: BoundaryML/baml
Length of output: 113
🏁 Script executed:
# Read the file around the specified lines
cat -n baml_language/rig_tests/crates/type_shapes/build.rs | sed -n '80,115p'Repository: BoundaryML/baml
Length of output: 1654
🏁 Script executed:
# Check imports at the top of the file
head -30 baml_language/rig_tests/crates/type_shapes/build.rs | cat -nRepository: BoundaryML/baml
Length of output: 1401
🏁 Script executed:
# Search for how the symlinked/copied files are used
grep -r "generated/" baml_language/rig_tests/crates/type_shapes/ -A 2 -B 2 | head -40Repository: BoundaryML/baml
Length of output: 478
🏁 Script executed:
# Check the actual structure and see if there are tests
ls -la baml_language/rig_tests/crates/type_shapes/Repository: BoundaryML/baml
Length of output: 529
🏁 Script executed:
# Look for test files in the crate
find baml_language/rig_tests/crates/type_shapes/ -name "*.rs" -type fRepository: BoundaryML/baml
Length of output: 165
🏁 Script executed:
# Check the Cargo.toml to understand the crate purpose
cat baml_language/rig_tests/crates/type_shapes/Cargo.tomlRepository: BoundaryML/baml
Length of output: 802
🏁 Script executed:
# Verify if fs::copy is already in use elsewhere or if there are any issues with the proposed fallback
grep -n "fs::copy\|fs::symlink" baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 218
🏁 Script executed:
# Check the lib.rs to understand the crate structure and tests
cat baml_language/rig_tests/crates/type_shapes/src/lib.rsRepository: BoundaryML/baml
Length of output: 1340
🏁 Script executed:
# Look at the entire build.rs to understand context - especially how the generated files are used
wc -l baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 115
🏁 Script executed:
# Read the full build.rs
cat baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 8034
Fall back to copying customizable files when symlinks are unavailable on Windows.
symlink_file requires Developer Mode or elevated privileges on Windows and commonly fails on standard runners. This can block builds on those platforms even though the test runner only needs to read the file contents from generated/. Since fs is already imported, the fallback is straightforward and widely used for this pattern.
Proposed fix
#[cfg(windows)]
- std::os::windows::fs::symlink_file(&src, &dst).unwrap_or_else(|_| {
- panic!(
- "Failed to symlink {} from {}",
- file_name.to_string_lossy(),
- src.display()
- )
- });
+ if let Err(err) = std::os::windows::fs::symlink_file(&src, &dst) {
+ fs::copy(&src, &dst).unwrap_or_else(|copy_err| {
+ panic!(
+ "Failed to materialize {} from {}: symlink failed with {err}; copy failed with {copy_err}",
+ file_name.to_string_lossy(),
+ src.display()
+ )
+ });
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #[cfg(unix)] | |
| std::os::unix::fs::symlink(&src, &dst).unwrap_or_else(|_| { | |
| panic!( | |
| "Failed to symlink {} from {}", | |
| file_name.to_string_lossy(), | |
| src.display() | |
| ) | |
| }); | |
| #[cfg(windows)] | |
| std::os::windows::fs::symlink_file(&src, &dst).unwrap_or_else(|_| { | |
| panic!( | |
| "Failed to symlink {} from {}", | |
| file_name.to_string_lossy(), | |
| src.display() | |
| ) | |
| }); | |
| #[cfg(unix)] | |
| std::os::unix::fs::symlink(&src, &dst).unwrap_or_else(|_| { | |
| panic!( | |
| "Failed to symlink {} from {}", | |
| file_name.to_string_lossy(), | |
| src.display() | |
| ) | |
| }); | |
| #[cfg(windows)] | |
| if let Err(err) = std::os::windows::fs::symlink_file(&src, &dst) { | |
| fs::copy(&src, &dst).unwrap_or_else(|copy_err| { | |
| panic!( | |
| "Failed to materialize {} from {}: symlink failed with {err}; copy failed with {copy_err}", | |
| file_name.to_string_lossy(), | |
| src.display() | |
| ) | |
| }); | |
| } |
🤖 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/rig_tests/crates/type_shapes/build.rs` around lines 93 - 108,
The Windows symlink branch using std::os::windows::fs::symlink_file may fail on
CI; change the unwrap_or_else panic to attempt a fallback copy using
std::fs::copy(src, &dst) when symlink_file returns Err, and only panic if the
copy also fails; do the same for the unix branch if you want parity, and include
src, dst and file_name.to_string_lossy() in the final panic message so failures
show both operations and the file path.
| println!("cargo:rerun-if-changed=build.rs"); | ||
| watch_dir(&baml_src); | ||
| if customizable_dir.exists() { | ||
| watch_dir(&customizable_dir); | ||
| } | ||
| } | ||
|
|
||
| fn watch_dir(dir: &Path) { | ||
| let walker = walk_files(dir); | ||
| for path in walker { | ||
| println!("cargo:rerun-if-changed={}", path.display()); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -name "build.rs" -path "*/type_shapes/*" -type fRepository: BoundaryML/baml
Length of output: 113
🏁 Script executed:
sed -n '210,230p' ./baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 605
🏁 Script executed:
sed -n '233,260p' ./baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 285
🏁 Script executed:
sed -n '227,245p' ./baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 448
🌐 Web query:
Cargo rerun-if-changed directory behavior new files
💡 Result:
Cargo build-script change detection via cargo:rerun-if-changed=PATH: 1) If PATH is a directory, Cargo does NOT reliably treat “new/changed files inside that directory” as a reason to rerun. - Historically/according to Cargo issue discussions, Cargo does not traverse the directory to find changes inside; instead it uses directory mtime semantics (which correspond to some changes depending on platform) rather than recursively watching all contents. This means edits/new files may not trigger the build script the way you might expect. [1][2] 2) How to get the behavior you want (rerun when new/changed files appear inside a directory): - Emit cargo:rerun-if-changed for the directory itself and also for the files inside it recursively (i.e., list them explicitly, or generate that list in build.rs/a helper). The Cargo docs state that to request a re-run on any changes within an entire directory, you must print a line for the directory and separate lines for everything inside it, recursively. [3][2] 3) If you see behavior that differs (e.g., “directory scanning”): - There have been implementation work items/PRs around scanning directories for changes when rerun-if-changed points to a directory (as opposed to only directory mtime), but the safe, documented way is still to emit explicit paths if you need correctness for “new files/contents.” [3] Practical recommendation - For “new files in a directory should trigger rerun”, don’t rely on cargo:rerun-if-changed=<dir> alone. Instead, enumerate the directory contents (recursively) and print cargo:rerun-if-changed=<file> for each, plus optionally the directory itself. [2][3]
Citations:
- 1: rerun-if-changed on directory does not rerun on new timestamp or file contents rust-lang/cargo#2599
- 2: https://docs.rs/cargo-emit/latest/cargo_emit/macro.rerun_if_changed.html
- 3: Check if rerun-if-changed points to a directory. rust-lang/cargo#8973
🏁 Script executed:
rg "rerun-if-changed" ./baml_language/rig_tests/crates/type_shapes/build.rsRepository: BoundaryML/baml
Length of output: 241
Register the source directories with Cargo to detect new files.
The current implementation only emits cargo:rerun-if-changed for files that exist during the build. Cargo does not reliably detect new files added to a directory monitored only via its mtime. Adding a new .baml file or a new customizable fixture will not retrigger codegen until some already-watched path changes.
To fix this, register both the directories themselves and their contents:
Proposed fix
println!("cargo:rerun-if-changed=build.rs");
+ println!("cargo:rerun-if-changed={}", baml_src.display());
watch_dir(&baml_src);
if customizable_dir.exists() {
+ println!("cargo:rerun-if-changed={}", customizable_dir.display());
watch_dir(&customizable_dir);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| println!("cargo:rerun-if-changed=build.rs"); | |
| watch_dir(&baml_src); | |
| if customizable_dir.exists() { | |
| watch_dir(&customizable_dir); | |
| } | |
| } | |
| fn watch_dir(dir: &Path) { | |
| let walker = walk_files(dir); | |
| for path in walker { | |
| println!("cargo:rerun-if-changed={}", path.display()); | |
| } | |
| println!("cargo:rerun-if-changed=build.rs"); | |
| println!("cargo:rerun-if-changed={}", baml_src.display()); | |
| watch_dir(&baml_src); | |
| if customizable_dir.exists() { | |
| println!("cargo:rerun-if-changed={}", customizable_dir.display()); | |
| watch_dir(&customizable_dir); | |
| } | |
| } | |
| fn watch_dir(dir: &Path) { | |
| let walker = walk_files(dir); | |
| for path in walker { | |
| println!("cargo:rerun-if-changed={}", path.display()); | |
| } |
🤖 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/rig_tests/crates/type_shapes/build.rs` around lines 215 - 226,
The build script only registers individual files but not the directories
themselves, so adding new files won't trigger Cargo; update watch_dir to first
emit println!("cargo:rerun-if-changed={}", dir.display()) for the directory (so
Cargo watches the directory itself) and then iterate walk_files(dir) to emit
entries for each file; change calls that use watch_dir (e.g., where baml_src and
customizable_dir are passed) remain the same but now both the directory and its
current contents are registered for rebuilds.
| .arg(&test_script) | ||
| .current_dir(&dir) | ||
| .output() | ||
| .unwrap_or_else(|_| panic!("Failed to run {}", script_name)); |
There was a problem hiding this comment.
Include the OS error in the spawn-failure panic message.
The |_| closure discards the std::io::Error, making it hard to diagnose why the process failed to launch (e.g., bash not on PATH, permission denied).
🔧 Proposed fix
- .unwrap_or_else(|_| panic!("Failed to run {}", script_name));
+ .unwrap_or_else(|e| panic!("Failed to run {}: {}", script_name, e));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .unwrap_or_else(|_| panic!("Failed to run {}", script_name)); | |
| .unwrap_or_else(|e| panic!("Failed to run {}: {}", script_name, e)); |
🤖 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/rig_tests/crates/type_shapes/src/lib.rs` at line 34, The panic
on spawn failure discards the std::io::Error via the closure |_|; update the
unwrap_or_else call (the closure attached to spawn result where script_name is
used) to capture the error (e) and include it in the panic message so the OS
error is shown (e.g., panic!("Failed to run {}: {}", script_name, e)). Locate
the unwrap_or_else(...) call near the spawn/command invocation and replace the
|_| closure with a closure that takes the error and includes it in the panic.
Merging this PR will improve performance by 10.41%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | engine_init_cost |
2.8 ms | 2.5 ms | +10.41% |
Comparing sam/type-shapes-rig (c7ef019) with canary (48db958)
Binary size checks passed✅ 7 passed
Generated by |
906fe53 to
7c6ba12
Compare
7c6ba12 to
cc96629
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
baml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml (1)
7-9:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winHeader comment still points to the wrong instantiation site.
This note says the differing-instantiation case is inside
GenericLinkedList<T>, but that class usesnext GenericLinkedList<T>?(Line 17). The non-matching instantiation is actuallyDifferingInstantiation.list(Line 46). Please realign the comment so it matches the exercised fixture.Suggested minimal doc fix
-// - "instantiation differs from declaration" — inside GenericLinkedList<T>, -// `next: GenericLinkedList<Wrapper<int>>` (different T arg) → rendered -// as `Union["GenericLinkedList[Wrapper[int]]", None]`. +// - "instantiation differs from declaration" — `DifferingInstantiation.list` +// uses `GenericLinkedList<Wrapper<int>>` (non-TypeVar generic arg at a +// non-declaration site) to exercise differing recursive instantiation.🤖 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/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml` around lines 7 - 9, The header comment incorrectly says the differing-instantiation case is inside GenericLinkedList<T>; update the comment to point at the actual site exercised by the fixture, namely DifferingInstantiation.list (the instantiation where next is GenericLinkedList<Wrapper<int>> vs the declaration GenericLinkedList<T>), so the documentation matches the tested scenario and references DifferingInstantiation.list instead of GenericLinkedList<T>.
🤖 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/languages/python/rust/codegen_python/src/leaf.rs`:
- Around line 320-338: The hoist that moves recursive aliases to the front (the
pairs.sort_by_key block that matches EmittedSymbol::TypeAlias(a) if a.recursive)
can break runtime .py imports because the TypeAliasType(...) RHS may reference
same-leaf names that are defined later; constrain this hoist to only run when
emitting stubs (e.g., when emitting .pyi) by gating the pairs.sort_by_key call
on the emission-mode flag, otherwise preserve the earlier stable sort order for
.py output, or alternatively implement forward-quoting of unresolved same-leaf
references in the TypeAlias RHS so runtime evaluation won’t raise NameError.
---
Duplicate comments:
In `@baml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml`:
- Around line 7-9: The header comment incorrectly says the
differing-instantiation case is inside GenericLinkedList<T>; update the comment
to point at the actual site exercised by the fixture, namely
DifferingInstantiation.list (the instantiation where next is
GenericLinkedList<Wrapper<int>> vs the declaration GenericLinkedList<T>), so the
documentation matches the tested scenario and references
DifferingInstantiation.list instead of GenericLinkedList<T>.
🪄 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: dacf5c68-6dbd-45c7-9a36-7a6c2899d6ec
⛔ Files ignored due to path filters (131)
baml_language/Cargo.lockis excluded by!**/*.lockbaml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases_consumer/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases_consumer/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/_inlinedbaml.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/py.typedis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases_consumer/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases_consumer/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/pyproject.tomlis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test.ps1is excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test.shis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/test_main.pyis excluded by!**/generated/**
📒 Files selected for processing (32)
baml_language/languages/python/rust/codegen_python/src/emit/type_alias.rsbaml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rsbaml_language/rig_tests/crates/.gitignorebaml_language/rig_tests/crates/type_shapes/Cargo.tomlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/root.bamlbaml_language/rig_tests/crates/type_shapes/build.rsbaml_language/rig_tests/crates/type_shapes/customizable/test_main.pybaml_language/rig_tests/crates/type_shapes/src/lib.rs
✅ Files skipped from review due to trivial changes (18)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/root.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.baml
- baml_language/rig_tests/crates/type_shapes/Cargo.toml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.baml
- baml_language/rig_tests/crates/type_shapes/customizable/test_main.py
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.baml
🚧 Files skipped from review as they are similar to previous changes (9)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.baml
- baml_language/rig_tests/crates/type_shapes/src/lib.rs
- baml_language/rig_tests/crates/.gitignore
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.baml
- baml_language/rig_tests/crates/type_shapes/build.rs
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.baml
There was a problem hiding this comment.
🧹 Nitpick comments (1)
baml_language/languages/python/rust/codegen_python/src/translate_ty.rs (1)
174-195: ⚡ Quick winAdd unit tests for the
quote_same_leaf_refs: truecode path.All test constructors set
quote_same_leaf_refs: false, leaving the newTy::Enumquoting branch (lines 62–69) and theshould_quote_same_leafguard inrender_name_ref_or_self_ref(line 118) completely untested within this file. Per the coding guidelines, Rust unit tests are preferred over integration-only coverage.At minimum, the following cases should be added:
🧪 Suggested test cases to add to
translate_ty_covers_phase_g3_matrix// Helper (add alongside ctx / ctx_with_self) fn ctx_quoting(segments: &[&str]) -> TranslateCtx { TranslateCtx { current_leaf: leaf(segments), self_ref: None, quote_same_leaf_refs: true, } } // New cases: Case { label: "enum same-leaf quoted when quote_same_leaf_refs", ty: Ty::Enum(name("user", &["ipsum"], "Sentiment")), ctx: ctx_quoting(&["ipsum"]), expected: "\"Sentiment\"", }, Case { label: "enum cross-leaf not quoted when quote_same_leaf_refs", ty: Ty::Enum(name("user", &["ipsum"], "Sentiment")), ctx: ctx_quoting(&["lorem"]), expected: "ipsum.Sentiment", }, Case { label: "class same-leaf quoted when quote_same_leaf_refs (no self_ref)", ty: Ty::Class(name("user", &["lorem"], "Resume"), vec![]), ctx: ctx_quoting(&["lorem"]), expected: "\"Resume\"", }, Case { label: "type alias same-leaf quoted when quote_same_leaf_refs", ty: Ty::TypeAlias(name("user", &["util"], "StringList")), ctx: ctx_quoting(&["util"]), expected: "\"StringList\"", },As per coding guidelines: "Prefer writing 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/languages/python/rust/codegen_python/src/translate_ty.rs` around lines 174 - 195, Add unit tests exercising the quote_same_leaf_refs = true path by adding a helper ctor (e.g., ctx_quoting) that returns TranslateCtx with quote_same_leaf_refs: true and then extend translate_ty_covers_phase_g3_matrix with the suggested cases: ensure Ty::Enum with current_leaf equal to the enum's leaf yields a quoted name, with different leaf yields fully-qualified name, and similarly add same-leaf quoted cases for Ty::Class and Ty::TypeAlias (no self_ref). Update tests to reference the existing helper functions leaf, name and the ctx/ctx_with_self patterns and assert outputs from the code paths in render_name_ref_or_self_ref and the Ty::Enum quoting branch.
🤖 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/languages/python/rust/codegen_python/src/translate_ty.rs`:
- Around line 174-195: Add unit tests exercising the quote_same_leaf_refs = true
path by adding a helper ctor (e.g., ctx_quoting) that returns TranslateCtx with
quote_same_leaf_refs: true and then extend translate_ty_covers_phase_g3_matrix
with the suggested cases: ensure Ty::Enum with current_leaf equal to the enum's
leaf yields a quoted name, with different leaf yields fully-qualified name, and
similarly add same-leaf quoted cases for Ty::Class and Ty::TypeAlias (no
self_ref). Update tests to reference the existing helper functions leaf, name
and the ctx/ctx_with_self patterns and assert outputs from the code paths in
render_name_ref_or_self_ref and the Ty::Enum quoting branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1b454250-d450-4c87-8a58-4da780b4be95
⛔ Files ignored due to path filters (9)
baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/_inlinedbaml.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyiis excluded by!**/generated/**
📒 Files selected for processing (5)
baml_language/languages/python/rust/codegen_python/src/emit/type_alias.rsbaml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rsbaml_language/languages/python/rust/codegen_python/src/translate_ty.rsbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.baml
✅ Files skipped from review due to trivial changes (1)
- baml_language/languages/python/rust/codegen_python/src/emit/type_alias.rs
🚧 Files skipped from review as they are similar to previous changes (3)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.baml
- baml_language/languages/python/rust/codegen_python/src/leaf.rs
- baml_language/languages/python/rust/codegen_python/src/lib.rs
436b11a to
97ce7f3
Compare
97ce7f3 to
6294968
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
baml_language/languages/python/rust/codegen_python/src/translate_ty.rs (1)
155-743: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winAdd unit tests covering
quote_same_leaf_refs: true.Every unit test uses
ctx()orctx_with_self(), both of which hard-codequote_same_leaf_refs: false. The newshould_quote_same_leafpredicate — including theTy::Enumsame-leaf quoting path, theTy::Classsame-leaf non-self-ref quoting, and the cross-leaf / root-namespace boundary behaviour — has zero unit-test coverage in this module. The coding guidelines require preferring Rust unit tests over integration tests.At minimum, a helper and a few cases would close the gap:
🧪 Suggested unit test additions
+ fn ctx_quoting(segments: &[&str]) -> TranslateCtx { + TranslateCtx { + current_leaf: leaf(segments), + self_ref: None, + quote_same_leaf_refs: true, + } + }Additional
Caseentries insidetranslate_ty_covers_phase_g3_matrix:+ Case { + label: "quote_same_leaf: enum same leaf is quoted", + ty: Ty::Enum(name("user", &["ipsum"], "Sentiment")), + ctx: ctx_quoting(&["ipsum"]), + expected: "\"Sentiment\"", + }, + Case { + label: "quote_same_leaf: enum cross leaf is not quoted", + ty: Ty::Enum(name("user", &["ipsum"], "Sentiment")), + ctx: ctx_quoting(&["lorem"]), + expected: "ipsum.Sentiment", + }, + Case { + label: "quote_same_leaf: class same leaf is quoted", + ty: Ty::Class(name("user", &["util"], "Other"), vec![]), + ctx: ctx_quoting(&["util"]), + expected: "\"Other\"", + }, + Case { + label: "quote_same_leaf: type alias same leaf is quoted", + ty: Ty::TypeAlias(name("user", &["util"], "Alias")), + ctx: ctx_quoting(&["util"]), + expected: "\"Alias\"", + }, + Case { + label: "quote_same_leaf: type alias cross leaf is not quoted", + ty: Ty::TypeAlias(name("user", &["util"], "Alias")), + ctx: ctx_quoting(&["lorem"]), + expected: "util.Alias", + }, + Case { + label: "quote_same_leaf: root-namespace class is quoted", + ty: Ty::Class(name("user", &[], "Foo"), vec![]), + ctx: ctx_quoting(&["lorem"]), + expected: "\"Foo\"", + },As per coding guidelines: "Prefer writing 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/languages/python/rust/codegen_python/src/translate_ty.rs` around lines 155 - 743, Add unit tests that exercise the should_quote_same_leaf behavior by creating new TranslateCtx helpers that set quote_same_leaf_refs: true (e.g., a ctx_quote_same(…) and ctx_with_self_quote(…) mirroring ctx() and ctx_with_self()), then add Case entries in translate_ty_covers_phase_g3_matrix covering: Ty::Enum same-leaf quoting, Ty::Class same-leaf non-self-ref quoting, and cross-leaf/root-namespace boundary cases that exercise stream and vendor paths; use translate_ty and assert_ty as existing tests do so the new cases validate the should_quote_same_leaf predicate and related paths.
🤖 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.
Outside diff comments:
In `@baml_language/languages/python/rust/codegen_python/src/translate_ty.rs`:
- Around line 155-743: Add unit tests that exercise the should_quote_same_leaf
behavior by creating new TranslateCtx helpers that set quote_same_leaf_refs:
true (e.g., a ctx_quote_same(…) and ctx_with_self_quote(…) mirroring ctx() and
ctx_with_self()), then add Case entries in translate_ty_covers_phase_g3_matrix
covering: Ty::Enum same-leaf quoting, Ty::Class same-leaf non-self-ref quoting,
and cross-leaf/root-namespace boundary cases that exercise stream and vendor
paths; use translate_ty and assert_ty as existing tests do so the new cases
validate the should_quote_same_leaf predicate and related paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c1a49a14-2725-4e75-8481-8d1e176922eb
⛔ Files ignored due to path filters (127)
baml_language/Cargo.lockis excluded by!**/*.lockbaml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases_consumer/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/aliases_consumer/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/_inlinedbaml.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/py.typedis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/a/b/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases_consumer/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/aliases_consumer/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/errors/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/fs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/glob/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/http/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/llm/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/net/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/panics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/stream/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/baml/sys/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/class_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/enums/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/forward_refs/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/generics/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lists/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/literals/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/lorem/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/maps/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/media/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/optional/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/primitives/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/recursion/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/stream_types/vendor/testing/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/unions/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/__init__.pyiis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyis excluded by!**/generated/**baml_language/rig_tests/crates/type_shapes/generated/baml_sdk/vendor/testing/__init__.pyiis excluded by!**/generated/**
📒 Files selected for processing (34)
.pre-commit-config.yamlbaml_language/languages/python/rust/codegen_python/src/emit/type_alias.rsbaml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rsbaml_language/languages/python/rust/codegen_python/src/translate_ty.rsbaml_language/rig_tests/crates/.gitignorebaml_language/rig_tests/crates/type_shapes/Cargo.tomlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/root.bamlbaml_language/rig_tests/crates/type_shapes/build.rsbaml_language/rig_tests/crates/type_shapes/customizable/test_main.pybaml_language/rig_tests/crates/type_shapes/src/lib.rs
✅ Files skipped from review due to trivial changes (18)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.baml
- baml_language/rig_tests/crates/type_shapes/Cargo.toml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml
- baml_language/languages/python/rust/codegen_python/src/emit/type_alias.rs
- baml_language/rig_tests/crates/type_shapes/baml_src/root.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.baml
- baml_language/rig_tests/crates/.gitignore
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.baml
🚧 Files skipped from review as they are similar to previous changes (13)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.baml
- baml_language/rig_tests/crates/type_shapes/src/lib.rs
- baml_language/rig_tests/crates/type_shapes/customizable/test_main.py
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml
- baml_language/languages/python/rust/codegen_python/src/lib.rs
- baml_language/languages/python/rust/codegen_python/src/leaf.rs
all of these issues are pre-existing
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/languages/python/rust/codegen_python/src/leaf.rs`:
- Around line 691-708: render_type_alias currently only quotes same-leaf name
references via TranslateCtx.quote_same_leaf_refs when a.recursive is true,
leaving cross-leaf references (e.g., util.Bar) as bare names that rely on
TYPE_CHECKING-only imports and thus fail at runtime when TypeAliasType evaluates
its RHS; update render_type_alias so that for recursive aliases (a.recursive)
any cross-leaf routed names are either emitted as quoted forward-ref strings in
the RHS or cause their modules to be imported at runtime (not only under if
typing.TYPE_CHECKING) — adjust TranslateCtx construction or the quoting logic
that uses quote_same_leaf_refs to detect routed_leaf != current_leaf and quote
those names (or flip their imports out of TYPE_CHECKING) so TypeAliasType("...",
...) has all names resolvable at module load time.
🪄 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: 3776e41f-72c5-4b08-9c52-d1e9623e10ba
📒 Files selected for processing (2)
baml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- baml_language/languages/python/rust/codegen_python/src/lib.rs
2c6fb4e to
18f118d
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
baml_language/languages/python/rust/codegen_python/src/leaf.rs (1)
715-720:⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy liftRecursive aliases can still fail at import time when RHS uses cross-leaf/root names.
At Line 719, recursive alias rendering only enables same-leaf quoting. Cross-leaf/root references can remain bare in
TypeAliasTypeRHS, but Lines 897-908 place those imports undertyping.TYPE_CHECKING. BecauseTypeAliasType(...)evaluates RHS at module import time, this can still raiseNameErrorin.pyfor recursive aliases that reference routed names.#!/bin/bash set -euo pipefail # Verify recursive alias rendering path and quoting scope in codegen. rg -n -C3 'TypeAliasType\(|quote_same_leaf_refs:\s*a\.recursive|if typing\.TYPE_CHECKING:' \ baml_language/languages/python/rust/codegen_python/src/leaf.rs \ baml_language/languages/python/rust/codegen_python/src/translate_ty.rs # Inspect checked-in generated SDKs for recursive aliases whose RHS includes bare dotted names. # Expected: either those refs are quoted, or corresponding imports are runtime-available. fd -t d '^baml_sdk$' . | while read -r sdk_dir; do fd -t f -e py . "$sdk_dir" | while read -r py_file; do rg -n 'TypeAliasType\(' "$py_file" >/dev/null || continue echo "=== $py_file ===" rg -n -C3 'TypeAliasType\(|if typing\.TYPE_CHECKING:|^\s+from \.+ import ' "$py_file" echo done doneAlso applies to: 897-908
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 118287bc-038a-41b7-bec7-3f75bba1b0fc
📒 Files selected for processing (2)
baml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- baml_language/languages/python/rust/codegen_python/src/lib.rs
18f118d to
18bae30
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
baml_language/languages/python/rust/codegen_python/src/lib.rs (1)
2389-2413: ⚡ Quick winAlso assert no root self-import in
__init__.pyi.This test currently verifies only
__init__.py. Adding the same guard for__init__.pyikeeps.py/.pyiinvariants locked together.Suggested test addition
let out = to_source_code(&pool, &[]); let py = &out[&PathBuf::from("__init__.py")]; assert!( !py.contains("from . import Foo") && !py.contains("from .. import Foo"), "root leaf should not import its own Foo:\n{py}" ); + let pyi = &out[&PathBuf::from("__init__.pyi")]; + assert!( + !pyi.contains("from . import Foo") && !pyi.contains("from .. import Foo"), + "root leaf stub should not import its own Foo:\n{pyi}" + );🤖 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/languages/python/rust/codegen_python/src/lib.rs` around lines 2389 - 2413, In the test root_leaf_does_not_self_import_root_types add the same negative import assertion for the generated stub file: after obtaining out[&PathBuf::from("__init__.py")] (variable py) also retrieve out[&PathBuf::from("__init__.pyi")] (e.g., pyi) and assert that neither "from . import Foo" nor "from .. import Foo" appear in pyi, mirroring the existing assert for py so the .py and .pyi outputs stay consistent.
🤖 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/languages/python/rust/codegen_python/src/lib.rs`:
- Around line 2389-2413: In the test root_leaf_does_not_self_import_root_types
add the same negative import assertion for the generated stub file: after
obtaining out[&PathBuf::from("__init__.py")] (variable py) also retrieve
out[&PathBuf::from("__init__.pyi")] (e.g., pyi) and assert that neither "from .
import Foo" nor "from .. import Foo" appear in pyi, mirroring the existing
assert for py so the .py and .pyi outputs stay consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 70c3f867-bfca-4ee2-9cf8-4c480caea380
📒 Files selected for processing (2)
baml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- baml_language/languages/python/rust/codegen_python/src/leaf.rs
New rig_tests crate that exercises every type variant and routing rule from bridge-python/18a-type-exhaustiveness.md. Generated baml_sdk/ is checked into VCS so reviewers can diff codegen output directly. Failures discovered while authoring the BAML source are recorded in 18b-type-exhaustiveness-failures.md (cross-namespace user-package refs, $rust_type gating, pure-expression functions not emitting Python, recursive-alias-before-class pydantic recursion, generic-class stream companion losing type params, and others).
…nguage/python codegen
…pre-commit exclude)
8798e4e to
c7ef019
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (2)
baml_language/rig_tests/crates/type_shapes/build.rs (2)
101-108:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd Windows symlink fallback to file copy.
symlink_filecommonly fails without elevated privileges/Developer Mode on Windows. Falling back tofs::copyavoids unnecessary build failures in CI/local environments.Proposed fix
#[cfg(windows)] -std::os::windows::fs::symlink_file(&src, &dst).unwrap_or_else(|_| { - panic!( - "Failed to symlink {} from {}", - file_name.to_string_lossy(), - src.display() - ) -}); +if let Err(err) = std::os::windows::fs::symlink_file(&src, &dst) { + fs::copy(&src, &dst).unwrap_or_else(|copy_err| { + panic!( + "Failed to materialize {} from {} to {}: symlink failed with {err}; copy failed with {copy_err}", + file_name.to_string_lossy(), + src.display(), + dst.display() + ) + }); +}🤖 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/rig_tests/crates/type_shapes/build.rs` around lines 101 - 108, symlink_file on Windows (used in build.rs around std::os::windows::fs::symlink_file(&src, &dst)) can fail without admin/DevMode; update the unwrap_or_else panic fallback to attempt a plain fs::copy(&src, &dst) when symlink creation fails (using src, dst and file_name to log any error) and only panic if both symlink and copy fail, ensuring the error messages include the underlying IO error for easier debugging.
215-226:⚠️ Potential issue | 🟠 Major | ⚡ Quick winWatch source directories themselves in addition to files.
Right now only current files are registered. Registering the directory paths too makes rebuild triggering more reliable when new files are added.
#!/bin/bash # Verify current build.rs only emits rerun-if-changed for files from walk_dir, # and does not emit directory paths for baml_src/customizable. rg -n 'cargo:rerun-if-changed|watch_dir\(' baml_language/rig_tests/crates/type_shapes/build.rsProposed fix
println!("cargo:rerun-if-changed=build.rs"); +println!("cargo:rerun-if-changed={}", baml_src.display()); watch_dir(&baml_src); if customizable_dir.exists() { + println!("cargo:rerun-if-changed={}", customizable_dir.display()); watch_dir(&customizable_dir); }🤖 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/rig_tests/crates/type_shapes/build.rs` around lines 215 - 226, The build script currently only emits "cargo:rerun-if-changed" for individual files from walk_files but not for the watched directories themselves; update the logic so the directory paths are also emitted (e.g., before iterating files) so new files trigger rebuilds—modify the call sites (watch_dir(&baml_src) and the conditional watch_dir(&customizable_dir)) or the watch_dir function itself to print a cargo:rerun-if-changed line for the directory (using the same println pattern as println!("cargo:rerun-if-changed={}", path.display())) in addition to emitting for each file returned by walk_files.
🧹 Nitpick comments (1)
baml_language/rig_tests/crates/type_shapes/customizable/test_main.py (1)
21-26: ⚡ Quick winAssert the intentionally absent
voidnamespace explicitly.Since the comments document
voidas intentionally absent, add a negative assertion to lock that behavior (assert not hasattr(baml_sdk, "void")) and catch accidental generator regressions early.🤖 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/rig_tests/crates/type_shapes/customizable/test_main.py` around lines 21 - 26, Add an explicit negative assertion for the intentionally absent `void` namespace to detect regressions: in test_main.py near the comment about `void` being intentionally absent, insert an assertion such as asserting not hasattr(baml_sdk, "void") (or equivalent) before or within the loop over namespaces so the test will fail if `baml_sdk.void` is ever generated; reference the `baml_sdk` symbol and the explanatory comment as the insertion point.
🤖 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.
Duplicate comments:
In `@baml_language/rig_tests/crates/type_shapes/build.rs`:
- Around line 101-108: symlink_file on Windows (used in build.rs around
std::os::windows::fs::symlink_file(&src, &dst)) can fail without admin/DevMode;
update the unwrap_or_else panic fallback to attempt a plain fs::copy(&src, &dst)
when symlink creation fails (using src, dst and file_name to log any error) and
only panic if both symlink and copy fail, ensuring the error messages include
the underlying IO error for easier debugging.
- Around line 215-226: The build script currently only emits
"cargo:rerun-if-changed" for individual files from walk_files but not for the
watched directories themselves; update the logic so the directory paths are also
emitted (e.g., before iterating files) so new files trigger rebuilds—modify the
call sites (watch_dir(&baml_src) and the conditional
watch_dir(&customizable_dir)) or the watch_dir function itself to print a
cargo:rerun-if-changed line for the directory (using the same println pattern as
println!("cargo:rerun-if-changed={}", path.display())) in addition to emitting
for each file returned by walk_files.
---
Nitpick comments:
In `@baml_language/rig_tests/crates/type_shapes/customizable/test_main.py`:
- Around line 21-26: Add an explicit negative assertion for the intentionally
absent `void` namespace to detect regressions: in test_main.py near the comment
about `void` being intentionally absent, insert an assertion such as asserting
not hasattr(baml_sdk, "void") (or equivalent) before or within the loop over
namespaces so the test will fail if `baml_sdk.void` is ever generated; reference
the `baml_sdk` symbol and the explanatory comment as the insertion point.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 035d7180-a35c-40a7-ad20-24162cf92cde
⛔ Files ignored due to path filters (1)
baml_language/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (33)
baml_language/languages/python/rust/codegen_python/src/emit/type_alias.rsbaml_language/languages/python/rust/codegen_python/src/leaf.rsbaml_language/languages/python/rust/codegen_python/src/lib.rsbaml_language/languages/python/rust/codegen_python/src/translate_ty.rsbaml_language/rig_tests/crates/.gitignorebaml_language/rig_tests/crates/type_shapes/Cargo.tomlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_a/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.bamlbaml_language/rig_tests/crates/type_shapes/baml_src/root.bamlbaml_language/rig_tests/crates/type_shapes/build.rsbaml_language/rig_tests/crates/type_shapes/customizable/test_main.pybaml_language/rig_tests/crates/type_shapes/src/lib.rs
✅ Files skipped from review due to trivial changes (18)
- baml_language/rig_tests/crates/.gitignore
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_void/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/cross_uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/root.baml
- baml_language/rig_tests/crates/type_shapes/Cargo.toml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_class_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_enums/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lists/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_literals/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_optional/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_unions/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_maps/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_primitives/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_generics/types.baml
🚧 Files skipped from review as they are similar to previous changes (11)
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/ns_b/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_ipsum/uses.baml
- baml_language/rig_tests/crates/type_shapes/src/lib.rs
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_a/uses.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_aliases_consumer/uses.baml
- baml_language/languages/python/rust/codegen_python/src/lib.rs
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_media/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_forward_refs/types.baml
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_recursion/types.baml
- baml_language/languages/python/rust/codegen_python/src/leaf.rs
- baml_language/rig_tests/crates/type_shapes/baml_src/ns_lorem/streams.baml
Also add a new rig_tests crate that exercises every type variant and routing rule from bridge-python/18a-type-exhaustiveness.md. Generated baml_sdk/ is checked into VCS so reviewers can diff codegen output directly.
Failures discovered while authoring the BAML source are recorded in 18b-type-exhaustiveness-failures.md (cross-namespace user-package refs, $rust_type gating, pure-expression functions not emitting Python, recursive-alias-before-class pydantic recursion, generic-class stream companion losing type params, and others).
Summary by CodeRabbit
Bug Fixes
New Features
Tests
New Fixtures
Documentation