Files
StarPunk/docs/design/v2.14.0/2026-11-10-notifications.md
T
2026-11-10 14:30:01 -07:00

1.9 KiB

v2.14.0: Notifications (implementation report)

Implements ADR-074.

What changed

  • starpunk/notifications.py (new): settings (urls, events, with_priority), send (Apprise, Markdown, 15 s timeout, never raises, errors captured with apprise.LogCapture), problem, and Sweeper, which sends due responses, groups likes/reposts/bookmarks per note, marks notified_at, backs off after a failure (10 s doubling to 15 min), drops responses older than 24 hours, and records the last error in site_state.notify_last_error.
  • migrations/021_notifications.sql: webmentions.notified_at, set on all existing rows.
  • webmention_worker.py: runs the sweep each pass (one process holds the worker lock).
  • backfeed.py: store(..., quiet=True) inserts new rows as notified; check() is quiet for backfill checks and a copy's first check of a note older than a day. A refused credential sends a problems message.
  • syndication.py: _fail sends a problems message when it gives up.
  • Admin Webmentions page: status (events, services, priority, last error) and Send test notification (POST /admin/notifications/test).
  • Settings NOTIFY_URLS, NOTIFY_EVENTS, NOTIFY_PRIORITY; dependency apprise==2.2.*.

Verification

  • tests/test_notifications.py (11 tests): settings parsing and priority injection; one message per reply/mention, likes grouped, unselected types marked, pending moderation linked to the admin; nothing sent twice; failure backoff and retry, last error set and cleared; 24-hour drop; off without URLs; quiet backfill and late first checks; problems (selected or not) and the final crosspost failure; admin status and test button; a real Apprise send (json://) to a local server; migration 021.
  • Webmention, syndication, backfeed, admin and migration tests pass.
  • Apprise 2.2.0 installs and imports on Python 3.14.
  • Production Gotify (3.1.1) accepted a message with the StarPunk app token.