fix(xtream): preserve pending backups and restore positions atomically (#1873)

* fix(xtream): preserve pending backups and restore positions atomically

* fix(xtream): retain sparse duplicate playback metadata on restore

* fix(xtream): require atomic restore in SQLite capability gate

* fix(xtream): preflight atomic restore without changing storage
This commit is contained in:
4gray authored and GitHub committed 2026-10-10 16:27:01 +02:00
1 parent 2b400cb81d
commit 2fa03c8efc
25 files changed
+1037 -142

No files matched your search

+14
View File
@@ -661,6 +661,20 @@ is unavailable or the SQLite playlist migration has not completed.
4. `DB_GET_RECENT_PLAYBACK_POSITIONS`
5. `DB_GET_ALL_PLAYBACK_POSITIONS`
6. `DB_CLEAR_PLAYBACK_POSITION`
7. `DB_REPLACE_ALL_PLAYBACK_POSITIONS`
Backup restore uses `DB_REPLACE_ALL_PLAYBACK_POSITIONS` to replace only the
specified playlist's positions in one synchronous transaction. Every insert
and the delete use `.run()` so an insertion failure rolls the whole replacement
back. An empty replacement deliberately clears that playlist. Renderer backup
callers propagate read/write errors and retain pending restore state for retry;
normal playback persistence keeps its best-effort behavior. The renderer checks
atomic replacement support at the start of the immediate or deferred restore
pass, before updating existing categories, collections, positions, or pins.
Missing support fails restore with the pending snapshot retained; it does not
switch ordinary Xtream storage or backup export away from SQLite. Deferred
catalog import can still seed newly imported categories from pending visibility
state before that restore pass runs.
## SQLite Concurrency Rules