Re-key imported GUID-less episodes and make fetch-state writes atomic

The prototype kept one row per enclosure URL for GUID-less items, so stale
rows could change which identity key is unique and give imported episodes
ids a fresh device never derives. The import now collapses rows of one item
seen under several enclosure URLs, and the first refresh re-keys imported
GUID-less episodes without progress or sessions to the ids the current feed
gives.

Fetch-state writes read and write the row under one lock and one immediate
transaction, so concurrent writers no longer lose columns or failure counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-19 17:02:31 +02:00
1 parent e627be51d4
commit 9709f5e2b5
5 files changed
+586 -43

No files matched your search

+10 -1
View File
@@ -31,7 +31,16 @@
- `furumi-library 0.3.0` (breaking): `TrackItem.podcast:
Option<PodcastEpisodeRef>` and `TrackItem::podcast_episode`/`is_podcast`.
Exhaustive `TrackItem` literals in clients need the new field; music-only
code must skip podcast items. The library database is unchanged.
code must skip podcast items. Podcast items use a negative per-episode id
(`TrackItem::podcast_track_id`, at most `PODCAST_TRACK_ID_MAX`) and
`release_id`/artist id -1, so existing `id < 0` / `release_id < 0` checks
already treat them as non-library items. The library database is
unchanged.
- `furumi-library 0.3.0`: prototype import collapses rows of one GUID-less
item under several enclosure URLs, and the first refresh re-keys imported
GUID-less episodes without personal state to the ids the current feed
gives, so they match devices that never had the prototype. Fetch-state
writes are atomic across threads and processes.
- See `PODCASTS.md` for the normative contract.
## v0.4.1 — 2026-09-02