--- id: review-wave-3 name: Wave 3 review gate — the sqlite engine vs the contract status: pending depends_on: [suite-column-sqlite] scope: narrow risk: low impact: phase level: review tags: [wave-3, review] --- ## Description The wave-3 review gate — the engine-wave review shape (docs/plans/implementation.md §Review gates: "engine-vs-contract conformance"), before wave 4 decomposes. The gate reads the implementation against the pinned ADR text line by line (the wave-1/2 gates' method). Gate checks: - **Engine-vs-contract conformance**: the suite column green server-less; the engine-state window family contract-tested per its applicability row (ADR-012 §5's table — window family yes, pin clauses no, sweep-lock body no); virgin-store semantics including the no-tables-yet form; the `size` metadata-only discipline (the indexed column probe never loads the value blob). - **The sqlite posture vs ADR-003/007**: WAL + `synchronous=NORMAL` as the shipped durability tier; the single-writer ceiling documented as posture, not hedged (REQ-1's economics); prepared-statement discipline; `has` as an EXISTS probe; the B5 row shape (key/value/ size); bounded reads. - **The durable-window sweep vs ADR-008 §2 / ADR-012 §5/§6.7**: candidates staged at `visible_after = mark_end + window` (the constructor-tunable delay, shipped default 5 min); the executor is the next sweep; execution-time re-arbitration; report counts exact relative to the schedule; the inline form preserved verbatim for non-SQL engines; the single-node posture unchanged (pins/liveness/ arbitration lock in-process — only the window's persistence is engine rows); the one-window-host posture recorded. - **The seam reduction honored**: no pin rows, no sweep-lock body anywhere in the sqlite engine (dead machinery per ADR-012 §5); `ensure_gc_schema` creates `gc_window` only; the embedder's liveness table never created by the engine. - **Blocking discipline**: all rusqlite work off the async path (`spawn_blocking`); no blocking I/O under internal locks; the connection posture recorded. - **Named design points audited as resolved** (each recorded in its task's Notes): the connection posture; the timestamp encoding; schema-creation timing vs the no-tables-yet tolerance; the kv cursor dispatch shape over multiple kv engines; the protect-consult posture on overdue execution; the delay-0 test tuning's legality. - **Family conventions**: no comments in code (doc comments on public API fine), thiserror, tokio-only async, no unwrap/expect outside tests, naming, one-module-per-file re-export shape, the `#![allow(dead_code)]` scope notes matching their remaining scope. - **Gates green**: `cargo test` (default — the sqlite column runs here), `cargo test --features mem`, `cargo test --all-features`, `cargo clippy --all-targets -- -D warnings`, `cargo clippy --all-features --all-targets -- -D warnings`, `cargo fmt --check`. Findings are fixed inline where cheap, or recorded as wave-4 amendments where they shape the next decomposition. The gate's completion is what unblocks wave 4's decomposition. ## Acceptance Criteria - [ ] Every gate check above read and verified against the cited ADR text (not from memory of it) - [ ] Named design points each decided, recorded, and consistent with the specs - [ ] Findings fixed inline or recorded as wave-4 amendments with owners - [ ] All gates re-run green after any fixes - [ ] Wave 4 decomposition unblocked (recorded in this task's Summary) ## References - docs/plans/implementation.md (§Wave 3, §Review gates — engine wave reviews) - docs/architecture/decisions/003-backend-contract-and-dispatch.md - docs/architecture/decisions/007-two-kv-engines-sqlite-and-postgres.md - docs/architecture/decisions/008-trait-size-probe-fleet-gc-and-large-engines.md §2 - docs/architecture/decisions/010-backend-io-seams-and-fleet-state.md §2 - docs/architecture/decisions/012-pre-decomposition-consistency-rulings.md §1/§5/§6.7 - docs/architecture/store-api.md - tasks/review-wave-2.md (the gate method) ## Notes > To be filled by the review agent ## Summary > To be filled on completion