Repository navigation
Re-key episodes whose GUID the host changed instead of duplicating them - #118
Merged
Merged
Conversation
Blocked and Reported's Substack feed rewrote the GUIDs of 178 back-catalogue episodes (substack:post:N -> substack:post:N:unlocked). Refreshes match by GUID, so every one was inserted a second time with addedAt = now and Home's New section filled with episodes from as far back as 2021. Adapted from AntennaPod's FeedDatabaseWriter + FeedItemDuplicateGuesser: before each refresh matches by GUID, EpisodeDao.repairChangedGuids pairs stored episodes whose GUID is gone from the feed with feed items that look like the same episode (same audio URL, or same title on the same day within 10 minutes' length). The stored row takes the new GUID, keeping its play state, download and addedAt, so the refresh updates it instead of inserting a copy. Copies an earlier refresh already inserted are folded into the original (play state, download and listening sessions move over) and deleted. Episodes still in the feed under their own GUID are never matched. Wired into the background worker, refresh-all, the podcast page refresh and re-subscribing to a known show. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RK5hqcE13d42xpsT576dRw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Home's New section filled with 190 Blocked and Reported episodes, some from as far back as December 2021.
Substack rewrote the GUIDs of 178 of the 522 episodes in that show's feed:
substack:post:N→substack:post:N:unlocked. Refreshes match stored episodes by(podcastId, guid), so every rewritten episode was inserted a second time withaddedAt = now. They showed up as New and as duplicates on the podcast page. The same thing had happened with another podcast before.Change
This is adapted from AntennaPod's
FeedDatabaseWriter+FeedItemDuplicateGuesser.New
EpisodeDao.repairChangedGuids(podcastId, feedItems)(@Transaction) runs before each refresh matches by GUID:SELECT guidquery.seemsSameEpisodeAsthem. AntennaPod's rules: the same audio URL, or the same normalized title on the same day with lengths within 10 minutes of each other.addedAt. The refresh then updates that row instead of inserting a copy.EpisodeMatchRow), not full rows with descriptions.It's called from
FeedRefreshWorker, refresh-all inAppViewModel,PodcastDetailViewModel.refreshFeed, and re-subscribing to a known show (AppViewModel,DiscoverViewModel).Tests: five Robolectric
EpisodeDaoTestcases on a real database:Version 1.6.74 (122) → 1.6.75 (123), with a What's New entry.
Testing
Local compilation could not be run: Gradle can't resolve dependencies in the agent environment. The CI
buildcheck (all unit tests plusassembleDebug) is the compile check for this PR.Generated by Claude Code