Implements the sqlite kv-tier engine per ADR-003/007/010 §1 behind
feature `sqlite` (default-on): the B5 row shape (key BLOB PK / value
BLOB / size INTEGER NOT NULL), INSERT OR IGNORE CAS first-writer-wins
on both put forms, the EXISTS has probe, the materializing cursor body
with len() from the size column, the degenerate in-memory stage with
both hygiene forms, the indexed-column size probe (plan-tested), the
no-tables-yet virgin-store read tolerance (tested against a tableless
database file), WAL + synchronous=NORMAL verified at open, prepare_cached
discipline, and every rusqlite operation in spawn_blocking under the
recorded single-connection posture.
Task: tasks/engine-sqlite.md (status: completed). The engine-state
window family and store construction remain in their own tasks.
Verification:
- cargo test — 58 pass (11 new sqlite in-module tests)
- cargo clippy --all-targets -- -D warnings — clean
- cargo fmt --check — clean
- cargo check --no-default-features — green
Six tasks against the wave-2 contract surface as reviewed (no
amendments from the gate):
- engine-sqlite: the default kv engine — WAL + synchronous=NORMAL,
prepared statements, the indexed size column probe (B5's row shape),
has-as-EXISTS, virgin-store no-tables-yet tolerance, spawn_blocking
discipline
- engine-sqlite-window: the engine-state seam's window family only
(ADR-012 §5's reduction — gc_window, stage/take; no pin rows, no
sweep-lock body)
- store-sqlite-construction: KvEngine::Sqlite slots in, the
dual-tier/kv-only constructors with the constructor-tunable window
delay (default 5 min), ensure_gc_schema at construction, the
one-window-host posture
- store-sweep-durable-window: the sweep's SQL-backed form — overdue
rows execute with re-arbitration before/alongside marking, candidates
stage at mark_end + window, counts exact relative to the schedule
(ADR-012 §6.7); the inline form preserved verbatim
- suite-column-sqlite: the first SQL-backed column, server-less —
form-independent reference rows mirror directly; the sweep rows are
schedule-relative (the recorded INV-4/5 mirror amendment)
- review-wave-3: the engine-wave gate (engine-vs-contract conformance)
Verification: dependency graph validated (all ids resolve, no cycles,
topological order clean); docs-only change.
Refs: docs/plans/implementation.md §Wave 3