Skip to content

CI Coverage Gap: file_operations_component toolchain causes C++ toolchain resolution failures for downstream consumers #75

@avrabe

Description

@avrabe

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_component registers file_ops_toolchain_local in MODULE.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

  1. Create downstream repository depending on rules_wasm_component@247fe4c
  2. Try to build any target that triggers toolchain resolution
  3. 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_local

2. 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 registration
  • toolchains/BUILD.bazel:199-210 - toolchain definition
  • tools/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions