Repository navigation
Description
Context
First dependency-ordered foundation for #13 and #14. Establish the smallest real threaded Rust Wasm sketch host that can build, validate, instantiate, run, and deterministically tear down one module. It deliberately exposes no product capability beyond a test-only proof entrypoint.
Proposal
Add a private, feature-gated sketch-host substrate that:
- Builds a checked-in Rust 1.95.0 sketch through Soldr for the selected threaded target.
- Validates the final module before instantiation.
- Compiles/prelinks once, then creates guest Stores/Instances.
- Supports kernel-owned guest-thread bootstrap: each guest thread has private Store, Instance, stack, TLS, and execution state while the logical sketch shares linear memory/heap, capability set, resource registry, compiled code, and one facade-owned kernel runtime.
- Enforces configured guest-thread and shared-memory maxima.
- Contains normal completion, trap, cancellation, timeout, and shutdown. Until atomic waits are reliably interrupted in-process, untrusted threaded sketches use a killable worker-process boundary.
- Records evidence distinguishing shared state from per-thread state.
This depends on #13 selecting exactly one private binding/runtime implementation. Do not introduce a temporary second ABI, engine fallback, public trait layer, or competing guest runtime.
Import policy
Final-module validation must accept only the versioned private kernel ABI and explicitly enumerated owned restricted-stdlib/thread imports. It must reject ambient WASI filesystem, environment, network, clock, randomness, process, and stdio authority, plus arbitrary host/platform imports, before any effect.
wasm32-wasip1-threads is the initial target unless an owned target/sysroot is necessary. If it emits standard WASI imports, rewrite them to owned namespaces or provide an owned compatibility layer and validate that exact allowlist. Do not call ambient authority restricted merely because the module used a WASI target.
Invariants
default = []remains a useful async process/host HAL and does not resolve or compile the engine, generated binding support, parser, guest-build helper, or threaded host.- Engine, generated, Store, Instance, Memory, thread, and backend types remain private; facade-owned semantic configuration/errors are the only public surface.
- The host uses one
kernal_api::async_enginekernel runtime per logical sketch. Per-thread state may clone facade-owned references but never starts another Tokio/kernel runtime. - Do not publish a
kernal-api-wasmsupport crate solely for this proof; a private split needs measured Cargo/Soldr justification. - The threaded profile does not depend on a pooling allocator.
Non-goals
- Async kernel ABI/resources, streams, blobs, filesystem output, Tauri, and screenshots.
- Ambient WASI/POSIX virtualization.
- Moving zccache daemon, Tauri, process trees, or native infrastructure into the guest.
Acceptance criteria
- RED: checked-in evidence proves the current tree cannot build, validate, or execute a Rust threaded Wasm sketch.
- RED: fixtures prove ambient WASI and unapproved host imports are rejected pre-instantiation.
- GREEN: Soldr/Rust 1.95.0 builds one checked-in threaded sketch into one Wasm artifact for the selected target.
- GREEN: validation checks ABI version, entrypoint, imports, shared-memory configuration, and declared limits before instantiation.
- GREEN: only approved kernel/owned compatibility imports are accepted; all other imports fail deterministically with typed diagnostics.
- GREEN: the module is compiled/prelinked once; instrumentation proves compiled code is shared.
- GREEN: a Rust proof using
std::threadand shared synchronization performs verified concurrent work over shared Wasm memory. - GREEN: each guest thread has distinct Store/Instance/stack/TLS/execution state, while memory/resources/runtime are shared as specified.
- GREEN: guest-thread and shared-memory maxima are enforced by
kernal-apiwith typed deterministic failures. - GREEN: completion, trap, cancellation, timeout, and shutdown reclaim all guest and registered host state; worker-process containment covers blocked atomic waits until in-process interruption is proven.
- GREEN: instrumentation proves guest thread startup never creates another Tokio/kernel runtime.
- GREEN:
soldr cargo test --locked --no-default-featuresremains free of engine/binding/parser/guest-build dependency resolution.
Platform matrix and deliverables
Compile on Linux, macOS, and Windows x86-64/ARM64. Run focused execution tests on native supported hosts where available and record host/guest target, engine version, import list, limits, teardown result, and resource count. Cross-compilation alone is not runtime proof.
Deliver the feature-gated private host, minimal threaded fixture and Soldr entrypoint, import validator/regression fixtures, lifecycle instrumentation/tests, focused documentation, and a short decision record for runtime/binding/target/import strategy.
Decisions
- This is P1 foundation work because feat(wasm): drive a Tauri screenshot task through the async kernal API #14 cannot use a real Wasm sketch until it exists.
- Keep it capability-free to make failures in module policy and threaded lifecycle independently diagnosable.
- A worker-process boundary is required as the conservative current containment mechanism, not a second guest-visible runtime.
Related issues
- feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 owns the overall runtime, threads, import policy, and lifecycle contract.
- feat(wasm): drive a Tauri screenshot task through the async kernal API #14 consumes this substrate for its real Wasm/Tauri screenshot proof.
Activity
zackees commentedon Sep 16, 2026
Implemented; closing with the evidence, checked against the artifacts rather than the issue's own status.
kernal-api — the substrate is in place: a real sketch is built through Soldr for the threaded target, admitted, compiled/prelinked once, and instantiated. This issue's item 6 — that untrusted threaded sketches use a killable worker-process boundary until blocked atomic waits are interruptible in-process — is exactly what the containment suite proves, including
real_worker_forces_containment_for_atomic_wait.CI builds the artifact in
threaded-rust-artifactand the proofs run in the native proof lanes.These four are a dependency chain (#15 → #26 → #32, with #14 as the end-to-end proof), and the chain is present end to end, which is why they close together rather than one at a time.
🤖 Generated with Claude Code