← Documentation indexdocs/superpowers/plans/2026-10-14-v3-issue-264.md

V3 Issue #264 — Version SQLite State and Migrate Safely

Issue-specific implementation plan for #264, prerequisite to #241 and #242.

Goal: Make SQLite schema and persisted payload upgrades explicit, ordered, transactional, recoverable, and safe for existing users.

Architecture: Extend SQLiteDatabase and existing repositories. Keep SQLite authoritative; preserve old task and interaction APIs. Add no placeholder plan service in this issue. Working Plan tables will be introduced by #241 when there is a concrete consumer.

Compatibility policy: Upgrade recognized historical schemas automatically after creating a restrictive, consistent SQLite backup. Reject future versions and malformed/inconsistent core schemas without modifying the source database. Keep unrelated extension tables intact. Never restore or replay work automatically.

Caller and data map

Task 1 — Establish historical and failure regressions

Task 2 — Add guarded, ordered SQLite migrations

Task 3 — Harden persisted replacement and payload compatibility

Task 4 — Verify and deliver #264

Risks and acceptance

PASS requires recognized legacy state to upgrade without losing scoped records, unsupported state to remain untouched, rollback to preserve source data, and approval history to remain non-authoritative. Automatic backups consume disk proportional to database size; operators can restore the reported backup to recover from a failed future application downgrade. No new dependency, paid provider call, automatic recovery execution, or placeholder plan service is in scope.