Initial standard library cleanup - #4350
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
a0f7ba9 to
bd54c3c
Compare
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe change adds ChangesStandard-library consolidation
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
bd54c3c to
34bd786
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
baml_language/crates/sys_ops/src/lib.rs (1)
668-680: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse an integer constant for representable bigint literals.
Literal::Bigintcurrently emits"type": "integer"with"const": n.to_string(), so JSON Schema compares the instance to the string"n". Large integers that fit inBexExternalValue::Intshould emit a numericconst; values that do not fit should returnroot.errors.Unsupported. Add unit tests for both cases.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/sys_ops/src/lib.rs` around lines 668 - 680, Update the Literal::Bigint JSON Schema generation to parse representable values into the integer type used by BexExternalValue::Int and emit a numeric const instead of n.to_string(); return root.errors.Unsupported when conversion fails. Add unit tests covering both an in-range bigint and an out-of-range bigint.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml`:
- Around line 66-70: Update the documentation for step_by and chain to remove
the inaccurate “provided function” callback wording. For step_by, describe that
the source iterator is not advanced until next is called; for chain, state that
other.iter() is created when chain is called while iteration remains deferred.
- Around line 66-70: Define explicit handling for non-positive n in step_by:
reject n <= 0, or document that these values behave as a step of one and guard
any n - 1 calculation against int.min_value() overflow. Keep the existing lazy
iterator behavior and positive-step semantics unchanged.
In
`@baml_language/sdk_tests/crates/typescript/function_calls/customizable/stdlib_entrypoints.test.ts`:
- Line 6: Update the import declaration for argv and argv_async to use single
quotes instead of double quotes, preserving the imported symbols and module
path.
---
Outside diff comments:
In `@baml_language/crates/sys_ops/src/lib.rs`:
- Around line 668-680: Update the Literal::Bigint JSON Schema generation to
parse representable values into the integer type used by BexExternalValue::Int
and emit a numeric const instead of n.to_string(); return
root.errors.Unsupported when conversion fails. Add unit tests covering both an
in-range bigint and an out-of-range bigint.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f0c3aa1a-1a06-423c-ab02-05df9e7f1a08
⛔ Files ignored due to path filters (21)
baml_language/Cargo.lockis excluded by!**/*.lockbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_testing_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/bigints.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/cancel_cascade.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/csv.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/fs.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/glob.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/provider_stdlib.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/src/compiler2_tir/snapshots/baml_tests__compiler2_tir__phase5__snapshot_baml_package_items.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_textual.snapis excluded by!**/*.snap
📒 Files selected for processing (36)
baml_language/crates/baml_builtins2/baml_std/baml/bigint.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_http/http.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_json/json.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_ops/math.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_schema/schema.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_sys/sys.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/duration.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/instant.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_toml/toml.bamlbaml_language/crates/baml_builtins2/baml_std/testing/registry.bamlbaml_language/crates/baml_builtins2/src/lib.rsbaml_language/crates/baml_builtins2_codegen/src/codegen.rsbaml_language/crates/baml_builtins2_codegen/src/extract.rsbaml_language/crates/baml_builtins2_codegen/src/types.rsbaml_language/crates/baml_tests/baml_src/ns_bigints/bigints.bamlbaml_language/crates/baml_tests/baml_src/ns_cancel_cascade/cancel_cascade.bamlbaml_language/crates/baml_tests/baml_src/ns_csv/csv.bamlbaml_language/crates/baml_tests/baml_src/ns_fs/fs.bamlbaml_language/crates/baml_tests/baml_src/ns_glob/glob.bamlbaml_language/crates/baml_tests/baml_src/ns_provider_stdlib/provider_stdlib.bamlbaml_language/crates/bex_engine/tests/function_resolution.rsbaml_language/crates/bex_vm/Cargo.tomlbaml_language/crates/bex_vm/src/package_baml/bigint.rsbaml_language/crates/bex_vm/src/package_baml/sys.rsbaml_language/crates/bridge_wasm/src/wasm_time.rsbaml_language/crates/sys_ops/src/lib.rsbaml_language/sdk_tests/crates/cpp/function_calls/customizable/tests/test_stdlib_entrypoints.ccbaml_language/sdk_tests/crates/java/function_calls/customizable/TestStdlibEntrypoints.javabaml_language/sdk_tests/crates/parity_analysis.mdbaml_language/sdk_tests/crates/python_pydantic2/function_calls/customizable/test_stdlib_entrypoints.pybaml_language/sdk_tests/crates/rust/function_calls/customizable/test_stdlib_entrypoints.rsbaml_language/sdk_tests/crates/swift/function_calls/customizable/TestStdlibEntrypoints.swiftbaml_language/sdk_tests/crates/typescript/function_calls/customizable/stdlib_entrypoints.test.tstypescript2/app-website/lib/baml-docs/index.tstypescript2/app-website/lib/baml-docs/stdlib.json
💤 Files with no reviewable changes (5)
- baml_language/crates/baml_builtins2/baml_std/baml/ns_schema/schema.baml
- baml_language/crates/bex_vm/Cargo.toml
- baml_language/crates/baml_builtins2/baml_std/baml/ns_sys/sys.baml
- baml_language/crates/baml_builtins2/src/lib.rs
- baml_language/crates/bex_vm/src/package_baml/sys.rs
34bd786 to
a16d915
Compare
Binary size checks passed✅ 7 passed
Generated by |
It is redundant as we have `baml.time.Instant.now`. It also was a VM function instead of being a sysop despite interacting with the outside world. As part of this added `bigint.to_int`
a16d915 to
9b7e2c3
Compare
Canary's "Initial standard library cleanup" (#4350) moved `baml.schema.json_schema` to `baml.json.schema` and deleted the `baml.schema` namespace. Git reported only four conflicts, all in generated snapshots, but the real breakage was a semantic one it could not see: the ai and claude_code packages both call that function, so the merged tree compiled to 251 failures with `unresolved name: schema`. Both call sites (ai/ns_internal/helpers.baml, claude_code's ns_internal/cli.baml) now use `baml.json.schema` — same signature, same throws clause, so this is a pure rename — along with the seven _planv2 pages that document it. The snapshot conflicts are regenerated rather than hand-resolved, since they are generated files and the merged source is the only correct input. Their net symbol delta is exactly what it should be: `baml.json.schema` in; `baml.schema.json_schema` and the removed `baml.sys.now_ms` out; plus canary's new iter/ops interfaces. Verified: 3181/3184 pass (the 3 failures are a local gofmt shim with no go version set, green in CI), no unreferenced snapshots, clippy clean, and the _planv2 suite is 35/35 including the streaming and wrapper tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
baml.sys.now_mswhich was redundant and not sysop-swappablebaml.schema.schematobaml.json.schema, deleting thebaml.schemanamespace.Summary by CodeRabbit
New Features
bigintto 63-bit signedint, with clear errors for out-of-range values.Removed
Documentation
Tests