-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem Summary
Downstream repositories using rules_wasm_component (like bazel-file-ops-component) are failing with C++ toolchain resolution errors, while rules_wasm_component's own CI passes. This reveals a critical CI coverage gap.
Root Cause Analysis
1. The Dependency Chain
rules_wasm_componentregistersfile_ops_toolchain_localinMODULE.bazel:190- This toolchain depends on
//tools/file_operations_component:file_operations_component(Rust binary) - The Rust binary requires C++ toolchain for linking
- Commit 247fe4c broke C++ toolchain resolution with major dependency updates
2. Why rules_wasm_component CI doesn't catch this
rules_wasm_component CI builds these targets:
//examples/go_component/...
//examples/basic/...
//examples/simple_module/...
//examples/cpp_component/...
//rust/...
//go/...❌ MISSING: //tools/file_operations_component/...
The CI doesn't explicitly build the file_operations_component target that's causing the issue, so the C++ toolchain resolution failure goes undetected.
3. Impact on downstream consumers
When downstream repositories like bazel-file-ops-component try to build any target, Bazel resolves ALL registered toolchains, including file_ops_toolchain_local, which triggers building file_operations_component and hits the C++ toolchain error:
ERROR: /home/runner/.bazel/external/rules_wasm_component+/tools/file_operations_component/BUILD.bazel:13:12:
While resolving toolchains for target @@rules_wasm_component+//tools/file_operations_component:file_operations_component:
No matching toolchains found for types: @@bazel_tools//tools/cpp:toolchain_type
Evidence
rules_wasm_component CI Results (commit 247fe4c):
- ✅ Build succeeded for 274/276 targets (macOS)
- ✅ Build succeeded for 277/279 targets (Ubuntu)
- ❌ Only failed on test binding targets (unrelated issue)
bazel-file-ops-component CI Results:
- ❌ Immediate failure on C++ toolchain resolution for
file_operations_component
Reproduction Steps
- Create downstream repository depending on rules_wasm_component@247fe4c
- Try to build any target that triggers toolchain resolution
- Observe C++ toolchain failure for
file_operations_component
Proposed Solutions
1. Fix CI Coverage Gap (Recommended)
Add explicit testing of toolchain targets to CI:
bazel build //tools/file_operations_component/...
bazel build //toolchains:file_ops_toolchain_local2. Fix C++ Toolchain Resolution
Investigate and fix the C++ toolchain issues introduced in commit 247fe4c
3. Conditional Toolchain Registration
Make toolchain registration conditional to avoid breaking downstream consumers
Impact Assessment
- Severity: High - breaks all downstream consumers
- Scope: All repositories depending on rules_wasm_component
- CI Gap: Systematic issue where toolchain dependencies aren't tested
Files Involved
MODULE.bazel:190- toolchain registrationtoolchains/BUILD.bazel:199-210- toolchain definitiontools/file_operations_component/BUILD.bazel:13- failing Rust binary.github/workflows/ci.yml- missing test coverage
This issue demonstrates the importance of testing not just direct targets, but also toolchain dependencies that downstream consumers rely on.