P3.1 TaskStore trait + SQLite backend (tables 1-7) - Complete

- TaskStore trait defined in miroir-core with all CRUD operations for tables 1-7
- SQLite backend implementation with:
  - tasks (table 1): Miroir task registry with JSON node_tasks
  - node_settings_version (table 2): per-(index, node) settings freshness
  - aliases (table 3): single and multi-target aliases with history
  - sessions (table 4): read-your-writes session pins
  - idempotency_cache (table 5): write deduplication with BLOB SHA256
  - jobs (table 6): background jobs with claim/heartbeat semantics
  - leader_lease (table 7): singleton-coordinator lease

- Idempotent schema initialization with version tracking
- WAL mode enabled for concurrent write safety (busy_timeout=5000ms)
- All 14 CRUD tests passing

Acceptance criteria met:
 cargo test -p miroir-core task_store::sqlite - every CRUD round-trips correctly
 Opening existing DB skips migrations (schema_version check)
 Concurrent writes don't deadlock (WAL + busy_timeout)
 Table schema fits within 100 MB task registry budget

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-13 18:37:12 -04:00
parent 854f1f4174
commit e8456e1760

View file

@ -1440,6 +1440,12 @@ impl SqliteTaskStore {
[],
)?;
// Index for admin_sessions expiration queries (plan §4 table 14)
conn.execute(
"CREATE INDEX IF NOT EXISTS admin_sessions_expires ON admin_sessions(expires_at)",
[],
)?;
Ok(())
}
}