Aller au contenu
GitHub

Notifications

Unaudited

Ce contenu n’est pas encore disponible dans votre langue.

This doc owns alert delivery and the vocabulary. The server holds only ciphertext, and the short-poll sync feed stays the fallback for any push (Network Resilience — Adverse-Network Posture), so a server can tell a client that something changed, never what.

Term Direction Carries Owner
Alert device → its own user Localized text composed on-device This doc
Wake server → client Nothing: “something changed for you” This doc
Hint server ↔ server, peer ↔ peer “A new event exists in album A”; advisory, no authority Federation — Pull-Only Federation, Peering — Sync

Alert classes and trigger predicates live in capsule-core::notify, one decision function for every platform; delivery is native per client. Open:

  • the Apple mock lane arms into an in-memory scheduler rather than UNUserNotificationCenter until the Rust-backed adapter is composed;
  • the Android app has no flow yet that records the facts the predicate reads;
  • the pre-armed delivery smoke has not run on a device.

This is all of v1.

No alert text ever originates from a server. Clients render copy from their own catalogs, keyed by a class decided locally.

A closed enum. Thresholds belong to the trigger owner, and parameters are plain values interpolated into catalog strings, never text.

Class Trigger owner Parameters Pre-armable
sync_stale Sync — Notifications count, days_behind Yes
recovery_check_due Backup and Recovery — Schedule and Triggers snooze_budget (available/spent), recovery (check/rewrap) Yes
quota_soft / quota_grace_expiring Quota — Thresholds and States grace (counting/expired), second only No
quarantine_pending Damage Scenarios and Quarantine — Quarantine Surfaces count No
drop_pending Web Upload — Drop and Adoption Lifecycle count No
recovery_claim Backup and Recovery — Opt-in: Trusted-Contact Recovery days_left No
album_activity MLS Group Membership — Comments and Reactions count, kind (comment/reaction) No
drop_sensitive (Planned) AI/ML Integrations — Sensitive Content count (flagged drops not yet reviewed) No

An alert whose trigger is a deadline the device can compute MUST be pre-armed as a scheduled local notification when the deadline becomes known, and MUST be re-armed or cancelled on every state change that moves it.

sync_stale reports that the OS gave the app no background time, so it cannot rely on background time. It is armed for two weeks after each successful sync and fires from the OS timer.

Server-side conditions (quota_*, quarantine_pending, drop_pending) cannot be pre-armed and surface at next launch; Tier 1 — Wake is what would close that gap.

The client loop is one idempotent refresh, run after every state change: read the facts, take the badge set from evaluate_alerts and the per-class instants from pre_arm_deadlines, then reconcile the OS timers against them.

  • One timer per present class, at its instant; a moved instant or changed copy cancels and re-arms it. An absent class holds none.
  • next_alert_deadline is never the client’s input. It is the minimum, and arming only it loses the later class’s alarm.
  • The armed copy is fixed at arm time, because the alarm fires with the app not running. sync_stale carries the current un-synced count and the days to its deadline, and recovery_check_due its recovery split.
  • A tap on recovery = rewrap opens the guided re-wrap, never the routine verification prompt.
Platform API Fires with app not running
iOS UNUserNotificationCenter (calendar triggers at an absolute UTC instant, one request identifier per class) Yes
Android NotificationManager from an AlarmManager.setAndAllowWhileIdle alarm, one PendingIntent per class, re-armed after reboot Yes
Desktop Native OS notifications While running
Web Service-worker Notification Best-effort
CLI Exit codes and stderr n/a

Permission is requested the first time a class has something to say, never at first launch: the first refresh that has a timer to arm asks, once. Android alarms are inexact on purpose. A two-week or ninety-day deadline needs no minute precision, an inexact alarm fires late but never early (so its alert is still true on arrival), and an exact one would need the SCHEDULE_EXACT_ALARM special-access grant.

  • Snooze is bounded, then becomes a badge that never escalates back to an alert. A snooze lasts a day and defers the class’s timer to its end. After three consecutive snoozes the class is badge-only until its condition clears, which restores the budget. The recovery check is snoozed by its own cadence scheduler, which owns that budget.
  • Disabling suppresses the warning, never the behavior it reports on.
  • No alert ever blocks any flow.
  • Permission denial is not an error. Every class degrades to its in-app badge, with no retry and no nag.
  • Copy is a catalog key under notification.* in locales/ (Internationalization): notification.<class>.title / .body. An enumerated parameter selects the key (notification.recovery_check_due.rewrap.*, notification.quota_grace_expiring.expired.*), because the catalog compiles only a whole-message plural, and a count is that plural’s quantity.

Post-v1, opt-in, off by default.

No album, actor, asset, count or timestamp. The client answers with its ordinary poll (/v1/sync, /v1/quota, /v1/drops) and composes any alert locally.

Every client MUST reach the same state with wake permanently unavailable; only timeliness degrades.

A wake transport MUST require no credential that the operator cannot generate themselves.

So no APNs or FCM (bound to the published app), and no project relay.

Transport Credential Platforms
Web Push (RFC 8030) + VAPID (RFC 8292) Operator-generated keypair Web, desktop
UnifiedPush A distributor the user chooses Android, desktop
none (default) — All

iOS has no wake tier, permanently, so events from other actors surface at next launch.

  • Opt-in per device, revocable. The endpoint is opaque bytes on the device row, cleared when the device’s session is revoked.
  • Coalesced and rate-capped. The server coalesces behind a floor interval; a client ignores wakes above a rate and falls back to its schedule.
  • Jittered so wake timing is not a clean activity side-channel.

Server-composed or rich notifications; APNs, FCM or relays; comment and reaction alerts composed or relayed by a server (a device raises album_activity only after it has synced the activity itself); email; presence.

Tiers per Core Principles — Validation Tiers.

  • Trigger predicates (unit): each class fires exactly at its threshold.
  • Pre-arm lifecycle (unit): arm, re-arm, cancel; never two timers per class.
  • Snooze, disable, denial (unit): each degrades to a badge and changes no behavior.
  • Pre-armed delivery (smoke, per platform): fires with the app terminated, and its tap opens the class’s destination: a recovery = rewrap alert opens the guided re-wrap, never the routine check. On Android the alarm also survives a reboot. Run by hand on a device or simulator, because no harness can terminate the app and wait out an OS timer.
  • Wake contentlessness (unit, post-v1): no library-derived field; response identical to the scheduled poll.