A publishes, an unrelated peer C finds the card by text and id while A's
trusted device B is offline, a never-shared podcast stays invisible, a
tombstone hides the card, and forged, tampered, replayed, malformed,
oversized and wrong-version requests are rejected. A peer without the
overlay never joins its routing table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New music_dht::podcast_dht: a schema-independent Kademlia overlay on
furumi-fd/podcast-dht/1 (version 1) with its own SQLite cache. Devices
publish signed public podcast cards only where effective_share holds,
retract them with signed tombstones of the next revision, and search by
normalized title/author tokens or podcast id. Records are verified on
every receive and cache read. Adds typed federated search hits, the
advisory feed_url_privacy_warning helper, the podcast_dht capability and
MusicDhtError::PodcastPublication.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add TrackItem::from_playback_track and PlaybackItem: a received podcast
episode becomes TrackItem::podcast_episode (sentinel ids) and a Jam
private placeholder gets no TrackItem, so the wire ids (0 for both) are
never copied. Narrow the TrackItem::key guidance: it is the source
identity, episodes must never be keyed by id, and content-first music
matching stays as it is. Document how TrackItem::podcast_episode differs
from the wire form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A provisional imported GUID-less episode whose feed item id is already
held by an episode that stays (typically one a remote operation created
before this device's first refresh) is now deleted instead of kept as a
second, never re-keyed copy. The same applies when its legacy GUID turns
out to be the item's real GUID. Such episodes carry no personal state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-episode negative ids (TrackItem::podcast_track_id below
PODCAST_TRACK_ID_MAX) were a magic id range in shared code, which the
podcast requirements forbid. Podcast items now use the fixed sentinel
TrackItem::NOT_A_LIBRARY_ROW (-1) as id, release_id and artist id; it
carries no identity. Their identity is TrackItem.podcast alone.
Add TrackItem::key returning a typed TrackItemKey (library row, federated
owner and item id, podcast episode id, or transient), with the stable
string forms lib:<id>, fed:<owner>:<item_id>, ep:<episode id> and
tmp:<id>, so clients key queue items by source instead of by numeric id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
TrackItem::podcast_episode used id 0, release_id 0 and artist id 0, which
clients treat as library rows. Podcast items now get a negative id derived
from the episode id (TrackItem::podcast_track_id, at most
PODCAST_TRACK_ID_MAX, below pending federated ids) and release/artist id -1,
so existing id < 0 / release_id < 0 checks skip them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PODCASTS.md gains the "SQLite reference store" section (migrations,
prototype import, tables, invariants); ARCHITECTURE.md, the
furumi-library README and the changelog describe PodcastStore and
TrackItem.podcast.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New `furumi_library::podcasts::PodcastStore` in its own podcasts.sqlite3:
- user_version migrations in immediate transactions; version 1 is the
prototype schema of the original podcast PR, version 2 renames its tables
to legacy_* and imports feeds, episodes and fetch state with contract
ids; unimportable rows go to legacy_quarantine; newer or foreign files
are refused before anything is written;
- catalog (podcasts, feed aliases, seasons, episodes), subscription, share
and progress registers, listening sessions and local-only fetch state;
- local actions that apply and return podcast sync operations, remote
operation and snapshot application through the music-dht materializers
and merge functions, bounded snapshot export;
- RSS refresh ingestion with stable episode ids and alias learning that
never touches personal state, and queries for the UI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TrackItem gains `podcast: Option<PodcastEpisodeRef>` with
`TrackItem::podcast_episode`, `is_podcast` and `podcast_episode_ref`.
Library queries keep returning music only (`podcast: None`); the library
database is unchanged. Music-only code paths must check `is_podcast`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Order subscription and share registers by a per-podcast Lamport
generation before hlc_ms (next_podcast_generation), so clock skew
cannot undo an observed unsubscribe or share decision.
- share=false is register state, not a compactable tombstone.
- Add podcast_feed_aliases_added so refreshes can sync aliases without
touching the registers; SubscriptionRecord::feed_urls keeps the current
feed URL resolvable beyond the alias bound.
- Carry progress_generation on queue items for handoff.
- Distinguish self-reported and relayed peer versions, and gate
PairRequest by an optional inviter version in InviteWire.
- Give each podcast snapshot section its own byte budget, drop channel
descriptions from snapshots and allow a caller-provided budget.
- Reject one-slash http(s) typos in FeedUrl::from_user_input.
- Pin that malformed ids and feed URLs reject the whole message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the no-GUID matching stages across the whole document so a weak
date+title match of an earlier item cannot take a known episode that a
later item matches by enclosure. Keep feed links verbatim (trimmed only)
because they are identity material, and stop html_to_text from scanning
to the end of the text at every '<' when no '>' follows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add PODCASTS.md as the normative podcast contract: identity and URL
canonicalization, the no-GUID rule, synced versus local versus public
data, operation kinds and merge rules with examples, snapshot recovery,
version gating for peers below v4, Jam privacy and the reserved
playback_rate. Update PLAYBACK_PROTOCOL.md, ARCHITECTURE.md, the crate
READMEs and CHANGELOG.md.
Bump music-dht to 0.6.0 and furumi-library to 0.3.0: new public enum
variants and struct fields are breaking changes for 0.x, and
furumi-library re-exposes music-dht types.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump DEVICE_SYNC_PROTOCOL_VERSION to 4 (ALPN unchanged) and carry the
podcast contract between trusted devices:
- podcast_subscription_set, podcast_share_set, podcast_progress_set and
podcast_listen_recorded operations with record materializers and
validation; unsubscribe is LWW state, share=false is a tombstone;
- bounded podcast sections in SyncSnapshot, the recovery path for peers
that upgrade after operations were hidden from them;
- PlaybackTrack.source with PlaybackSource::{Music, PodcastEpisode,
Private}, reserved PlaybackStateWire.playback_rate and an optional
self-reported protocol_version in DeviceProfileSet;
- gating helpers for peers below v4 (op_allowed_for_peer,
playback_allowed_for_peer, playback_command_allowed_from_peer,
SyncSnapshot::for_peer) and Jam privacy (redact_for_jam,
redact_jam_snapshot, jam_command_allowed, restore_jam_private_items).
Tests show that a v3-shaped enum rejects a whole batch containing a new
kind, which is why gating is mandatory, and that legacy JSON still
parses and music-only messages keep their v3 shape.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the tolerant RSS 2.0 / RSS 1.0 / Atom parser of the original
furumi-tui podcast work into music_dht::podcast::feed behind the
optional podcast-feed feature (quick-xml, encoding_rs, url). Episode
identity depends on what the parser extracts, so it must be shared by
all clients.
The port keeps its robustness (BOM and declared encodings, entities,
mismatched tags, depth and size limits, lenient dates, http(s)-only
media) and adds itunes:season, itunes:episode, itunes:episodeType,
guid isPermaLink and itunes:new-feed-url. Missing GUIDs stay absent
instead of falling back to the enclosure URL, and parsed items produce
identity hints and contract metadata.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Introduce music_dht::podcast, a pure module (no SQLite, HTTP or clock)
that every Furumi client uses for podcast identity and personal state:
- FeedUrl canonicalization that keeps the path and every query
parameter byte-for-byte, PodcastId/EpisodeId derivation with
domain-separated BLAKE3, feed aliases and the documented no-GUID
episode identity rule;
- bounded PodcastMeta, EpisodeMeta and the self-contained
PodcastEpisodeRef queue item;
- convergent merge rules for subscriptions (LWW, unsubscribe is state),
share decisions (false is a tombstone), progress registers ordered by
a Lamport generation, and listening sessions (G-set, one completion
per session).
Tests cover every delivery permutation of small operation sets, late
checkpoints of old sessions, concurrent offline sessions and RSS
metadata updates that must not touch progress.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>