[Superseded by #78] Library: migrate durable catalog state to SQLite
Draft
TE
2mo ago+1094+1094+0123456789012345678901234567890123456789-75-75-01234567890123456789
Implements #35 as a stacked PR on #67 / #34.
Current implementation:
- explicit SQLite schema version with Sources, entries, availability/reconciliation observations, normalized tags/metadata, favorites, recent/play-state table, ordered collections and playback weekdays;
- indexes for Source catalog identity/path/availability, media type, tags, recents and collection membership;
- deterministic JSON source migration into a sibling candidate database in one transaction;
quick_check, foreign-key verification and semantic round-trip equality before publish;- candidate sync + database publish + backend-selector switch last, with the JSON snapshot retained for recovery;
- recovery from a corrupt selected SQLite database through the retained validated JSON snapshot, with rebuild on the next successful mutation;
- deterministic sorted-key JSON debug/export representation;
- hard 64 MiB SQLite bound while retaining the existing catalog-level entry/source/state bounds;
- media remains external; only catalog/state and access references enter SQLite.
Tests cover exact round-trip preservation, ordering, metadata, tombstones, indexes, historical JSON retention after SQLite activation, deterministic export, corrupt-database recovery and unknown-selector failure.
Stacked on quarry/source-reconciliation-34; I’ll retarget to main once #34 lands.
🧱 Quarry