Skip to content

tests: machine-independent timing bounds and crate-standalone hermeticity - #4499

Merged
sxlijin merged 1 commit into
BoundaryML:canaryfrom
indexable-inc:up/test-timing
Aug 18, 2026
Merged

tests: machine-independent timing bounds and crate-standalone hermeticity#4499
sxlijin merged 1 commit into
BoundaryML:canaryfrom
indexable-inc:up/test-timing

Conversation

@harivansh-afk

@harivansh-afk harivansh-afk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Timing-sensitive tests currently encode idle-16-vCPU behavior as correctness: the cancellation suites assert sub-second wall-clock bounds, the prof soak bounds a whole run instead of a round, and the webview vitest config sizes its worker pool from availableParallelism(). On larger or busier machines these fail (or in vitest's case, fork-bomb) without any product regression. Found running this repo's CI on 64-vCPU self-hosted runners; every change is a no-op or strictly looser on your 16-vCPU runners, and none can mask a real regression.

  • sdk_tests cancellation (rust, typescript, java): keep the semantic property (cancellation interrupts the call) but bound it at 5s with the cancelled sleeps raised to 60s - a regression that ignores cancellation still cannot pass, while a busy machine no longer produces false reds. Only the three suites that actually flaked at high parallelism are touched; python/go/cpp never flaked and keep their bounds. Java also cancels the timed-out future instead of leaking it.
  • bex_events prof consumer soak: per-round wedge bound (30s) instead of a per-machine total, so a wedged consumer fails fast with the named panic inside the job timeout on any host.
  • webview vitest.config.ts: cap maxWorkers (overridable via VITEST_MAX_WORKERS), at or above what 16 vCPUs produce naturally - a no-op for your runners, a hard requirement on 64-core ones where availableParallelism()-1 workerd processes OOM the machine.
  • bridge_cffi header test + java sdk setup scripts: stop assuming the crate lives inside a full workspace checkout with a rustup-managed toolchain (BAML_BRIDGE_CFFI_DIR env seam; toolchain pinning delegated to the workspace rust-toolchain.toml). Behavior is byte-identical in the current layout; the java Windows script drops an explicit rustup toolchain dispatch for parity with the unix script.

Split out of #4483 so that PR stays new-files-only; merge order between the two does not matter (without this, the non-gating ix preview lanes just flake).

Summary by CodeRabbit

  • Bug Fixes

    • Improved cancellation test reliability by allowing long-running operations enough time to be cancelled and ensuring cleanup after timeouts.
    • Increased acknowledgment timeouts in soak tests to reduce failures in slower test environments.
  • Tests

    • Improved browser test setup and dependency pre-bundling.
    • Added support for configuring the bridge checkout location during test execution.
  • Chores

    • Updated Java SDK setup to use the workspace-selected Rust toolchain.

…city

Timing-sensitive tests currently encode idle-16-vCPU behavior as
correctness: cancellation suites assert sub-second wall-clock bounds,
the prof soak bounds a whole run instead of a round, and the webview
vitest config sizes its worker pool from availableParallelism(). On
larger or busier machines these fail (or in vitest's case, fork-bomb)
without any product regression.

- sdk_tests cancellation (rust, typescript, java): keep the semantic
  property (cancellation interrupts the call) but bound it at 5s with
  the cancelled sleeps raised to 60s, so a regression that ignores
  cancellation still cannot pass; java also cancels the timed-out
  future instead of leaking it.
- bex_events prof consumer soak: per-round wedge bound (30s) instead of
  a per-machine total, so a wedged consumer fails fast with the named
  panic inside the job timeout on any host.
- webview vitest.config.ts: cap maxWorkers (overridable via
  VITEST_MAX_WORKERS), at or above what 16 vCPUs produce naturally.
- bridge_cffi header_generation + java sdk setup scripts: stop assuming
  the crate lives inside a full workspace checkout with a
  rustup-managed toolchain; behavior is byte-identical in the current
  layout.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@harivansh-afk is attempting to deploy a commit to the Boundary Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d936d616-90cb-46e3-82e2-f721323aed7f

📥 Commits

Reviewing files that changed from the base of the PR and between 02ade14 and 2f62719.

📒 Files selected for processing (8)
  • baml_language/crates/bex_events/src/prof/consumer.rs
  • baml_language/crates/bridge_cffi/tests/header_generation.rs
  • baml_language/sdk_tests/crates/java/function_calls/customizable/TestCancellation.java
  • baml_language/sdk_tests/crates/java/setup.ps1
  • baml_language/sdk_tests/crates/java/setup.sh
  • baml_language/sdk_tests/crates/rust/function_calls/customizable/test_cancellation.rs
  • baml_language/sdk_tests/crates/typescript/function_calls/customizable/cancellation.test.ts
  • typescript2/app-vscode-webview/vitest.config.ts

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


📝 Walkthrough

Walkthrough

The changes adjust soak-test acknowledgment timing, support configurable CFFI crate paths, extend SDK cancellation test durations, use workspace toolchains for Java bridge builds, and pre-bundle dependencies for VSCode browser tests.

Changes

Orphan churn soak timing

Layer / File(s) Summary
Per-round acknowledgment timeout
baml_language/crates/bex_events/src/prof/consumer.rs
The soak test uses Miri-specific and native acknowledgment timeouts. The acknowledgment call confirms that the dead ring was pooled before the next acquisition.

CFFI bridge path resolution

Layer / File(s) Summary
Configurable bridge crate directory
baml_language/crates/bridge_cffi/tests/header_generation.rs
crate_dir() reads BAML_BRIDGE_CFFI_DIR and falls back to CARGO_MANIFEST_DIR.

SDK cancellation test timing

Layer / File(s) Summary
Long-running cancellation operations
baml_language/sdk_tests/crates/java/function_calls/customizable/TestCancellation.java, baml_language/sdk_tests/crates/rust/function_calls/customizable/test_cancellation.rs, baml_language/sdk_tests/crates/typescript/function_calls/customizable/cancellation.test.ts
Cancellation tests use 60-second operations and increased timing thresholds. The Java timeout test cancels the future in a finally block.

Java bridge setup

Layer / File(s) Summary
Workspace toolchain bridge builds
baml_language/sdk_tests/crates/java/setup.ps1, baml_language/sdk_tests/crates/java/setup.sh
The setup scripts invoke Cargo through the active workspace toolchain instead of rustup run 1.93.0.

VSCode browser test configuration

Layer / File(s) Summary
Browser dependency pre-bundling
typescript2/app-vscode-webview/vitest.config.ts
Vitest pre-bundles browser test entry files and testing-library dependencies. Existing aliases and test project settings remain unchanged.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: 🟡 Moderate · up to 2f627

This PR makes machine-sensitive tests and setup behavior more robust without identifying a product-path regression, but merge readiness is currently moderate because required Rust checks remain incomplete and a profiling test timed out; merge should wait for those checks to pass or for the timeout to be explicitly accepted.

Suggested reviewers: antoniosarosi, sxlijin

Poem

A rabbit checks the clocks with care,
Long sleeps now fill the test night air.
Crate paths hop through fields anew,
Cargo follows its workspace cue.
Browser bundles sparkle bright,
And pooled rings rest before flight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main test timing and standalone checkout changes.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sxlijin
sxlijin enabled auto-merge August 18, 2026 21:17
@sxlijin
sxlijin added this pull request to the merge queue Aug 18, 2026
Merged via the queue into BoundaryML:canary with commit 8b065fc Aug 18, 2026
74 of 76 checks passed
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.

2 participants