Skip to content

baml-language: implement new PPIR#3264

Open
sxlijin wants to merge 1 commit intopaulo/rust-functions-2from
push-pqsmnrvrxlxy
Open

baml-language: implement new PPIR#3264
sxlijin wants to merge 1 commit intopaulo/rust-functions-2from
push-pqsmnrvrxlxy

Conversation

@sxlijin
Copy link
Contributor

@sxlijin sxlijin commented Mar 21, 2026

No description provided.

@vercel
Copy link

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Error Error Mar 21, 2026 0:41am
promptfiddle Ready Ready Preview, Comment Mar 21, 2026 0:41am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • canary

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 06063336-85e2-47e5-82ab-167db0a48ef7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch push-pqsmnrvrxlxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 21, 2026

Merging this PR will improve performance by ×13

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 13 improved benchmarks
✅ 2 untouched benchmarks
⏩ 91 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime bench_single_simple_file 1,067.3 µs 136.4 µs ×7.8
WallTime bench_incremental_add_string_char 1,123.5 µs 161.1 µs ×7
WallTime bench_incremental_no_change 139.1 µs 30.5 µs ×4.6
WallTime bench_incremental_add_user_field 1,423.8 µs 271.7 µs ×5.2
WallTime bench_scale_100_functions 2.1 ms 1.1 ms +90.09%
WallTime bench_incremental_add_field 264.5 µs 73 µs ×3.6
WallTime bench_incremental_modify_function 255.4 µs 84.3 µs ×3
WallTime bench_incremental_close_string 1,128 µs 162.3 µs ×7
WallTime bench_incremental_add_attribute 1,131 µs 167.5 µs ×6.8
WallTime bench_scale_deep_nesting 3,110.1 µs 610 µs ×5.1
WallTime bench_empty_project 916.7 µs 72.7 µs ×13
WallTime bench_incremental_rename_type 1,775.9 µs 352.4 µs ×5
WallTime bench_incremental_add_new_file 268.3 µs 83.9 µs ×3.2

Comparing push-pqsmnrvrxlxy (127240c) with canary (13112c3)2

Open in CodSpeed

Footnotes

  1. 91 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on paulo/rust-functions-2 (ead10a3) during the generation of this report, so canary (13112c3) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eed6a53ca5

ℹ️ 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".

Comment on lines +113 to +115
let pkg_info = baml_compiler2_hir::file_package::file_package(db, file);
let pkg_id = PackageId::new(db, pkg_info.package);
let package_items = baml_compiler2_hir::package::package_items(db, pkg_id);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Look up stream-expansion types outside the current package

ppir_expansion_items passes stream_expand a PackageItems built only for the source file's package. When a field uses an explicit cross-package type like other.User, classify_type cannot see that definition and falls into the None branch, so PPIR leaves the field as null | other.User instead of rewriting it to the streamed form (or preserving enum semantics). Any streamed schema that references types from another package will therefore get the wrong shape.

Useful? React with 👍 / 👎.

Comment on lines +247 to +251
Some(SymbolKind::TypeAlias) => {
// Merge @@stream.* block attrs, then resolve alias recursively
merge_block_attrs(path, block_attrs, &mut must_exist, &mut done);
// For aliases, we could resolve the underlying type, but that requires
// access to the AST. For now, treat like class (stream_Name).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve type aliases before choosing stream defaults

The TypeAlias branch in stream_expand always treats an alias like a class (stream_Name, pending null, in-progress allowed) instead of inspecting the aliased body. That changes semantics for aliases to lists/maps/enums/literals: for example, type Ids = int[] will stream as null | stream_Ids @sap.parse_without_null even though the underlying type already has an empty-array pending default, and type Status = MyEnum will miss @sap.in_progress_never. Because the alias body is already synthesized elsewhere, this leaves the field-level SAP metadata wrong even when the alias target is known.

Useful? React with 👍 / 👎.

Comment on lines +70 to +74
let mut full_path = pkg_info.namespace_path.clone();
full_path.push(name.clone());
result
.entry(full_path)
.or_insert_with(Vec::new)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope block-attribute merging by package

collect_block_attrs keys block attributes by namespace_path + type name only, and merge_block_attrs later does a plain lookup on that path. If two packages define the same qualified path inside their own roots (for example pkg_a.User and pkg_b.User), @@stream.done / @@stream.must_exist from one package are merged into the other package's PPIR expansion. That makes streaming behavior depend on unrelated files in another package.

Useful? React with 👍 / 👎.

@sxlijin sxlijin force-pushed the push-pqsmnrvrxlxy branch from eed6a53 to 127240c Compare March 21, 2026 00:18
@github-actions
Copy link

github-actions bot commented Mar 21, 2026

Binary size checks failed

7 violations

⚠️ Please fix the size gate issues or acknowledge them by updating baselines.

Artifact Platform Gzip Baseline Delta Status
bridge_cffi Linux 4.5 MB 4.0 MB +537.3 KB (+13.5%) FAIL
bridge_cffi-stripped Linux 3.0 MB 2.5 MB +466.6 KB (+18.4%) FAIL
bridge_cffi macOS 3.7 MB 3.2 MB +508.8 KB (+16.1%) FAIL
bridge_cffi-stripped macOS 2.4 MB 2.0 MB +435.0 KB (+22.2%) FAIL
bridge_cffi Windows 3.7 MB 3.3 MB +411.2 KB (+12.7%) FAIL
bridge_cffi-stripped Windows 2.5 MB 2.0 MB +455.4 KB (+22.5%) FAIL
bridge_wasm WASM 2.3 MB 2.0 MB +300.8 KB (+15.4%) FAIL
Details & how to fix

Violations:

  • bridge_cffi (Linux) gzip_bytes: 4.5 MB exceeds limit of 4.5 MB (exceeded by +22.2 KB, policy: max_gzip_bytes)
  • bridge_cffi (Linux) gzip_delta_pct: +13.5% exceeds limit of 10.0% (exceeded by +3.5pp, policy: max_delta_pct)
  • bridge_cffi-stripped (Linux) gzip_bytes: 3.0 MB exceeds limit of 2.6 MB (exceeded by +404.8 KB, policy: max_gzip_bytes)
  • bridge_cffi-stripped (Linux) gzip_delta_pct: +18.4% exceeds limit of 10.0% (exceeded by +8.4pp, policy: max_delta_pct)
  • bridge_cffi (macOS) gzip_delta_pct: +16.1% exceeds limit of 10.0% (exceeded by +6.1pp, policy: max_delta_pct)
  • bridge_cffi-stripped (macOS) gzip_delta_pct: +22.2% exceeds limit of 10.0% (exceeded by +12.2pp, policy: max_delta_pct)
  • bridge_cffi (Windows) gzip_delta_pct: +12.7% exceeds limit of 10.0% (exceeded by +2.7pp, policy: max_delta_pct)
  • bridge_cffi-stripped (Windows) gzip_delta_pct: +22.5% exceeds limit of 10.0% (exceeded by +12.5pp, policy: max_delta_pct)
  • bridge_wasm (WASM) gzip_bytes: 2.3 MB exceeds limit of 2.0 MB (exceeded by +257.4 KB, policy: max_gzip_bytes)
  • bridge_wasm (WASM) gzip_delta_pct: +15.4% exceeds limit of 10.0% (exceeded by +5.4pp, policy: max_delta_pct)

Add/update baselines:

.ci/size-gate/aarch64-apple-darwin.toml:

[artifacts.bridge_cffi]
file_bytes = 8685056
stripped_bytes = 8685096
gzip_bytes = 3668861
[artifacts.bridge_cffi-stripped]
file_bytes = 6156848
stripped_bytes = 6156888
gzip_bytes = 2394218

.ci/size-gate/wasm32-unknown-unknown.toml:

[artifacts.bridge_wasm]
file_bytes = 8565225
gzip_bytes = 2257363

.ci/size-gate/x86_64-pc-windows-msvc.toml:

[artifacts.bridge_cffi]
file_bytes = 8735744
stripped_bytes = 8735744
gzip_bytes = 3661821
[artifacts.bridge_cffi-stripped]
file_bytes = 6375936
stripped_bytes = 6375936
gzip_bytes = 2477843

.ci/size-gate/x86_64-unknown-linux-gnu.toml:

[artifacts.bridge_cffi]
file_bytes = 12408112
stripped_bytes = 12408104
gzip_bytes = 4522201
[artifacts.bridge_cffi-stripped]
file_bytes = 8495000
stripped_bytes = 8494992
gzip_bytes = 3004799

Generated by cargo size-gate · workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant