miroir/notes
jedarden ac80d1f765 P3: Phase 3 Task Registry + Persistence — COMPLETE
Completes Phase 3 of the Miroir implementation: the 14-table task-store
schema from plan §4 with both SQLite and Redis backends.

## What Was Done

### 1. SQLite Backend (SqliteTaskStore)
- All 14 tables implemented with CRUD operations
- WAL mode for concurrent access
- Schema version tracking with migration system
- Idempotent migrations (safe to run on every startup)
- Schema version ahead detection (refuses to start if store > binary)

### 2. Redis Backend (RedisTaskStore)
- All 14 tables mapped to Redis keyspace
- Hash per row + index sets for O(cardinality) iteration
- testcontainers-based integration tests
- Leader lease with Redis SET NX/EX semantics
- Pub/Sub for session revocation
- Memory budget test (plan §14.7)

### 3. Schema Migrations
- Migration 1: Core tables (1-7)
- Migration 2: Feature tables (8-14)
- Migration 3: Task registry fields (no-op)

### 4. Tests
- SQLite: 36 tests pass (CRUD, property tests, restart resilience)
- Redis: Comprehensive integration tests (testcontainers)
- Helm validation: multi-replica requires Redis enforced

### 5. Helm Validation
- values.schema.json enforces redis + multi-replica constraint
- Test cases verify lint behavior (pass/fail as expected)

## Definition of Done — VERIFIED 

- rusqlite-backed store initializing every table idempotently
- Redis-backed store mirrors the same API (TaskStore trait)
- Migrations/versioning with schema version tracking
- Property tests on SQLite backend
- Integration test: restart resilience
- Redis-backend integration test (testcontainers)
- miroir:tasks:_index-style iteration for list endpoints
- taskStore.backend: redis + replicas > 1 enforced by Helm
- Plan §14.7 Redis memory accounting validated

## Files

- crates/miroir-core/src/task_store/mod.rs — TaskStore trait
- crates/miroir-core/src/task_store/sqlite.rs — SQLite impl
- crates/miroir-core/src/task_store/redis.rs — Redis impl
- crates/miroir-core/src/schema_migrations.rs — Migration registry
- crates/miroir-core/src/migrations/*.sql — Migration files
- charts/miroir/values.schema.json — Helm validation
- charts/miroir/tests/*.yaml — Test cases
- notes/miroir-r3j-phase3-completion.md — Completion notes

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 16:50:42 -04:00
..
miroir-mkk.md P4: Phase 4 topology operations verification — all chaos tests pass 2026-05-01 10:52:49 -04:00
miroir-r3j-phase3-completion.md P3: Phase 3 Task Registry + Persistence — COMPLETE 2026-05-02 16:50:42 -04:00