pulseengine/rules_wasm_component

WIT-enabled Go components temporarily excluded from CI

Opened this issue ยท 2 comments

Issue Description

Currently, WIT-enabled Go components are failing CI builds due to upstream TinyGo limitations with WIT dependency resolution.

Affected Targets

The following targets have been temporarily excluded from CI builds:

  • //examples/go_component:calculator_component
  • //examples/go_component:calculator_simple
  • //examples/go_component:calculator_with_bindings
  • //examples/go_component:calculator_simple_binding

Root Cause

Upstream Issue: TinyGo Issue #80 - WIT dependency resolution not supported
Tracking PR: TinyGo PR #4934 - Adds WIT world dependency resolution support

Error Pattern

error: package 'wasi:io@0.2.0' not found. known packages:
    example:calculator@1.0.0

--> wit/calculator.wit:40:12
|
40 |     import wasi:io/streams@0.2.0;
|            ^------

Resolution Plan

  1. โœ… Immediate: Exclude WIT-enabled Go targets from CI to maintain clean builds
  2. โณ Monitor: Track progress on TinyGo PR #4934
  3. ๐Ÿ”„ Re-enable: Once upstream support lands, remove CI exclusions and test

Implementation

CI configuration updated in .github/workflows/ci.yml with clear comments indicating temporary exclusion status and tracking information.

Labels: upstream, tinygo, wit, ci

๐ŸŽ‰ Resolution Available - Custom WIT Worlds Already Supported!

Major Update (Oct 2025): The upstream blocker for this issue has been resolved - TinyGo already supports custom WIT worlds!

Root Cause Resolution

TinyGo PR #4934 (mentioned in original issue) was closed Oct 6, 2025 because the functionality already exists. The -wit-world flag overrides the default wasi:cli/command.

Next Steps to Re-enable CI

  1. Update go_wasm_component rule to properly pass -wit-world parameter to TinyGo
  2. Test affected targets:
    • //examples/go_component:calculator_component
    • //examples/go_component:calculator_simple
    • //examples/go_component:calculator_with_bindings
    • //examples/go_component:calculator_simple_binding
  3. Validate component exports with wasm-tools component wit
  4. Re-enable in CI once validation passes

Implementation Pattern

tinygo build -target=wasip2 \
  -wit-package=wit/calculator.wit \
  -wit-world=calculator-world \
  -o component.wasm main.go

References

The WIT dependency resolution issue mentioned in the original error may still need investigation, but the core "hardcoded world" limitation is not a real blocker.

โœ… READY TO RE-ENABLE IN CI

Status: Code fixes complete, architecture clarified. Can re-enable after WIT dependency setup.

Fixes Applied

All fixes from issue #80 apply here:

  1. โœ… TinyGo flag format corrected (-wit-package, -wit-world)
  2. โœ… WIT directory path handling fixed
  3. โœ… Absolute path resolution in wrapper script

Re-enabling CI Builds

Step 1: Update WIT files with minimal WASI imports

world calculator-world {
    // TinyGo runtime requirement (even for reactor)
    import wasi:io/streams@0.2.0;

    export calculator;
}

Step 2: Update wit_library with deps

wit_library(
    name = "calculator_wit",
    srcs = ["wit/calculator.wit"],
    world = "calculator-world",
    deps = [
        "@wasi_io_v020//:streams",
    ],
)

Step 3: Test targets individually

bazel build //examples/go_component:calculator_simple

Step 4: Re-enable in .github/workflows/ci.yml

Multi-Component Use Cases

For composition with Rust main + Go libraries, use WAC:

wac_compose_with_oci(
    name = "app",
    composition = """
        let rust = new main:component { ... };
        let go = new calculator:component { ... };
        connect rust.calculator -> go;
        export rust as main;
    """,
    local_components = {
        "main": "//rust:cli",
        "calculator": "//examples/go_component:calculator_reactor",
    },
)

See: examples/go_component/COMPOSITION_GUIDE.md for complete architecture guide.

Architecture Validation

TinyGo custom WIT worlds work correctly when:

  • Use single-dash flags (-wit-package, -wit-world)
  • Pass full WIT directory with deps
  • Include minimal WASI imports for Go runtime

The original error (package 'wasi:io@0.2.0' not found) was a WIT dependency setup issue, not a TinyGo limitation.