Repository navigation
feat(notifications)!: notify only for the next episode and wanted titles - #4409
Merged
Merged
Conversation
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
Related issue: N/A
Validation tasks: changes #1234 C1, C4; changes #1235 C1, C2; changes Silo-Server/silo-android#346 C1, C2; changes Silo-Server/silo-apple#336 C1
Other clients: Apple Silo-Server/silo-apple#873; Android Silo-Server/silo-android#661; Roku N/A (Roku has no notification inbox or push)
Silo sends new-episode notifications a profile can't act on yet. A profile that stopped at S01E02 of a series was told about E06, E07 and E08 as they arrived. Favorites, the watchlist and Continue Watching each notified for any new episode of a series, and all of them were on by default. Meanwhile a profile that watchlisted a title the server didn't have heard nothing when it arrived unless a request covered it.
After this change a profile hears about two things: a new episode that is the next one after what it has watched, and a title it watchlisted or requested arriving.
This replaces #2888, which implemented the same rule in October and has since fallen behind
main. The watchlist arrival here is ported from it.The validation cases above passed on build 1804 and need a re-test. #1235 C1 exercised the reason preferences this removes, and C2 passed through the Favorites reason. #1234 C1 and the two mobile C1 cases now also cover a new delivery type,
watchlist.available, and #1234 C4 serves its content.Approach
Next Up episodes. An episode notifies a profile only when it is the first episode the catalog lists at or after the profile's cursor. The cursor starts after the episode the profile finished most recently, the anchor Home's Next Up uses, and moves past every episode the profile has already started. Fanout checks the catalog when it runs, with one lookup per release event.
Removed reasons. Favorites, the watchlist and Continue Watching no longer notify for episodes. Their switches are gone from profile preferences, personal webhooks, the notified-series list,
/api/v2and the web settings. Removing fields from/api/v2is allowed before the 1.0 lock; the breaking-change approvals are in this PR. The notified-series list now says whether each series would notify now or only after the profile catches up.Burst cap removed.
notifications.fanout.max_series_burstkept the highest few episodes of a series per batch, which would drop the one episode that is next. The setting and its admin field are gone.Watchlist arrivals. A fresh movie, or a series arriving with its first episodes, tells the profiles whose watchlist held the title before the library had it, with a
watchlist.availabledelivery. It skips profiles with notifications off, profiles that can't open the item, and profiles a request has told or will tell, so nobody hears twice. Matching uses the same provider-ID resolution as watchlist promotion. Promotion runs when a profile reads its watchlist and can move the entry before fanout runs, so promotion now records the move in a small table that fanout reads. That also covers accounts on the SQLite user store, which #2888 missed. Webhooks carry the delivery under their request switch, labeled "Requests and watchlist" in the web app, and the generic payload names the title in a newwatchlistblock.Schema. One migration drops the nine retired columns and the burst setting, and clears last notified marks that lie beyond the awaited episode. Two more add a unique index for
watchlist.availabledeliveries, built concurrently, and the promotion table.Server channels are unchanged; they are not per profile. jellycompat has no notification surface. The manual follow-up is Silo-Server/siloserver.org#277.
Validation
go build ./...,go vetand the tests of the touched packages pass.make lint-changedreports 0 issues.verify-apiv2-openapi,verify-apiv2-contract(with the approvals in this PR),verify-apiv2-fixtures,verify-migrationsandverify-local-pathspass.verify-route-inventorywas not run locally; it fails to build on the development Mac, so CI is its check.make test-db-contractspassed on that database, 771 pins, none skipped, before the review fixes; after them the notifications, watchlist, requests and backup packages pass on a fresh Postgres 18, and CI runs the full set. They cover the fanout rule (batch drop, a profile that is behind, a finished season, a listed episode without a file), the cursor (rewatch, imported history, partly watched, history-hidden progress, Home removals), the notified-series list, and watchlist arrivals (dedupe against requests and earlier notices, preferences, access, entries promoted before fanout on either user store, entries added after the arrival).main, then rebuilt it from this branch over the same database. Onmain, an episode that arrived ahead of the awaited one notified, and so did a new episode of a favorited series. After the rebuild the three migrations had applied in 29 ms, the favorite-only interest row was gone and the Next Up row was kept. On the branch, a new episode of the favorited series, a later episode with earlier ones unwatched, and an episode ahead of the awaited one all stayed silent. The awaited episode then notified, and a watchlisted movie arriving sent onewatchlist.available. Arrivals were recorded as release events the way a scan records them, because the sandbox's media is read-only, and the watchlist entry and the arrived movie were written to the database, because the sandbox has requests turned off.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4409/
The page has before and after captures of the four changed pages at desktop and phone width, the same pages under
en-XA, the sandbox run, and the test, migration and contract results.Visible changes in the web app:
Risks
docs/architecture/notifications.mdhas the procedure under "Upgrade".notify_favorites,notify_watchlistornotify_continue_watchingwhen those switches are flipped, and/api/v2now rejects them with 422 until feat(notifications): drop removed notification toggles and show watchlist.available silo-android#662 ships. Reading preferences is unaffected.docs/architecture/notifications.mdsays how to close this.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Notify only for the Next Up episode and watchlist arrivals
max_series_burst) is removed.watchlist.availabledeliveries: when a catalog title on a profile's watchlist arrives, fanout notifies waiting profiles once, backed by a newwatchlist_title_promotionstable.RecomputeSeriespath builds the Next Up anchor and cursor from completed episodes and started progress.notify_favorites,notify_watchlist, andnotify_continue_watchingfrom the API, webhooks, preferences, and the web UI. Backups still accept the retired keys on import but ignore them; exports omit them.last_notified_episode_keymarks, and drops the retired columns — a rollback restores the columns but not the deleted data. Clients sending the retired preference fields now receive a 422.Macroscope summarized 9a68610.