docs(wit): document capability and component contracts

This commit is contained in:
Maofeng
2026-07-30 08:13:24 +08:00
parent a1b808013a
commit 73d7c76446
28 changed files with 194 additions and 11 deletions
+8
View File
@@ -1,4 +1,10 @@
//! Deliberately trapping Component used to verify Actor fault isolation.
//!
//! Sending the exact bytes `fault` triggers a panic. This crate is a test
//! fixture and must not be deployed as an application service.
mod bindings {
// Compile the versioned WIT world into canonical ABI Rust bindings.
wit_bindgen::generate!({
path: "wit",
world: "fault-component",
@@ -13,6 +19,8 @@ impl bindings::Guest for Fault {
}
fn invoke(input: Vec<u8>) -> Result<Vec<u8>, bindings::ServiceError> {
// A panic becomes a Wasm trap so Runtime tests can assert that one
// faulted Actor does not corrupt other service instances.
assert_ne!(input, b"fault", "intentional test fault");
Ok(input)
}
+1 -1
View File
@@ -4,5 +4,5 @@ schema_version = 1
name = "wasmeld:service"
version = "0.1.0"
source = "path+../../wit/service"
sha256 = "d5497307bbcd1e159f7707f385b488a6f2e26362d5256d5bc1080ac603a51305"
sha256 = "1b2069606ccbf5202789667570bc824f702f34b147aa38e81c2ab677444ffa0e"
replaced = true
+1
View File
@@ -1,5 +1,6 @@
package component:fault@0.1.0;
/// Fault fixture exports only the base service lifecycle.
world fault-component {
include wasmeld:service/service-component@0.1.0;
}