Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ members = [
"rivet-cli",
"etch",
]
# compose-witness is a sibling cargo project, NOT a workspace member: it
# builds to a Wasm component (cdylib + wit-bindgen-rt) targeting
# wasm32-wasip1, has its own lockfile, and is built by either
# `cargo component build --manifest-path compose-witness/Cargo.toml` or
# the Bazel `rules_wasm_component` pipeline (compose-witness/BUILD.bazel,
# REQ-086). Excluding it keeps host `cargo --workspace` / `cargo test
# --all` clean of wasm-only crate-types they cannot compile.
exclude = ["compose-witness"]

[workspace.package]
version = "0.12.0"
Expand Down
8 changes: 8 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ rocq.toolchain(
)
use_repo(rocq, "rocq_toolchains", "rocq_stdlib")
register_toolchains("@rocq_toolchains//:all")

# ── rules_wasm_component (REQ-086 Wasm component + witness MC/DC) ──────
#
# Org-standard Bazel rules for WebAssembly Component Model builds.
# Bundles the `witness` toolchain (toolchains/witness_toolchain.bzl) and
# the `wasm_module_coverage` rule, which is how we produce MC/DC coverage
# evidence on the feature-model composition core (REQ-086).
bazel_dep(name = "rules_wasm_component", version = "1.0.0")
7 changes: 7 additions & 0 deletions compose-witness/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/target/

# Generated by cargo-component / wit-bindgen on every build. Keeping it
# out of git avoids the "did you forget to regenerate after editing
# wit/world.wit?" desync risk; reviewers reproduce it locally with
# `cargo component build --manifest-path compose-witness/Cargo.toml`.
/src/bindings.rs
56 changes: 56 additions & 0 deletions compose-witness/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# REQ-086 — Wasm component exposing the REQ-083 composition core's pure
# constraint-prefixing path. The `witness` toolchain (bundled with
# rules_wasm_component) instruments the resulting module and emits MC/DC
# branch coverage; Rivet ingests the coverage envelope as REQ-083 /
# REQ-086 requirement-to-test evidence.
#
# Canonical Bazel pipeline:
# wit_library ──┐
# ├─► rust_wasm_component_bindgen ──► wasm_module_coverage
# src/lib.rs ──┘
#
# Cargo-component is supported in parallel (see compose-witness/Cargo.toml)
# for local dev iteration, but the org-standard build path is this one —
# it composes cleanly with the existing certification pipeline
# (meld_fuse / wasm_attest / wasm_verify_chain) when we expand beyond a
# single component.

load("@rules_wasm_component//rust:defs.bzl", "rust_wasm_component_bindgen")
load("@rules_wasm_component//wasm:defs.bzl", "wasm_module_coverage")
load("@rules_wasm_component//wit:defs.bzl", "wit_library")

package(default_visibility = ["//visibility:public"])

# 1. The WIT interface: a single `prefix-features` export.
wit_library(
name = "compose_witness_interfaces",
srcs = ["wit/world.wit"],
package_name = "pulseengine:compose-witness",
world = "compose-witness",
)

# 2. The Rust component itself — calls the inlined pure prefixing path.
rust_wasm_component_bindgen(
name = "compose_witness",
srcs = ["src/lib.rs"],
# debug profile keeps DWARF debug info so witness's LCOV report
# carries source-line records (otherwise it'd be structural only —
# see examples/witness_example/BUILD.bazel comment block).
profiles = ["debug"],
wit = ":compose_witness_interfaces",
)

# 3. The witness MC/DC pass. The harness drives the component's
# `prefix-features` export — every REQ-083 fixture scenario plus the
# per-condition flip pairs MC/DC requires — and witness emits the
# LCOV truth tables / signed coverage envelope.
#
# NOTE: `wasm_module_coverage` operates on core modules, not components,
# per examples/witness_example/BUILD.bazel. For a single-component
# subject this works directly; multi-component compositions go through
# `meld_fuse` first.
wasm_module_coverage(
name = "compose_witness_coverage",
module = ":compose_witness",
invoke = ["prefix-features"],
)
145 changes: 145 additions & 0 deletions compose-witness/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions compose-witness/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "compose-witness"
version = "0.1.0"
edition = "2024"
authors = ["PulseEngine <https://github.com/pulseengine>"]
license = "Apache-2.0"
publish = false
description = "Wasm-component PoC exposing the REQ-083 composition core's pure prefixing path so the pulseengine `witness` tool can measure MC/DC on it (REQ-086)."

[lib]
crate-type = ["cdylib"]

[dependencies]
wit-bindgen-rt = { version = "0.44.0", features = ["bitflags"] }
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"

[package.metadata.component]
package = "pulseengine:compose-witness"

[package.metadata.component.target]
path = "wit"
world = "compose-witness"

[package.metadata.component.dependencies]
Loading
Loading