Skip to content

feat(notifications)!: notify only for the next episode and wanted titles - #4409

Merged
Quick104 merged 17 commits into
mainfrom
feat/notify-next-up-only
Nov 17, 2026
Merged

Quick104 merged 17 commits into
mainfrom
feat/notify-next-up-only

Conversation

@Quick104

@Quick104 Quick104 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • E06, E07 and E08 arriving together send one notification, for E06. A season pack needs no cap.
  • Nothing more notifies until the profile watches on.
  • After a season finale, the next season's premiere notifies.
  • An episode the catalog lists but the library has no file for holds its place. E07 arriving before E06 stays silent, and E06 notifies when it arrives.
  • A profile rewatching an early season is still told about a new season, because the cursor sits after the last episode it started.
  • Nothing notifies while an episode of the series is partly watched and newer than the last finished one, as on Home.
  • A profile whose completions exist only as imported watch history gets no Next Up card on Home, but it does get notifications, from its highest completed episode.

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/v2 and the web settings. Removing fields from /api/v2 is 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_burst kept 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.available delivery. 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 new watchlist block.

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.available deliveries, 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: go build ./..., go vet and the tests of the touched packages pass. make lint-changed reports 0 issues.
  • Contracts and hygiene: the OpenAPI file is regenerated. verify-apiv2-openapi, verify-apiv2-contract (with the approvals in this PR), verify-apiv2-fixtures, verify-migrations and verify-local-paths pass. verify-route-inventory was not run locally; it fails to build on the development Mac, so CI is its check.
  • Migrations, on a scratch Postgres 18 with pgvector: the three migrations apply to an empty database, roll back, and apply again over rows written in the old shape. An interest row kept only by a favorite is deleted, a Next Up row survives, a last notified mark that lies beyond the awaited episode is cleared, while one on a season premiere after a finished finale is kept, and the nine columns and the burst setting are gone.
  • Database tests: make test-db-contracts passed 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).
  • Web: typecheck passes, and the tests for the notification inbox, page, queries and API client pass (4 files, 36 tests). The full web suite was not run locally.
  • Sandbox: I built a sandbox from main, then rebuilt it from this branch over the same database. On main, 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 one watchlist.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.
  • Not observed: push, email, Discord and webhook delivery. The sandbox has those channels off, so their rendering is covered by unit tests only.

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:

  • Settings → Notifications shows the master switch and Next Up only. The description says a profile is told when a new episode arrives for a series it is caught up on, or when a title it watchlisted or requested arrives.
  • The Notifications page's Series view has no reason tabs or "Why" column. A caught-up series reads "The next episode after S1E10"; a series with an episode waiting reads "After you catch up".
  • The inbox and toast show a watchlist arrival as the title with "A movie on your watchlist is now available" (or series, or title).
  • The webhook editor's request switch reads "Requests and watchlist".
  • Admin → Notifications no longer has "Max messages per show".

Risks

  • Maintenance-window upgrade. The migration drops columns that older binaries read and write. Stop every old API replica before migrating; a rolling deployment is unsafe. Release notes need to say so. docs/architecture/notifications.md has the procedure under "Upgrade".
  • Android switches. The current Android app sends notify_favorites, notify_watchlist or notify_continue_watching when those switches are flipped, and /api/v2 now rejects them with 422 until feat(notifications): drop removed notification toggles and show watchlist.available silo-android#662 ships. Reading preferences is unaffected.
  • A listed episode that never arrives keeps its series silent for a profile waiting on it, until the profile watches a later episode.
  • Existing interest rows keep their old cursor (last completed episode + 1) until the daily interest rebuild or the profile's next activity recomputes them. For a caught-up profile that cursor already behaves correctly. The migration clears a last notified mark when the catalog lists an episode between the cursor and the mark, so an episode the profile still waits for is not silenced by a later one the old rules announced.
  • Titles imported by a catalog seed get no watchlist notice when their file arrives more than 72 hours after the import: arrival is judged by when the catalog row was created. docs/architecture/notifications.md says how to close this.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code, GitHub CLI
  • Model(s): claude-fable-5-2, claude-opus-5-5
  • Involvement: Fully AI-generated from a maintainer-agreed spec; human review pending
  • Adversarial review: n/a

🤖 Generated with Claude Code

Note

Notify only for the Next Up episode and watchlist arrivals

  • Episode notifications now use a Next Up cursor: a profile is notified only for the first listed episode at or after their cursor, replacing favorite, watchlist, and Continue Watching reasons. The per-series burst cap (max_series_burst) is removed.
  • Adds watchlist.available deliveries: when a catalog title on a profile's watchlist arrives, fanout notifies waiting profiles once, backed by a new watchlist_title_promotions table.
  • Interest rows are recomputed from watch progress and history only; favorites and watchlist membership no longer mark series for notification. The RecomputeSeries path builds the Next Up anchor and cursor from completed episodes and started progress.
  • Removes notify_favorites, notify_watchlist, and notify_continue_watching from the API, webhooks, preferences, and the web UI. Backups still accept the retired keys on import but ignore them; exports omit them.
  • Risk: the migration 20261116231355_drop_retired_notification_reasons.sql deletes interest rows with no Next Up candidacy or completion mark, clears some last_notified_episode_key marks, 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.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request impact: compat Breaks a supported client or server path maintenance-window Migration rewrites large tables or holds long locks; needs downtime and a verified backup priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant