Skip to content

feat(compiler): execute calls into mounted packages (BEP-066 slice 6a, PR 4) - #4332

Merged
antoniosarosi merged 5 commits into
antonio/s6a-type-consumptionfrom
antonio/s6a-call-consumption
Aug 7, 2026
Merged

antoniosarosi merged 5 commits into
antonio/s6a-type-consumptionfrom
antonio/s6a-call-consumption

Conversation

@antoniosarosi

@antoniosarosi antoniosarosi commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

BEP-066 slice-6a stack, PR 4 of 5 — chained on #4329. Mounted-blob packages become callable: TIR's loc-free MemberResolution::External flows through MIR to B-693 unit symbols, and a two-DB compile-then-link harness proves it end to end at runtime.

What

  • Loc-free call resolution for mounted packages: free functions, methods on mounted classes, interface dispatch through blob impls (incl. out-of-body and blanket impl methods), UFCS. PR 3's reserved E0158 shrinks to the genuine builtin-only residue (enumerated + tested).
  • MIR lowers External callees to fq-name unit symbols; impl-method {iface}$for${target} symbols reconstructed structurally with source/blob agreement.
  • Callback-effect framing (synthetic effect params) verified against exported signatures.
  • $stream policy landed + tested.
  • The two-DB link harness — compile library → capture interface blob → fresh consumer DB mounting it → emit units from both → link → execute — is the working prototype of slice 6's dynamic linking. 16/16 execution tests: runtime call results asserted, mounted-class construction + field reads, blob-impl dispatch, generic bounds via blob impls, cross-package throws caught in user code.

Gates

Focused suite 16/16 · tir + project + bytecode_cache green · full baml_tests green · strict all-features clippy clean on every touched crate · fmt clean · zero snapshot churn. (--no-verify only for the known environmental mise/swift-protobuf hook failure; gates run directly.)

Implemented by a Codex (gpt-5.6-sol) worker under stack-manager review.

Summary by CodeRabbit

  • New Features

    • Added support for calling functions and methods from mounted, precompiled packages.
    • Enabled cross-package interfaces, generics, implementations, streaming types, callbacks, and error handling.
    • Added interface dispatch, class construction, UFCS calls, and higher-order calls across package boundaries.
    • Improved editor symbol classification and diagnostics for external package symbols.
  • Bug Fixes

    • Restored mounted implementations and recursive type aliases when rebuilding from a precompiled standard library.
    • Improved diagnostics for ambiguous interface field access.
  • Tests

    • Added comprehensive end-to-end coverage for mounted package compilation, linking, and runtime execution.

@antoniosarosi

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@vercel

vercel Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview Aug 7, 2026 5:38am
promptfiddle2 Ready Ready Preview Aug 7, 2026 5:38am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

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

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9aee477c-3749-4f16-882b-085ad23448ca

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
📝 Walkthrough

Walkthrough

Mounted packages now expose linkable external functions, methods, implementations, interfaces, generics, fields, and type metadata. TIR and MIR resolve and lower these targets. Tests cover compilation, linking, dispatch, runtime execution, stream companions, errors, and unsupported builtins.

Changes

Mounted Package Support

Layer / File(s) Summary
External callable and implementation metadata
baml_language/crates/baml_compiler2_emit/src/lib.rs, baml_language/crates/baml_compiler2_tir/src/{inference.rs,interfaces/impl_rules.rs,package_interface.rs,lower_type_expr.rs}
Mounted call targets, implementation methods, generic metadata, interface exports, and restored stdlib package data support source-less resolution.
Mounted TIR and interface resolution
baml_language/crates/baml_compiler2_tir/src/{builder.rs,builder/interface_resolution.rs,infer_context.rs}
TIR creates external resolutions for mounted functions, methods, UFCS calls, interface dispatch, and concrete implementations. Unsupported builtin calls retain the reserved diagnostic.
Mounted schema and call lowering
baml_language/crates/baml_compiler2_mir/src/lower.rs
MIR imports mounted schemas and lowers external references, bound methods, generic calls, interface calls, receivers, and virtual dispatch.
Consumer integration and runtime validation
baml_language/crates/{baml_lsp2_actions,baml_project,baml_tests}/...
Consumers handle source-less targets without local locations. Tests compile, link, and execute mounted functions, methods, interfaces, generics, companions, exceptions, and reserved builtins.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant TIR
  participant PackageInterface
  participant MIR
  participant LinkedBytecode

  Consumer->>TIR: Resolve mounted function or method
  TIR->>PackageInterface: Read exported callable and interface metadata
  PackageInterface-->>TIR: Return external target and generic metadata
  TIR->>MIR: Lower external or interface-dispatched call
  MIR->>LinkedBytecode: Emit linkable call reference
Loading

Possibly related PRs

Poem

A rabbit links functions across the moonlit pack,
Methods find their receivers and safely come back.
Interfaces hop through virtual lanes,
Generic bounds ride compiler trains.
Builtins without links still signal their call—
E0158 stands watch over all.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes enabling calls into mounted packages, which is the primary change in the pull request.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch antonio/s6a-call-consumption
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch antonio/s6a-call-consumption

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

❤️ Share

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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – beps August 6, 2026 04:52 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 6, 2026 04:59 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (6)
baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs (1)

3226-3249: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The provides_method fallback branch is unreachable.

get_method already resolves the implemented interface's own defaults, in both the Source and the Mounted arm, using the same name predicate as this fallback. It also returns None when self.data(db) is None, which the fallback treats as false. So the match after the early return can never add a true that get_method did not already produce.

Reduce the body to the get_method probe, or document a case the fallback is meant to catch.

♻️ Proposed simplification
     pub fn provides_method(&self, db: &'db dyn crate::Db, method: &Name) -> bool {
-        use baml_compiler2_ppir::item_data::{function_data, interface_data};
-        if self.get_method(db, method).is_some() {
-            return true;
-        }
-        let Some(data) = self.data(db) else {
-            return false;
-        };
-        // The implemented interface's own default — through whichever
-        // declaration surface exists (source loc or mounted row).
-        match &data.interface {
-            ImplInterfaceTarget::Source(iface_loc) => interface_data(db, *iface_loc)
-                .default_methods
-                .iter()
-                .any(|&fn_loc| function_data(db, fn_loc).name == *method),
-            ImplInterfaceTarget::Mounted(qtn) => matches!(
-                crate::package_interface::mounted_type_row(db, qtn),
-                Some(crate::package_interface::ExportedType::Interface {
-                    default_methods,
-                    ..
-                }) if default_methods.iter().any(|m| m.name == *method)
-            ),
-        }
+        self.get_method(db, method).is_some()
     }
🤖 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/baml_compiler2_tir/src/interfaces/impl_rules.rs` around
lines 3226 - 3249, Remove the unreachable fallback match from provides_method
and make the method return solely whether get_method(db, method) resolves a
result. Preserve the existing method-name lookup behavior without retaining
redundant Source or Mounted interface-default handling.
baml_language/crates/baml_tests/tests/mounted_package_calls.rs (2)

142-183: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Cache the compiled library artifacts across tests.

consumer_program calls compile_library on every invocation, and 13 tests reach it. Each call builds a fresh ProjectDatabase, loads every builtin stub, checks the library, derives the PackageInterface, and emits full bytecode. The library fixture is constant, so this repeats the most expensive step in the file 13 times.

Both artifacts are deterministic and cloneable. Compute them once with std::sync::LazyLock and clone per test.

♻️ Proposed caching
+static LIBRARY: std::sync::LazyLock<(Vec<u8>, Program)> =
+    std::sync::LazyLock::new(compile_library);
+
 /// Phase 2: a fresh consumer database — blob mounted as `app`, NO `app`
 /// source — checked clean, then spliced against the library image.
 fn consumer_program(user_src: &str) -> Program {
-    let (blob, lib_program) = compile_library();
+    let (blob, lib_program) = (LIBRARY.0.clone(), &LIBRARY.1);
     let mut db = ProjectDatabase::new();
     db.set_project_root(std::path::Path::new("/mounted-calls"));
     db.set_mounted_packages([("app".to_string(), blob)].into());
     db.add_file("main.baml", user_src);
     assert_no_diagnostic_errors(&db);
 
-    generate_project_bytecode_with_stdlib(&db, &compile_options(), OPT, &lib_program)
+    generate_project_bytecode_with_stdlib(&db, &compile_options(), OPT, lib_program)
         .expect("consumer compiles against the mounted blob")
 }

Program must be Send + Sync for LazyLock in a multi-threaded test runner. If it is not, use a thread_local! OnceCell instead.

🤖 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/baml_tests/tests/mounted_package_calls.rs` around lines
142 - 183, Cache the deterministic results of compile_library in a
std::sync::LazyLock, ensuring Program and the serialized interface blob satisfy
Send + Sync; if Program does not, use a thread_local OnceCell instead. Update
consumer_program to initialize the cache once and clone both artifacts for each
test, while preserving the existing compilation and consumer behavior.

1-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider moving the check-only tests into the library crate.

mounted_stream_companion_supports_consumer_llm_expansion (line 407) and mounted_builtin_call_stays_reserved (line 505) assert only on diagnostics. They do not run the engine. The sibling module baml_tests/src/compiler2_tir/package_interface.rs already holds equivalent check-level coverage as unit tests. Keep the engine-executing tests here and move the two check-only tests into the library crate.

Based on 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/crates/baml_tests/tests/mounted_package_calls.rs` around lines
1 - 38, Move mounted_stream_companion_supports_consumer_llm_expansion and
mounted_builtin_call_stays_reserved from this integration test module into the
library crate’s compiler2_tir/package_interface.rs unit-test module, preserving
their diagnostic assertions and coverage. Keep only tests that execute the
engine, such as the run_compiled-based cases, in this file.

Source: Coding guidelines

baml_language/crates/baml_compiler2_mir/src/lower.rs (1)

10494-10498: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the emptiness check before the argument lowering.

lower_call_arg_operands emits statements for every provided argument. If arg_ops is empty, this function returns false after those statements were already emitted, and the caller then re-lowers the same arguments through the ordinary call path. Side-effecting arguments would evaluate twice.

The current caller guards on args.first(), so the branch is not reachable today. The rest of this file keeps every fallible step before any operand is lowered (see virtual_field_assign_target). Keep that invariant here.

♻️ Proposed reordering
         let Some((iface_tn, iface_type_args, iface_assoc)) = dispatch_target else {
             return false;
         };
-        let mut arg_ops = self.lower_call_arg_operands(expr_id, args);
-        if arg_ops.is_empty() {
+        if args.is_empty() {
             return false;
         }
+        let mut arg_ops = self.lower_call_arg_operands(expr_id, args);
+        if arg_ops.is_empty() {
+            return false;
+        }
         let receiver_op = arg_ops.remove(0);
🤖 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/baml_compiler2_mir/src/lower.rs` around lines 10494 -
10498, Update the call-lowering logic around lower_call_arg_operands to check
whether args is empty before invoking it, returning false immediately when no
arguments exist. Only call lower_call_arg_operands for non-empty args,
preserving the invariant that fallible checks occur before lowering operands and
preventing side-effecting arguments from being emitted before fallback
re-lowering.
baml_language/crates/baml_compiler2_tir/src/inference.rs (1)

839-864: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Verify user_generic_params() zip invariant is always maintained.

The receiver-owner's generic params when they are supplied at the CALL site (the static/UFCS form on a generic mounted class); empty for bound-receiver accesses (the receiver's own class args seed the frame), free functions, and interface targets. user_generic_params() zips generic_params with generic_param_bounds and silently truncates to the shorter vector if the two ever diverge in length. The struct doc states they are always parallel, so this is a defensive-coding note rather than a live bug: if a future producer of ExternalCallable (e.g. a new export kind) ever populates one vector without the other, the mismatch would silently drop bound checks instead of panicking or erroring.

Consider a debug assertion (debug_assert_eq!(self.generic_params.len(), self.generic_param_bounds.len())) in the constructor sites, or in user_generic_params() itself, so a future violation surfaces immediately instead of silently under-enforcing generic bounds.

🤖 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/baml_compiler2_tir/src/inference.rs` around lines 839 -
864, Add a debug assertion enforcing equal lengths for
ExternalCallable::generic_params and generic_param_bounds, preferably in
user_generic_params() or every ExternalCallable constructor, before the zip
operation. Preserve the existing filtering behavior while ensuring any future
producer that violates the documented parallel-vector invariant fails
immediately in debug builds.
baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs (1)

804-829: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider cloning only the needed fields instead of the whole exported row.

ExportedType::Interface carries every required and default method with full parameter types. This path clones the whole row for each external member access, then keeps only qtn, self_param, generic_params, and one method. Extracting those four values inside a scoped borrow and cloning them avoids the per-access cost on large interfaces.

This is a performance note only; behavior is correct as written.

🤖 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/baml_compiler2_tir/src/builder/interface_resolution.rs`
around lines 804 - 829, Update the exported-type lookup in the interface
member-resolution flow to borrow the mounted or package interface row and clone
only qtn, self_param, generic_params, and the matching method, rather than
cloning the entire ExportedType row. Preserve the existing lookup precedence and
return behavior while avoiding retention or cloning of unrelated methods and
parameter types.
🤖 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_compiler2_mir/src/lower.rs`:
- Around line 10920-10938: Update the mounted-interface fallback in
resolve_interface_method_spec to return only user-declared generic parameters,
excluding synthetic __effect_param_N entries from each matched
required_methods/default_methods signature. Reuse or introduce the existing
user-generic-count helper comparable to ExternalCallable::user_generic_params so
interface_method_generic_count matches the generics stored by
resolve_interface_method_spec.

In `@baml_language/crates/baml_compiler2_tir/src/builder.rs`:
- Around line 10666-10691: Update the bare callable-reference lowering around
the mounted-function handling shown here to detect builtin-kind mounted free
functions and methods before fallback resolution. Record the reference
expression as a reserved foreign callable and emit MountedPackageCallUnsupported
at that expression, ensuring package-qualified and local fallback paths do not
produce Null or unresolved-local errors; preserve normal MemberResolution for
non-builtin callables.

In `@baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs`:
- Around line 432-455: Update the inlined ambiguity handling around the
SelfReceiver match to inspect the mounted Source declarers and preserve
field-vs-method classification, reporting AmbiguousInterfaceField when the
declarers define a field and AmbiguousInterfaceMethod otherwise. Keep the
existing receiver, sources, and unknown-type behavior unchanged.

In `@baml_language/crates/baml_compiler2_tir/src/package_interface.rs`:
- Around line 295-349: Update def_to_item_ref so the owner == raw_owner
equivalence check is enforced in release builds instead of using
debug_assert_eq!. Preserve the existing raw_owner fallback and make mismatches
fail through an active assertion or equivalent non-debug failure path,
maintaining impl_method_symbol_owner as the B-693 symbol contract.

---

Nitpick comments:
In `@baml_language/crates/baml_compiler2_mir/src/lower.rs`:
- Around line 10494-10498: Update the call-lowering logic around
lower_call_arg_operands to check whether args is empty before invoking it,
returning false immediately when no arguments exist. Only call
lower_call_arg_operands for non-empty args, preserving the invariant that
fallible checks occur before lowering operands and preventing side-effecting
arguments from being emitted before fallback re-lowering.

In `@baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs`:
- Around line 804-829: Update the exported-type lookup in the interface
member-resolution flow to borrow the mounted or package interface row and clone
only qtn, self_param, generic_params, and the matching method, rather than
cloning the entire ExportedType row. Preserve the existing lookup precedence and
return behavior while avoiding retention or cloning of unrelated methods and
parameter types.

In `@baml_language/crates/baml_compiler2_tir/src/inference.rs`:
- Around line 839-864: Add a debug assertion enforcing equal lengths for
ExternalCallable::generic_params and generic_param_bounds, preferably in
user_generic_params() or every ExternalCallable constructor, before the zip
operation. Preserve the existing filtering behavior while ensuring any future
producer that violates the documented parallel-vector invariant fails
immediately in debug builds.

In `@baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs`:
- Around line 3226-3249: Remove the unreachable fallback match from
provides_method and make the method return solely whether get_method(db, method)
resolves a result. Preserve the existing method-name lookup behavior without
retaining redundant Source or Mounted interface-default handling.

In `@baml_language/crates/baml_tests/tests/mounted_package_calls.rs`:
- Around line 142-183: Cache the deterministic results of compile_library in a
std::sync::LazyLock, ensuring Program and the serialized interface blob satisfy
Send + Sync; if Program does not, use a thread_local OnceCell instead. Update
consumer_program to initialize the cache once and clone both artifacts for each
test, while preserving the existing compilation and consumer behavior.
- Around line 1-38: Move
mounted_stream_companion_supports_consumer_llm_expansion and
mounted_builtin_call_stays_reserved from this integration test module into the
library crate’s compiler2_tir/package_interface.rs unit-test module, preserving
their diagnostic assertions and coverage. Keep only tests that execute the
engine, such as the run_compiled-based cases, in this file.
🪄 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: 4a7c7170-b4d1-422d-8e88-49776fb326b3

📥 Commits

Reviewing files that changed from the base of the PR and between eb7d927 and c0d18e4.

📒 Files selected for processing (14)
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs
  • baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs
  • baml_language/crates/baml_compiler2_tir/src/package_interface.rs
  • baml_language/crates/baml_lsp2_actions/src/definition.rs
  • baml_language/crates/baml_lsp2_actions/src/tokens/classify.rs
  • baml_language/crates/baml_project/src/db.rs
  • baml_language/crates/baml_tests/src/compiler2_tir/package_interface.rs
  • baml_language/crates/baml_tests/tests/mounted_package_calls.rs

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 28.0 MB 11.9 MB file 27.4 MB +622.1 KB (+2.3%) OK
✅ packed-program Linux 🔒 18.2 MB 7.5 MB file 17.7 MB +494.6 KB (+2.8%) OK
✅ baml-cli macOS 🔒 21.8 MB 10.4 MB file 21.3 MB +478.5 KB (+2.2%) OK
✅ packed-program macOS 🔒 14.2 MB 6.6 MB file 13.8 MB +376.6 KB (+2.7%) OK
✅ baml-cli Windows 🔒 23.4 MB 10.6 MB file 23.0 MB +478.1 KB (+2.1%) OK
✅ packed-program Windows 🔒 15.2 MB 6.7 MB file 14.8 MB +394.7 KB (+2.7%) OK
✅ bridge_wasm WASM 17.3 MB 🔒 4.7 MB gzip 4.6 MB +104.8 KB (+2.3%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@antoniosarosi

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@vercel
vercel Bot temporarily deployed to Preview – beps August 6, 2026 07:08 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 6, 2026 07:15 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/crates/baml_tests/tests/interfaces.rs`:
- Around line 11922-11934: Update the assertion in
conjunction_ambiguous_source_fields_keep_field_diagnostic to require an
ambiguity-specific diagnostic, such as the expected E0131 code or “ambiguous”
wording, rather than only “field `value`”. Preserve the existing fixture and
ensure the test still validates the ambiguous source-field error.
🪄 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: 11549a6b-e78e-4206-ae01-7772f684bb41

📥 Commits

Reviewing files that changed from the base of the PR and between c0d18e4 and 0164934.

📒 Files selected for processing (5)
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_tests/tests/mounted_package_calls.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • baml_language/crates/baml_tests/tests/mounted_package_calls.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/interface_resolution.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs

…review)

Needles are verbatim substrings of the AmbiguousInterfaceField format
string the fixture already triggers; split into field-pin + wording-pin
so an unrelated value-mentioning diagnostic cannot satisfy the suite.
@antoniosarosi

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@vercel
vercel Bot temporarily deployed to Preview – beps August 6, 2026 07:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 6, 2026 07:30 Inactive
…R 5 — capstone) (#4333)

**BEP-066 slice-6a stack, PR 5 of 5 — the capstone.** Chained on #4332.
With this green, the slice-6a stack is complete: a package consumed as
an interface blob is provably indistinguishable from the same package
consumed as source.

## The parity oracle (`mounted_package_parity.rs`)
- Source-vs-blob **runtime parity** across the full surface: interfaces
+ requires + assoc defaults + default methods, attrs, generics/bounds,
enums, aliases, in-body/out-of-body/blanket impls, user impls of mounted
interfaces, caught-throw behavior.
- **Byte-identical diagnostic fingerprints**
(code/message/severity/phase/user range) for the misuse variants: wrong
arity, unsatisfied bound, non-exhaustive match, missing impl members.
- **Byte-identical artifacts**: dependency units, package metadata,
consumer import tables raw-identical; consumer units + whole programs
identical after normalizing database-local debug FileIds — the sole
legitimate difference (the known B-693 §9b wart), with
paths/ranges/symbols/executable bytes identical.

## What the oracle caught (fixed in the implementation, never weakened
in the oracle)
1. Source auxiliary packages didn't participate in user dependency
resolution the way mounted ones do.
2. Mounted interface defaults/assoc-defaults/fields/method tables seeded
emission differently from source interfaces.
3. Impl-method exports mishandled synthetic callback-effect parameters
vs enclosing impl generics.

## Also in this PR
- **Coherence-fails-open hole closed and proven**: user-vs-blob impl
overlap yields exactly one primary-only E0132 attributed at the user's
impl, dep side rendered structurally.
- **Public link seam**: the two-DB compile-and-link harness promoted
from test scaffolding to a documented API — slice 6's `Package.compile`
consumes this.
- **Residue ledger** documented adjacent to the public API (E0158
builtin residue, span-dependent LSP ops, re-aliasing/transitive
re-export, live `$stream` loading, artifact versioning, dispatcher
synthesis) — slice 6 starts from a ledger, not archaeology.

## Gates
Full baml_tests green · all-features mounted call/parity suites 26/26 ·
HIR/TIR/project · bytecode_cache 43/43 · fmt/clippy/rustdoc all-features
`-D warnings` · **zero snapshot churn**.

Implemented by a Codex (gpt-5.6-sol) worker under stack-manager review.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added support for compiling applications against mounted, source-less
packages, including their default methods, type defaults, and field
definitions.
- Added dependency linking for precompiled package artifacts before
consumer compilation.

- **Bug Fixes**
- Improved handling of generic callback-effect metadata in exported
functions and implementation methods.
- Improved package discovery and dependency resolution for auxiliary and
mounted source packages.

- **Tests**
- Added comprehensive parity coverage for source-based and serialized
mounted packages, including runtime behavior, diagnostics, imports, and
linking.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@vercel
vercel Bot temporarily deployed to Preview – beps August 7, 2026 05:29 Inactive
@antoniosarosi
antoniosarosi merged commit bfaf132 into antonio/s6a-type-consumption Aug 7, 2026
4 of 7 checks passed
@antoniosarosi
antoniosarosi deleted the antonio/s6a-call-consumption branch August 7, 2026 05:30
@vercel
vercel Bot temporarily deployed to Preview – beps August 7, 2026 05:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 7, 2026 05:38 Inactive

This branch was previously deployed

2 inactive deployments
Preview – promptfiddle2 — ab468e11 Deployed Aug 7, 2026 by vercel[bot]
Preview – beps — ab468e11 Deployed Aug 7, 2026 by vercel[bot]
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