Skip to content

refactor(notifications): fix the processing settings in code - #4596

Merged
Quick104 merged 6 commits into
mainfrom
refactor/notifications-processing-settings-cleanup
Nov 20, 2026
Merged

Quick104 merged 6 commits into
mainfrom
refactor/notifications-processing-settings-cleanup

Conversation

@Quick104

@Quick104 Quick104 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none changed. #1234 C1 (delivery through every channel) runs through this code; delivery behaves the same.

Other clients: Apple N/A (no admin settings screen); Android N/A (no admin settings screen); Roku N/A (no admin settings screen)

The admin Notifications page has a Processing section with seven settings nobody needs to tune: switches that stop recording new content and stop matching it to people, the fanout settle window, the 72-hour content age limit, and the read, unread, and sent-history retention windows. An admin who turns a switch off silently stops every notification channel. This change fixes all seven in code at their current values, removes the section and its "paused" banner, and deletes any stored values. A server that had switched notifications off will start notifying again after upgrading.

This is the processing-settings part of #2884, split out and redone on current main. #2884's push cooldown is not ported: the Next Up rule from #4409 replaced it.

Approach

  • The settings become constants in internal/notifications. A Goose migration deletes their server_settings rows. The admin defaults, the per-key validation, and the backup restore guard drop the keys, and a selective restore from an older backup skips them.
  • The 30-second fanout settle delay stays, fixed in code. fix(notifications): push a season drop once and fix webhook delivery bugs #2884 removed it because it only batched events for the old per-series burst cap. Since feat(notifications)!: notify only for the next episode and wanted titles #4409 the Next Up rule depends on it too: it reads which episodes the catalog lists when fanout runs. If E07 arrives first, the delay gives the catalog time to list E06. E07 stays silent if the catalog lists E06 when fanout evaluates E07. If E06 is still unlisted then, E07 can notify even if E06’s file has already arrived.
  • The web page loses the Processing section, its banner, and their search entries. The page summary now reads "Delivery channels and server channels." fix(catalog): remove the notification Processing settings text silo-translations#104 removed the unused keys, and the branch is pinned to its release.
  • The notification docs now match the code in four places: the webhook HMAC key is the signing secret string as returned, the generic payload carries library_id, an invalid relay_url is a 400, and webhook update accepts If-Match: *.

Not included: #2884's claim tie-break by episode, which the Next Up rule makes unnecessary (one ingest commits all its events together, so a lower episode is always listed before a higher one is evaluated), and its shared channel-outbox refactor, which is a separate concern.

Validation

  • Go: build, gofmt, go mod tidy -diff, go vet, make lint-changed (0 issues), and make lint-router-recovery pass.
  • internal/notifications, internal/backup and internal/config tests pass against a scratch Postgres migrated from this branch.
  • Web: lint, format check, build, bundle budget, and the admin-settings and search vitest suites pass.
  • Settings bindings, route inventory, OpenAPI, web types, the v2 contract comparison, local paths, case collisions, size ratchet, bidi, and migrations checks pass.
  • Not run locally: the full make test-go and make test-web, make verify-actionlint, make verify-shellcheck, make verify-prometheus-rules, playback fixtures, and v2 fixtures. CI runs them; this change touches no workflow, shell script, playback, or API contract.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-4596/

On an isolated test server, first built from main with notifications switched off and read retention set to 45 days: the page showed the "Sending is paused" banner and the Processing section. After rebuilding from this branch, the migration removed both stored values, and the page has no banner and no Processing section, on desktop and phone widths. The browser console showed no errors either way.

On PostgreSQL 18 at 541a02a3d8, a database upgrade from main with fanout paused and a seven-day event window left two queued episode events for the worker. The 71-hour-old event produced one inbox delivery. The 73-hour-old event was marked stale and produced none.

Risks

  • Upgrading resumes both recording and processing. If a server kept recording release events while fanout was paused, already queued events up to 72 hours old can generate notifications for eligible recipients through enabled channels. Events never recorded while capture was off are not replayed.
  • The 72-hour limit applies to the existing queue, including servers that previously allowed a longer window. Fanout suppresses older queued episode events without creating an inbox delivery. This cutoff uses the time the event was recorded.
  • At the next daily retention run, servers that previously kept inbox notifications longer lose read notifications older than 90 days and unread notifications older than 180 days. Include these upgrade effects in the release notes. The user manual issue is docs: notification Processing settings are gone siloserver.org#276.
  • The migration only deletes rows. Its Down step restores nothing, and the defaults apply either way.

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, running in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated at the maintainer's direction; maintainer review pending
  • Adversarial review: gpt-6.2-sol (Codex), reviewed 256c139, four findings. Fixed: selective restore no longer offers the retired keys, the relay_url status doc, and the optional library_id doc. Answered: the plugin task help text comes from the catalog release ahead of feat(plugins): apply plugin task bindings and lifecycle changes live #3611, not from this change.

🤖 Generated with Claude Code

Note

Remove configurable notification processing settings and fix values in code

  • Notification processing and retention settings are no longer configurable. Fixed values replace them: 30-second fanout settle delay, 72-hour stale-event cutoff (maxReleaseEventAge), and 90/180/30-day retention for read, unread, and release-event records in system_retention.go and fanout_worker.go
  • Removes the FanoutEnabled and ReleaseEventsEnabled switches: FanoutWorker.Run now always processes, and AvailabilityDetector.runKind no longer checks a release-events setting in availability_detector.go
  • Adds a migration that deletes the seven retired setting rows from server_settings (remove_notification_processing_settings.sql), and RestorableSetting rejects these keys during backup restore in restore_settings.go
  • Removes the Processing settings group, paused-pipeline message, and related search terms from the admin UI (NotificationsAdminSettings.tsx) and drops the corresponding translations from all locale catalogs
  • Behavioral Change: fanout and release-event recording are always on; the Down migration does not restore deleted setting rows; stale events are cut off at a fixed 72 hours regardless of prior configuration

Macroscope summarized 541a02a.

The Processing section of the admin Notifications page exposed settings
with working defaults that nobody needs to tune: the two pipeline kill
switches, the fanout settle window, the 72-hour staleness horizon, and
the read, unread, and release-event retention windows. They become
constants at their current values, the section and its paused banner go
away, and a migration deletes any stored values. A server that had
switched the pipeline off will notify again.

The 30-second settle delay stays: the Next Up rule reads which episodes
the catalog lists when fanout runs, and the delay keeps files imported
one at a time close together in episode order.

The notification docs also now match the code on webhook HMAC keys, the
generic payload's library_id, relay_url validation, and If-Match: * on
webhook update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Notification processing settings were removed from configuration, persistence, and the admin interface. Notification workers now use fixed settle, stale-event, and retention windows. Documentation and translation catalogs were updated to reflect these changes and related notification API details.

Changes: Notification settings and runtime

Layer / File(s) Summary
Retire configurable processing settings
internal/backup/*, internal/config/admin_settings.go, internal/notifications/settings.go, internal/backup/settings_access.go, migrations/sql/20261119184931_remove_notification_processing_settings.sql
The seven processing settings are removed from defaults, normalization, access classifications, and selective restore. The migration deletes their stored rows. The backup test now checks that notifications.ui_enabled retains the stricter live value.
Use fixed notification timing and retention
internal/notifications/availability_detector.go, internal/notifications/fanout_worker.go, internal/notifications/release_types.go, internal/notifications/server_channel_worker.go, internal/notifications/system.go, internal/notifications/system_retention.go, internal/notifications/recipient_access_db_test.go
The availability detector uses seeded state to decide whether to emit events. Fanout uses a fixed 30-second settle delay and fixed stale-event age. Retention uses fixed windows of 90 days for read deliveries, 180 days for unread deliveries, and 30 days for processed events.
Remove processing controls from the admin interface
web/src/pages/admin-settings/NotificationsAdminSettings.tsx, web/src/lib/adminSettingsSearch.ts, web/src/locales/*.json, web/src/locales/keys.ts, .silo-translations
The admin page and its search registry no longer expose notification processing controls. Locale catalogs and generated translation keys remove the related labels and descriptions. The translation version and checksum are updated.
Update notification documentation
docs/architecture/notifications.md, docs/notifications-api.md
The documentation describes fixed timing and retention, updated webhook payload and signing details, relay error outcomes, and If-Match: * behavior for existing webhook rows.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: Low · up to f9911

The notification documentation slightly overstates what the 30-second settle delay guarantees. This is a small wording fix, and no functional problem remains in the change.

Architecture risk: Low · up to f9911

The change affects 4 systems.

Changed systems: web, internal, docs, migrations

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — web (service) was modified; 44 changed files map to changed impact.
  • observed — internal (service) was modified; 12 changed files map to changed impact.
  • observed — docs (service) was modified; 2 changed files map to changed impact.
  • observed — migrations (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in docs/architecture/notifications.md: The documentation now describes released_at as set for a seeded-library release recorded within the window, omitting the prior statement that it is set even when release events are turned off.
  • observed — Modified behavior in docs/architecture/notifications.md: The documented stale-event suppression horizon is now explicitly 72 hours; the previous text described extended downtime or disabled fanout without specifying a duration.
  • observed — Modified behavior in docs/architecture/notifications.md: The documentation replaces a configurable settle delay, with a 30-second default, with a fixed 30-second delay. It adds that episodes imported separately within that window are listed before evaluation, allowing the earlier listed episode to notify even when it arrives after another episode.
  • observed — Modified behavior in docs/architecture/notifications.md: The documentation adds daily retention windows: 90 days for read deliveries, 180 days for unread deliveries, 30 days for processed release events, and deletion of unprocessed events past the 72-hour staleness horizon.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "refactor(notifications): fix the processing settings in code" matches the main change: the seven notification processing settings are turned into fixed code constants, removed from admin se…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is related to the changeset. It explains removing the Processing section of the admin Notifications page, fixing seven notification processing settings in code (30-second settle delay,…
Full details: Title check

Explanation

The title "refactor(notifications): fix the processing settings in code" matches the main change: the seven notification processing settings are turned into fixed code constants, removed from admin settings, and dropped from the database via migration. It is specific, though the word "fix" is slightly ambiguous since the change is not a bug fix.

Full details: Description check

Explanation

The description is related to the changeset. It explains removing the Processing section of the admin Notifications page, fixing seven notification processing settings in code (30-second settle delay, 72-hour stale-event cutoff, 90/180/30-day retention), adding a migration that deletes the stored rows, and updating notification docs. It also gives validation steps and risks. The description is specific and on-topic, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T23:44:56.891711Z f9911e7 New commits
🔒 Security Review ✅ Completed 2026-11-19T23:47:46.217927Z f9911e7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-kody

silo-kody Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added the priority: P2 Limited scope, workaround exists, or polish label Nov 19, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (gpt-6.2-sol, reviewed 256c139)

Comment thread web/src/locales/en.json Resolved
Comment thread docs/notifications-api.md Resolved
Comment thread docs/architecture/notifications.md Resolved
A backup from before the processing settings were fixed in code still
holds their rows, and the catch-all notifications. classification offered
them for restore. Selective restore now skips the seven retired keys.

The notification docs also say that a malformed relay_url is a 422 and a
rejected relay origin a 400, and that request notifications leave out
library_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

…s-processing-settings-cleanup

# Conflicts:
#	.silo-translations
#	web/src/locales/keys.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 627d8a12-f08a-4404-ae7e-1258652c936f
Commits

Reviewing files that changed from the base of the PR and between 4eb4d4a and f9911e7.

Files selected for processing: 60

  • .silo-translations
  • docs/architecture/notifications.md
  • docs/notifications-api.md
  • internal/backup/backup_postgres_test.go
  • internal/backup/restore_settings.go
  • internal/backup/settings_access.go
  • internal/config/admin_settings.go
  • internal/notifications/availability_detector.go
  • internal/notifications/fanout_worker.go
  • internal/notifications/recipient_access_db_test.go
  • internal/notifications/release_types.go
  • internal/notifications/server_channel_worker.go
  • internal/notifications/settings.go
  • internal/notifications/system.go
  • internal/notifications/system_retention.go
  • migrations/sql/20261119184931_remove_notification_processing_settings.sql
  • web/src/lib/adminSettingsSearch.ts
  • web/src/locales/ar-XB.json
  • web/src/locales/ar.json
  • web/src/locales/bg.json
  • web/src/locales/ca.json
  • web/src/locales/cs.json
  • web/src/locales/da.json
  • web/src/locales/de.json
  • web/src/locales/el.json
  • web/src/locales/en-XA.json
  • web/src/locales/en.json
  • web/src/locales/es.json
  • web/src/locales/et.json
  • web/src/locales/fi.json
  • web/src/locales/fr.json
  • web/src/locales/he.json
  • web/src/locales/hi.json
  • web/src/locales/hr.json
  • web/src/locales/hu.json
  • web/src/locales/id.json
  • web/src/locales/it.json
  • web/src/locales/ja.json
  • web/src/locales/keys.ts
  • web/src/locales/ko.json
  • web/src/locales/lt.json
  • web/src/locales/lv.json
  • web/src/locales/ms.json
  • web/src/locales/nb.json
  • web/src/locales/nl.json
  • web/src/locales/pl.json
  • web/src/locales/pt-BR.json
  • web/src/locales/pt-PT.json
  • web/src/locales/ro.json
  • web/src/locales/ru.json
  • web/src/locales/sk.json
  • web/src/locales/sl.json
  • web/src/locales/sv.json
  • web/src/locales/th.json
  • web/src/locales/tr.json
  • web/src/locales/uk.json
  • web/src/locales/vi.json
  • web/src/locales/zh-Hans.json
  • web/src/locales/zh-Hant.json
  • web/src/pages/admin-settings/NotificationsAdminSettings.tsx
Files with no reviewable changes: 3

  • internal/backup/settings_access.go
  • web/src/lib/adminSettingsSearch.ts
  • web/src/pages/admin-settings/NotificationsAdminSettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment thread docs/architecture/notifications.md Resolved
@silo-kody

This comment has been minimized.

@Quick104

Copy link
Copy Markdown
Contributor Author

@kody review

Please retry the review of 541a02a. The previous run reported one comment that it could not post.

🤖 Codex (gpt-6.2-astra)

@Quick104

Copy link
Copy Markdown
Contributor Author

@kody review --force

The previous run could not post its finding. The incremental retry skipped this commit because no files had changed. Please run a fresh review of 541a02a.

🤖 Codex (gpt-6.2-astra)

@silo-kody

silo-kody Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/notifications/fanout_worker.go Resolved
Comment thread internal/notifications/fanout_worker.go Resolved
@Quick104
Quick104 merged commit f42b932 into main Nov 20, 2026
55 of 57 checks passed
@Quick104
Quick104 deleted the refactor/notifications-processing-settings-cleanup branch November 20, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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