Skip to content

feat(wasm): add threaded Rust guest and owned thread bootstrap #26

Closed

Description

@zackees

Context

Implementation child of #15, following #25, and required by #13 and #14. Add a checked-in real Rust guest and owned thread bootstrap so ordinary threaded Rust runs as one shared-memory Wasm sketch rather than a native substitute.

Depends on

Proposal

Add a checked-in Rust 1.95.0 guest package compiled by Soldr to wasm32-wasip1-threads (or the owned target/sysroot selected by #15). Load exactly its produced module.

Implement owned thread-spawn compatibility or import rewriting so ordinary std::thread code works without ambient WASI authority. Compile/prelink once. Each guest thread gets private Store, Instance, stack, TLS, and execution state, while all threads in one logical sketch share linear memory/heap, allocator state, compiled code, capability set, resource registry, and one kernel runtime.

Invariants

  • Guest thread bootstrap is kernel-owned and validated by feat(wasm): add engine policy and strict module admission validation #25; it grants no filesystem/network/process/clock/random/environment authority.
  • Thread startup clones facade-owned references only and never creates another Tokio/kernel runtime.
  • Backend, generated, Store/Instance/Memory/thread types are private.
  • default = [] remains isolated from the guest target/build/engine dependency tree.

Non-goals

  • Async resource ABI, streams/blobs/output, quotas/fuel/epoch policy, worker-process containment, Tauri, or screenshots.
  • Requiring third-party sources to replace std::thread with a custom product API.

Acceptance criteria

  • RED: a checked-in guest using std::thread cannot currently compile/load/run under the owned policy.
  • RED: a guest with ambient thread or forbidden authority imports is rejected by the feat(wasm): add engine policy and strict module admission validation #25 validator.
  • GREEN: Soldr/Rust 1.95.0 compiles the checked-in guest to one validated threaded module and the host loads that exact artifact.
  • GREEN: guest std::thread startup routes through the owned bootstrap/import rewrite and creates no ambient authority.
  • GREEN: concurrent guest threads verify shared-memory visibility using Arc/atomics/mutexes/channels and a DashMap-class synchronization proof.
  • GREEN: instrumentation proves compiled module/prelink, memory/heap, capabilities/resources, and one kernel runtime are shared; Store/Instance/stack/TLS/execution state are per thread.
  • GREEN: configured thread count and shared-memory maxima reject excess spawn/growth deterministically.
  • GREEN: all focused commands use Soldr, and --no-default-features remains free of guest/engine dependencies.
  • GREEN: build coverage includes Linux, macOS, and Windows x86-64/ARM64; runtime evidence identifies native hosts actually exercised.

Deliverables

  • Checked-in guest package, target/build documentation, and artifact-loading harness.
  • Owned thread-spawn compatibility/import-rewrite implementation and regression tests.
  • Shared/private-state instrumentation and limit tests.

Decisions

Related issues

Activity

  1. added
    enhancement
    on Aug 27, 2026
  2. zackees commented on Sep 16, 2026

    @zackees
    CollaboratorAuthor

    Implemented; closing with the evidence, checked against the artifacts rather than the issue's own status.

    kernal-api — guests/threaded-smoke/ is the checked-in Rust guest built for wasm32-wasip1-threads, and scripts/build-threaded-smoke.{sh,ps1} build it through Soldr. The worker boundary and owned bootstrap it asks for are exercised by tests/wasm_worker_containment.rs.

    The guest is built in CI by the threaded-rust-artifact lane before the proof lanes run.

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions