feat(compose-witness): Wasm-component PoC for REQ-086 witness MC/DC#315
Merged
Conversation
First increment of REQ-086 (MC/DC coverage of the REQ-083 composition core via the pulseengine `witness` tool). The cargo-component side is fully working; the canonical Bazel pipeline via rules_wasm_component is sketched in BUILD.bazel and pending live build verification. New sibling cargo project `compose-witness/` (NOT a workspace member, to keep `cargo test --all` clean of wasm-only crate-types). It builds to a Wasm component (`cargo component build --manifest-path compose-witness/Cargo.toml`) at `compose-witness/target/wasm32-wasip1/debug/compose_witness.wasm`, validates clean, and exports exactly the WIT interface declared: `pulseengine:compose-witness/compose@0.1.0` with a single `prefix-features(model-yaml, prefix) -> result<string, string>` export. The pure prefixing functions (`prefix_model_yaml`, `prefix_constraint`, `flush_constraint_token`) are inlined from rivet-core/src/feature_model.rs — rivet-core itself uses std::fs/salsa/rowan and would not compile to wasm32 as-is. A v2 increment extracts the pure module into a shared crate both depend on; v1 deliberately duplicates so the wasm surface witness needs to measure is the absolute minimum. Bazel side: adds `bazel_dep(name = "rules_wasm_component", version = "1.0.0")` to MODULE.bazel and sketches `compose-witness/BUILD.bazel` with `wit_library` + `rust_wasm_component_bindgen` + the `wasm_module_coverage` (witness) target. The Bazel build is pending live verification — that's the next increment. Implements: REQ-086
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: ac3ab17 | Previous: f88b23a | Ratio |
|---|---|---|---|
store_insert/10000 |
19957681 ns/iter (± 2082003) |
14832494 ns/iter (± 1393194) |
1.35 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First increment of REQ-086 (MC/DC coverage of the REQ-083 composition core via the pulseengine witness tool). The cargo-component side is fully working; the canonical Bazel pipeline via rules_wasm_component is sketched and pending live build verification.
What works
New sibling cargo project
compose-witness/(deliberately NOT a workspace member — keepscargo test --allclean of wasm-only crate-types). Building it:…produces a valid Wasm component at
compose-witness/target/wasm32-wasip1/debug/compose_witness.wasm.wasm-tools validateis clean;wasm-tools component witconfirms it exports exactly the WIT interface declared:The pure prefixing functions (
prefix_model_yaml,prefix_constraint,flush_constraint_token— the constraint-tokenization gap llvm-cov surfaced under REQ-083) are inlined fromrivet-core/src/feature_model.rs. rivet-core itself usesstd::fs/ salsa / rowan and would not compile to wasm32 as-is; v1 inlines, v2 extracts the pure module into a shared crate both depend on.What's sketched (Bazel + witness)
bazel_dep(name = "rules_wasm_component", version = "1.0.0")added toMODULE.bazel.compose-witness/BUILD.bazelwireswit_library+rust_wasm_component_bindgen+ thewasm_module_coverage(witness) target, following theexamples/witness_examplepattern from rules_wasm_component (witness operates on core modules; single-component subjects go straight to coverage).Bazel side is pending live build verification — that's the next increment (and the right place to iterate, since Bazel + rules_wasm_component + the witness toolchain is fastest to debug in-tree).
Why exclude from the cargo workspace?
The crate-type is
cdylibtargetingwasm32-wasip1. Including it as a workspace member would breakcargo test --allandcargo clippy --workspaceon the host (wit-bindgen-rt'sexport!macro generates wasm-specific bindings). Excluding it keeps the host workspace clean while still lettingcargo component build --manifest-pathwork locally; Bazel doesn't care about cargo workspaces.Test plan
cargo component buildproduces a valid component (verified locally — 8.0M debug Wasm,wasm-tools validateclean).cargo check -p rivet-corefrom the workspace root does not pull in compose-witness (exclude works).bazel build //compose-witness:compose_witness_coverage(deferred to next increment).🤖 Generated with Claude Code