--- id: mem-engine-integration name: Mem engine — integration (full-surface wiring, suite third column, wasm32 acceptance) status: pending depends_on: [mem-engine-notify-listen, mem-engine-streams, mem-engine-queues, mem-engine-locks, mem-engine-scheduler-outbox, mem-engine-seam-tx, suite-harness-current-thread] scope: moderate risk: medium impact: phase level: implementation tags: [wave-6, mem-engine, integration] --- ## Description The integration task: wire the finished mechanisms into a complete `Store`, adopt the contract suite as the third column, and carry the wasm acceptance items through ([ADR-024](../architecture/decisions/024-mem-engine.md) §5; the born-pinned posture — engine-mem.md §Isolation and the suite factory): - **Full-surface wiring**: every handle constructible off one `MemStore`; trait-object plumbing; crate docs (module docs + a crate-level doc carrying the honest-ephemeral posture statement — no durability, single-process, ephemeral by design, never fleet-valid, per [ADR-024](../architecture/decisions/024-mem-engine.md) §2 — and the wasm identity line per engine-mem.md §Identity). - **Suite third column**: a `tests/contract_suite.rs` target implementing `StoreFactory` (fresh `MemStore::new()` per run, teardown = drop — the factory's isolation contract verbatim) and running the shared rows wired per engine: mem's column carries the mechanism rows that express on it and omits the engine-shaped rows that cannot (reconnect-wake, watcher-death close, watcher-cadence — the per-engine wiring the suite's rows already use; `PayloadTooLarge`'s non-occurrence arm *wires* — the arm is the pin). The column runs under a **current-thread runtime flavor** (the pre-task's async-sleep harness makes this clean). - **wasm32 acceptance**: `cargo check --target wasm32-unknown-unknown -p alkstore-mem` (and the workspace's other crates untouched) clean; the manifest's tokio features verified as the sync+time subset. On-target suite execution stays scoped out (the named collapse condition — a wasm-bindgen-test adapter crate — recorded in the task Notes at completion, not an OQ). - **No `spawn_blocking` anywhere**: grep-verified; internals current-thread-clean by construction, now proven by the flavor the column runs under. - Suite column green is the wave's center-of-mass: 25 rows' worth of contract v1 assertions against a third, independent implementation — any red row is either a mem defect or (if the row pins implementation detail a correct engine could fail) a found suite defect to raise with the reviewer *before* editing the row (rows pin ADR text; a wobble is amend-in-place material under the class-1 window). ## Acceptance Criteria - [ ] `StoreFactory` implemented for the mem engine; the third suite column wired and **green on the host** (same row set per the wiring table above) - [ ] The column runs under the current-thread flavor; no blocking calls in mem internals (grep-verified) - [ ] `cargo check --target wasm32-unknown-unknown -p alkstore-mem` clean - [ ] `engine-mem.md` updated from `draft`-initial to implementation-complete (the spec grows with the wave per its frontmatter note); crate docs carry the posture + wasm identity - [ ] Workspace gates green; clippy `-D warnings`; fmt clean - [ ] The class-1 window discipline respected: any suite-row change or contract wobble surfaced to the reviewer, not silently patched ## Dependencies note `mem-engine-seam-tx` is listed because the overlay's commit-merge and `*_tx` read shapes are what the suite's tx rows exercise on mem; the mechanism tasks consume it, but a late seam fix may be needed if the suite surfaces one — the task owns absorbing it. ## References - docs/architecture/decisions/024-mem-engine.md §5 (acceptance items); 022-contract-suite-layout.md (the factory both engines already implement — the shape to mirror) - docs/architecture/engine-mem.md (spec of record) - tasks/sqlite-engine-integration.md / tasks/pg-engine-integration.md (the structural twins' integration tasks of record) - tasks/review-wave-5.md appendix (the discharge map the third column rides) ## Notes > To be filled by implementation agent ## Summary > To be filled on completion