Skip to content

Fix inflated new-episodes notification count and rename to "episodes" (issue #60) - #61

Merged
mapitman merged 1 commit into
mainfrom
issue-60-notification-count-and-wording
Aug 10, 2026
Merged

mapitman merged 1 commit into
mainfrom
issue-60-notification-count-and-wording

Conversation

@mapitman

Copy link
Copy Markdown
Owner

Summary

  • Root cause: `FeedRepository.trimToItemsToKeep` deletes evicted episodes from the DB outright, so a feed whose upstream RSS lists more episodes than `itemsToKeep` (default 20 -- common for long-running shows) re-"discovers" its own previously-trimmed episodes as new on every single refresh: each one gets re-inserted, counted as new, then immediately re-evicted again in the same pass. This inflated the notification's count indefinitely instead of settling once genuinely new episodes were seen.
  • `FeedUpdateResult.Success.newItemCount` now excludes items evicted in the same cycle they were "discovered" in (`newItemIds.count { it !in evictedItemIds }`) -- both lists already come from the same `persist()` call for that feed. `newItemIds` itself is untouched, since `AutoQueueAndDownloadEnforcer` also reads it for auto-queue/auto-download, which is out of scope here.
  • Renamed the notification's wording from "item(s)" to "episode(s)" throughout (title, body, channel name/description) and renamed the backing string resources (`notification_new_items_` -> `notification_new_episodes_`), across all 5 locales. The Android notification channel ID itself (`"new_items"`) is left unchanged to avoid orphaning existing users' channel settings.

Fixes #60

Test plan

  • `./gradlew assembleDebug testDebugUnitTest lintDebug` all pass
  • Added `FeedUpdateEngineTest.updateFeed_reDiscoveringAPreviouslyTrimmedItem_doesNotCountItAsNewAgain`, reproducing the exact trim-then-rediscover cycle and asserting the second cycle's `newItemCount` is 0
  • Verified live on an Android emulator: subscribed to a real podcast feed (NPR's Planet Money, ~100+ episodes upstream), capped it to 5 items via Feed Properties, forced a refresh -- confirmed no notification fired despite ~15 historical episodes being reinserted-then-evicted in that pass (previously this would have shown "~15 new items"). Then deleted one of the 5 currently-kept episodes to simulate a genuinely new one and re-ran: notification correctly read "New episodes" / "1 new episode".

… (issue #60)

trimToItemsToKeep deletes evicted rows outright, so a feed whose
upstream RSS lists more episodes than itemsToKeep re-"discovers" its
own previously-trimmed episodes as new on every single refresh --
each one gets re-inserted, counted as new, then immediately re-evicted
again in the same pass. This inflated the notification's count
indefinitely instead of settling once new episodes were seen.

FeedUpdateResult.Success.newItemCount now excludes items evicted in
the same cycle they were "discovered" in, since a Success result
already carries both newItemIds and evictedItemIds from the same
persist() call. newItemIds itself is untouched, since
AutoQueueAndDownloadEnforcer also reads it for auto-queue/auto-
download and that's out of scope here.

Also renames the notification's wording from "item(s)" to
"episode(s)" throughout (title, body, channel name/description) and
renames the backing string resources, across all 5 locales.

Verified on an emulator: simulated the trim/rediscovery scenario by
capping a subscribed feed to 5 items via Feed Properties, forcing a
refresh, and confirming no notification fired despite ~15 historical
episodes being reinserted-then-evicted in that pass (previously this
would have shown "~15 new items"). Then deleted one genuinely-kept
episode and re-ran: notification correctly read "New episodes" / "1
new episode".
@mapitman
mapitman merged commit 8cffe85 into main Aug 10, 2026
1 check passed
@mapitman
mapitman deleted the issue-60-notification-count-and-wording branch August 14, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New-episodes notification shows an inflated count, and calls them "items" instead of "episodes"

1 participant