Skip to content

bazel: use native rust test sharding#18082

Merged
bolinfest merged 1 commit intomainfrom
pr18082
Apr 17, 2026
Merged

bazel: use native rust test sharding#18082
bolinfest merged 1 commit intomainfrom
pr18082

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Apr 16, 2026

Why

The large Rust test suites are slow and include some of our flakiest tests, so we want to run them with Bazel native sharding while keeping shard membership stable between runs.

This is the simpler follow-up to the explicit-label experiment in #17998. Since #18397 upgraded Codex to rules_rs 0.0.58, which includes the stable test-name hashing support from hermeticbuild/rules_rust#14, this PR only needs to wire Codex's Bazel macros into that support.

Using native sharding preserves BuildBuddy's sharded-test UI and Bazel's per-shard test action caching. Using stable name hashing avoids reshuffling every test when one test is added or removed.

What Changed

codex_rust_crate now accepts test_shard_counts and applies the right Bazel/rules_rust attributes to generated unit and integration test rules. Matched tests are also marked flaky = True, giving them Bazel's default three attempts.

This PR shards these labels 8 ways:

//codex-rs/core:core-all-test
//codex-rs/core:core-unit-tests
//codex-rs/app-server:app-server-all-test
//codex-rs/app-server:app-server-unit-tests
//codex-rs/tui:tui-unit-tests

Verification

bazel query --output=build over the selected public labels and their inner unit-test binaries confirmed the expected shard_count = 8, flaky = True, and experimental_enable_sharding = True attributes.

Also verified that we see the shards as expected in BuildBuddy so they can be analyzed independently.

@bolinfest bolinfest force-pushed the pr18082 branch 3 times, most recently from 07c765c to 0607fe1 Compare April 16, 2026 19:07
Configure the large Rust test targets with Bazel's native shard_count while keeping rules_rust's stable test-name hash bucket assignment.

With rules_rs 0.0.58 available on main, this change only adds the Codex macro wiring and opts the selected large test targets into sharding.

Co-authored-by: Codex <noreply@openai.com>
@bolinfest bolinfest marked this pull request as ready for review April 17, 2026 23:01
@bolinfest bolinfest enabled auto-merge (squash) April 17, 2026 23:08
@bolinfest bolinfest merged commit 96d35dd into main Apr 17, 2026
39 of 50 checks passed
@bolinfest bolinfest deleted the pr18082 branch April 17, 2026 23:14
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants