Repository navigation
Description
Child of #27. Depends on #35; contributes to #13 and #14, and establishes the in-process accounting boundary that #28 will contain when execution is non-cooperative.
Scope
Add facade-owned semantic execution limits and a private per-logical-sketch execution session/ledger over the #35 threaded root:
- aggregate logical shared-memory reservation;
- active root-execution permit;
- guest-thread hard cap;
- bounded execution/fuel budget fields reserved for the following child;
- bounded deadline/cancellation-registration fields reserved for the following epoch child.
The ledger owns exactly one shared-memory reservation lease for a prepared execution session. For the exact Rust 1.95 threaded contract, reserve the admitted maximum before SharedMemory::new: 16,384 × 65,536 = 1,073,741,824 bytes (1 GiB). Current committed pages are telemetry only; they must never permit aggregate oversubscription. The lease releases exactly once when session preparation, execution, or teardown terminates.
Add private counters/snapshots for logical sketch id, configured/reserved/current shared pages, active root permits, live Store/Instance/native-thread registrations, and terminal state. Public errors/configuration use only facade-owned semantic values; do not expose Engine, Store, Instance, SharedMemory, limiter, pointer, or backend diagnostics.
Invariants
- Reserve before
SharedMemory::new, and reject a quota failure before engine-owned allocation or Wasm effect. - Shared-memory accounting is owned by
kernal-api, independent ofStore::limiter, pooling, or committed-page observation. - Release is idempotent: normal completion, root/child trap, failed preparation, and explicit session close cannot underflow or leak the lease/permits.
- Existing feat(wasm): bootstrap owned threaded guest instances #35 shared module/prelink semantics remain private; no additional runtime, allocator, pool, or backend fallback.
default = []andfulldo not resolve Wasmtime/parser/scheduling support; heavyweight behavior remains behindwasm-sketch-host.
Non-goals
No fuel/epoch configuration, timer, cancellation, async guest resources, stream/blob limits, worker-process containment, pool allocator, or Tauri. Pending async-operation quotas are deferred to the generated operation lifecycle work; this issue budgets only executable roots and native guest registrations.
RED → GREEN
- RED: characterize that two admitted threaded roots can prepare their 1 GiB-compatible shared memory without a kernel-owned aggregate reservation/release observation.
- RED: characterize that a failed preparation/trap has no facade-owned resource snapshot.
- GREEN: a configured aggregate 1 GiB ceiling admits one exact threaded session and deterministically rejects a second reservation before
SharedMemory::new/Wasm; a larger configured ceiling has exact arithmetic and no overflow. - GREEN: normal completion, child/root trap, failed
SharedMemory::new, and explicit close release exactly one lease and leave zero active root permits/live registrations/accounted bytes. - GREEN: snapshots distinguish reserved maximum from current observed pages and identify shared-session versus per-thread state without backend leakage.
- GREEN: regression fixtures prove no
Store::limiteror pooling allocator is required for the shared-memory boundary. - GREEN: focused Soldr tests pass on Linux/macOS/Windows x86-64/ARM64 compilation matrix; actual native runs are recorded separately.
--no-default-featuresremains free of Wasmtime/parser.
Deliverables
- Facade semantic limit/config/error/snapshot types.
- Private execution-session, permit, and shared-memory lease/ledger implementation.
- Pre-allocation rejection and exact-once teardown tests.
- Resolved Wasmtime-45 compatibility/accounting note and focused Soldr commands.
Dependencies and closure
- Parent feat(wasm): add scheduling limits and teardown instrumentation #27; depends on feat(wasm): bootstrap owned threaded guest instances #35’s owned threaded session construction; parent chain feat(wasm): add engine policy and strict module admission validation #25/feat(wasm): add threaded Rust guest and owned thread bootstrap #26/feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15.
- Followed by bounded fuel/permit enforcement; epoch/deadline work follows that.
- feat(wasm): add killable threaded-sketch worker containment #28 remains the required containment path for a non-cooperative blocked atomic wait or host call.
- Close only when feat(wasm): bootstrap owned threaded guest instances #35 can create and tear down one logical session with kernel-owned accounting, no leaked registration/lease, and no public backend types.
Activity