Skip to content

feat(wasm-abi): add logical-sketch-scoped generation-safe resources #38

Closed

Description

@zackees

Parent: #16. Depends on #37's generated async-operation lifecycle; #35 is required for the real authorized same-logical-sketch cross-thread proof. Governed by #13 and constrained by #15's closed import contract.

Scope

Implement the first private, generated v1 resource registry and facade-owned semantic handles. A handle is validated as (logical_sketch_scope, slot, generation, kind, rights); it is not a raw Wasmtime object, Store/Instance identity, pointer, numeric capability bit, or global resource ID. Implement only a synthetic resource with generated create/use/close operations through #37's submit/poll/yield/cancel lifecycle.

The registry is owned by the logical sketch and is shared by every authorized instance/thread in that sketch. It is not cloned per Store. The root and any child guest thread may use a resource only when its rights declare it shareable and it belongs to the same logical sketch. A separate sketch, a stale generation, a wrong kind/right, a forged handle, or a closed resource receives a bounded facade-owned error before any host effect.

Every create reserves bounded registry/quota state before scheduling. Close, cancellation, terminal operation, trap, thread exit, and sketch teardown have an idempotent, deterministic cleanup path that invalidates the generation and releases all permits/registrations. Completion never retains guest pointers, Store/Instance/Caller, resource-table borrows, mutex guards, or DashMap guards across an await, wakeup, cancellation callback, or guest re-entry.

Non-goals

No Blob bytes, streaming, file handles, paths, output files, std::io adapters, Read/Write/Seek, host filesystem/network/process/clock authority, real timers, Tauri, WASI linking, or worker containment. #17 owns bounded transfer/backpressure and exact output. A blocking standard-library adapter is deferred under #13 until #17's transfer contract and #35 are available.

Import and authority invariants

RED → GREEN

  • RED: a generated fixture characterizes that no scoped, generation-safe resource can be created, used, and closed through the generated lifecycle.
  • RED: fixtures demonstrate that raw-slot reuse, a stale handle, cross-sketch use, wrong kind/right, duplicate close, close-versus-completion, and teardown can otherwise confuse ownership or leak quota.
  • GREEN: generated create/use/close succeeds for one synthetic resource and every operation uses feat(wasm-abi): dispatch generated async operations through poll, yield, and cancellation #37's sole lifecycle/explicit RuntimeHandle; no second scheduler, ABI path, or ambient callback exists.
  • GREEN: handle reuse increments generation; stale/forged/cross-scope/wrong-kind/wrong-right/closed handles fail with bounded semantic errors before host effects.
  • GREEN: per-resource and per-sketch quotas reject before scheduling; close/cancel/trap/thread-exit/sketch teardown release registrations, pending operations, and permits exactly once, with zero live-resource/pending-operation counters after teardown.
  • GREEN: root proof confirms Store/Instance independence from logical scope and no retained pointer, Store, resource/lock/DashMap guard across suspension or completion.
  • GREEN: after feat(wasm): bootstrap owned threaded guest instances #35, a real Rust wasm32-wasip1-threads artifact proves explicitly shareable resource use from two authorized guest instances in the same logical sketch, while a different logical sketch is rejected. This must not be replaced by a native/mock-thread proof.
  • GREEN: default-feature isolation and Linux/macOS/Windows x86-64/ARM64 compilation remain intact.

Deliverables and closure

Deliver generated semantic resource declarations/facade, private logical-sketch registry, quota/cleanup instrumentation, raw and real-artifact fixtures, and Soldr-only focused commands. Close only when #17 can build Blob and OutputFile capabilities on these handles without widening imports, duplicating lifecycle state, or treating a Store as a security scope.

Activity

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

    @zackees
    CollaboratorAuthor

    Closed as completed. The shared logical-sketch OperationHub provides generation-safe synthetic resource create/use/close through the sole generated lifecycle, including shareability checks, quota reservation, stale/closed defenses, idempotent teardown, and a real threaded guest proof using a shared resource across authorized guest instances. No import surface was widened.

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