Client notifications and realtime updates
The React client turns alert events into one notification experience across browser, desktop, and mobile shells. It keeps alert choices separate from notification history, receives live or recovered events, and presents accepted alerts in the app or through the operating system.
Notification state
Notification state has two roles. Preference state controls which alerts can notify the user, while center state records alerts that the user can review. This separation keeps useful history available when system delivery is off.
Notification preferences
Notification preferences control alert kinds, provider sources, and pipeline-specific rules. The available alert kinds cover failed runs, degraded workloads, slow runs, stuck queues, provider outages, and recoveries. The stuck-queue rule uses a shared queue limit in minutes. Users can change these choices from settings while the client presents the same choices in desktop and mobile layouts (src/…/NotificationPreferencesSection.tsx• L16-21, src/…/PreferenceSwitches.tsx• L11-18).
Pipeline rules are mutually exclusive. A pipeline can follow general settings, notify once when its current or next run finishes, watch every run, or mute its notifications. A new rule replaces the current rule, and a one-time watch returns to the normal policy after it fires. The watch-all choice can notify even when the pipeline's provider is muted. Users can change these choices from a pipeline menu, a pipeline dialog, the settings page, or a notification detail view (src/…/PipelineNotifyMenu.tsx• L17-57, src/…/PipelineNotifyPolicy.tsx• L14-74, src/…/useNotifyItems.tsx• L94-137, src/…/useNotificationDetailActions.tsx• L75-95).
The missed-run rule is separate from finish alerts. It is available after the client learns the pipeline's usual run gap, and it sends one notice when the pipeline passes about twice that gap without a run. An enabled rule remains available so the user can turn it off even if the current pipeline data no longer includes a learned cadence (src/…/useNotifyItems.tsx• L140-165, src/…/PipelineNotifyMenu.tsx• L47-56, src/…/PipelineNotifyPolicy.tsx• L51-74).
The client stores preferences per device or browser. In a native remote session, it also syncs them with the connected host. That sync carries fired one-time watches so a reconnect does not repeat them (src/…/NotificationPreferencesSection.tsx• L52-99, src/…/changePreference.ts• L17-47).
Preference changes are sent in order. Each change uses the latest saved snapshot before the next change runs, which prevents quick edits from overwriting one another (src/…/changePreference.ts• L8-31, src/…/PreferenceSwitches.tsx• L20-31).
The queue limit is part of general host settings rather than device-only notification preferences. The settings view reads the host value, shows a default of 15 minutes until the value loads, and saves a changed value when the user leaves the field or presses Enter. It preserves the other general settings in the update and shows a retry state when the host setting cannot load (src/…/QueueLimitInput.tsx• L8-49, src/…/useGeneralSettingsQueries.ts• L8-24).
References: src/…/notificationStore.ts• L13-27 src/…/NotificationPreferencesSection.tsx• L52-99 src/…/PreferenceSwitches.tsx• L11-91 src/…/QueueLimitInput.tsx• L8-49 src/…/changePreference.ts• L8-47 src/…/useNotifyItems.tsx• L84-165 src/…/PipelineNotifyMenu.tsx• L17-57 src/…/PipelineNotifyPolicy.tsx• L14-74 src/…/useNotificationDetailActions.tsx• L50-109 src/…/useGeneralSettingsQueries.ts• L8-24
Notification center
The notification center is the in-app record of alert notices. A notice has a stable key, time, tone, related provider or pipeline, and an optional external link. The center applies changes through a serialized snapshot update, so concurrent pushes and read actions use the newest state (src/…/notificationCenterStore.ts• L7-38, src/…/notificationCenterStore.test.ts• L53-71).
The bell center and full Notifications page use the same notice model. They show providers that currently affect pipelines before recent notices, expose unread state, and support opening, reading, and clearing notices. The mobile shell groups notices by day and uses native-style rows (src/…/NotificationCenter.tsx• L145-216, src/…/NotificationsPage.tsx• L49-130).
Opening a notice marks it read and can lead to run history, run details, provider status, or an external incident page. When the notice has a related pipeline or provider, its detail view also offers the matching watch or mute action (src/…/notificationCenterStore.ts• L75-82, src/…/NotificationDetailsModal.tsx• L100-125, src/…/useNotificationDetailActions.tsx• L50-109).
References: src/…/notificationCenterStore.ts• L7-38 src/…/notificationCenterStore.ts• L59-82 src/…/notificationCenterStore.test.ts• L63-90 src/…/NotificationCenter.tsx• L145-216 src/…/NotificationCenterItem.tsx• L63-92 src/…/NotificationListItem.tsx• L16-51 src/…/NotificationsPage.tsx• L49-130 src/…/NotificationDetailsModal.tsx• L100-125 src/…/useNotificationDetailActions.tsx• L50-109
Realtime event flow
The client accepts notification events through a shared presentation path even though platforms use different transports. Browser and mobile web views consume live service events, while the desktop app treats native history and delivery as the source of truth. Missed alerts enter the same user-facing center as live alerts when the platform uses the client store.
The diagram shows how a service or host event becomes app history and, when permitted, a system notice.
flowchart LR
S[Connected service or local core] --> A[Platform event path]
A --> P[Apply notification rules]
P -->|accepted| H[Client presentation path]
P -->|filtered| X[No client notice]
H --> C[In-app notification center]
H --> Q{System delivery allowed?}
Q -->|yes| N[Browser or native system notice]
Q -->|no| I[In-app history only]
A --> D[Desktop native history]
WebSocket updates
The browser WebSocket connects with the current session and reconnects after a disconnect. It remembers the last notification ID and sends that value with the next preference exchange, so the service can return alerts that arrived during the gap (src/…/websocket.ts• L39-58, src/…/websocket.ts• L127-171, src/…/websocket.ts• L281-293).
The notification event hook turns accepted frames into center notices and records fired one-time watches. Desktop Tauri does not use this browser presentation path for its own events; native desktop history and delivery handle them instead (src/…/useNotificationEvents.ts• L12-71, src/…/notificationDesktopScenarios.ts• L222-245).
References: src/…/websocket.ts• L39-58 src/…/websocket.ts• L127-175 src/…/websocket.ts• L213-250 src/…/websocket.ts• L281-317 src/…/useNotificationEvents.ts• L12-71 src/…/notificationDesktopScenarios.ts• L222-255
Missed alert recovery
Remote clients recover alerts saved while they were away from the live stream. The recovery path inserts them into the same center used for live notices, so the user sees one history regardless of whether the alert arrived live or after a reconnect (src/…/useMissedAlerts.ts• L10-69).
References: src/…/useMissedAlerts.ts• L10-69 src/…/mobile.ts• L63-80
Native event admission
Native clients apply local notification rules before events reach the React presentation layer. Desktop-native events update native history and system delivery without passing through the browser center, which avoids duplicate desktop notices (crates/…/tauri_event_bus.rs• L35-101, src/…/notificationDesktopScenarios.ts• L206-230).
References: crates/…/tauri_event_bus.rs• L17-57 crates/…/tauri_event_bus.rs• L63-101 src/…/notificationDesktopScenarios.ts• L206-245
Platform notification delivery
System delivery is an optional second presentation path. The client checks platform support and permission before sending an alert outside the app, while the in-app center remains available when delivery is disabled or blocked.
Browser and native system notices
Browser notices require a supported secure context and granted browser permission. Native notices use the desktop or mobile notification bridge and include a target so a click can return to the related notice or pipeline (src/…/systemNotifications.ts• L13-21, src/…/systemNotifications.ts• L39-87).
The settings screens explain platform limits and provide test actions. Operating-system settings or Do Not Disturb can still suppress a notice, and Windows has limits on reopening the app after a toast leaves the visible area (src/…/DesktopNotificationsCard.tsx• L20-70, src/…/NotificationsBlockedRows.tsx• L9-33).
References: src/…/systemNotifications.ts• L13-21 src/…/systemNotifications.ts• L39-87 src/…/useNotificationEvents.ts• L34-56 src/…/DesktopNotificationsCard.tsx• L20-70 src/…/NotificationsBlockedRows.tsx• L9-33 crates/…/system_notifications.rs• L33-119 src/…/notificationScenarios.ts• L127-204
Desktop-local history
The desktop app keeps its notification history in native state rather than the browser store. React reads revisioned native snapshots, ignores older snapshots, and sends read or clear actions back to the desktop service (src/…/useDesktopNotifications.ts• L25-75, src/…/useDesktopNotifications.ts• L77-143).
The native snapshot is loaded after the event listener is ready and refreshed when the desktop emits a history change. This makes native events, command replies, and initial reads share one ordering rule (src/…/useDesktopNotifications.ts• L154-198, src/…/notificationDesktopScenarios.ts• L193-204, src/…/notificationDesktopScenarios.ts• L308-345).
References: crates/…/notifications.rs• L36-50 crates/…/notifications.rs• L126-178 crates/…/notifications.rs• L222-257 src/…/desktop.ts• L7-32 src/…/useDesktopNotifications.ts• L25-75 src/…/useDesktopNotifications.ts• L77-143 src/…/useDesktopNotifications.ts• L154-198 src/…/notificationDesktopScenarios.ts• L193-204 src/…/notificationDesktopScenarios.ts• L308-345
Mobile-local and background alerts
Mobile settings control local delivery and any background access. A local mobile session can check its own providers. A remote mobile session can receive alerts from a connected host, through a push relay, or through operating-system background checks that may be delayed (src/…/NotificationsSection.tsx• L78-114).
An alert host is a connected Pipedash server or shared computer that checks providers not present on the device. The settings show whether that host uses push alerts or background checks, let the user remove it, and warn that the same provider on both host and device can produce duplicate alerts (src/…/AlertHostGroup.tsx• L8-65, src/…/NotificationsSection.tsx• L156-167).
The optional push relay carries only an alert ID. Each paired device downloads the alert itself, so the relay does not see pipeline names. Users can enable the relay where it is allowed and manage older pairings with test and removal actions (src/…/BackgroundNotificationsCard.tsx• L12-26, src/…/MobileDevicesCard.tsx• L21-91, src/…/usePushQueries.ts• L16-65).
Background access is separate from the older local notification preference. The client reads the host settings before enabling it, asks for system permission, and reports when the host or platform cannot provide the requested delivery (src/…/NotificationsSection.tsx• L90-154, src/…/NotificationsSection.test.tsx• L73-87, src/…/notificationScenarios.ts• L206-285).
References: src/…/NotificationsSection.tsx• L66-185 src/…/NotificationsSection.tsx• L187-247 src/…/AlertHostGroup.tsx• L8-65 src/…/BackgroundNotificationsCard.tsx• L12-26 src/…/MobileDevicesCard.tsx• L21-91 src/…/PushDeviceActions.tsx• L13-30 src/…/usePushQueries.ts• L16-65 src/…/NotificationsSection.test.tsx• L73-87 src/…/MobileDevicesCard.test.tsx• L55-97 src/…/notificationScenarios.ts• L206-285
Provider status presentation
Provider attention is both a notice surface and a live status view. The center lists providers that currently affect pipelines, while the status view explains the Pipedash connection, provider incidents, maintenance, component health, stale data, and recovery actions (src/…/NotificationCenter.tsx• L125-141, src/…/ProviderStatusModal.tsx• L24-75).
Desktop and mobile use the same provider facts with layouts suited to each shell. Links can open incident or status pages, and stale or failed checks tell the user when the displayed status may not be current (src/…/ProviderServiceStatus.tsx• L89-107, src/…/ProviderServiceStatus.tsx• L109-175, src/…/ShellProviderStatus.tsx• L73-145).
References: src/…/NotificationCenter.tsx• L125-141 src/…/ProviderStatusButton.tsx• L10-67 src/…/ProviderStatusModal.tsx• L24-75 src/…/ProviderServiceStatus.tsx• L89-107 src/…/ProviderServiceStatus.tsx• L109-175 src/…/ShellProviderStatus.tsx• L73-145
Related notification systems
This page covers the client side of the alert path. The parent page, event-notifications, describes how alert events are formed and selected before they reach a client. The push-relay-service page describes the relay that can carry remote mobile alerts when the app is not active. See application-hosts for the connected host model and core-domain-and-persistence for the wider domain and storage context.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep notification payload fields aligned across live events, native snapshots, center notices, and system-notification targets.
- Preserve the last notification ID and preference exchange used for WebSocket gap recovery.
- Keep desktop snapshot revisions monotonic across native events, initial reads, and command replies.
- Keep desktop-native admission separate from the browser event hook so one event does not create duplicate history or system notices.
- Keep pipeline policy transitions mutually exclusive and preserve fired one-time watches during host and device sync. Show success only after the selected policy is saved.
- Keep the pipeline menu and dialog aligned on policy labels, state selection, quiet-alert availability, and failure recovery.
- Keep the queue-limit control aligned with the host general-settings contract. Preserve unrelated general settings when saving it.
- Keep local background settings, alert-host status, relay state, and paired-device actions consistent with the platform settings shown to users.
- Keep provider attention links and stale-data notes consistent between the center, desktop view, and mobile view.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| WebSocket reconnects without the last notification ID | Alerts from the gap can remain unseen | Send the saved ID with the next preference exchange. |
| Desktop native events also enter the React event hook | The same alert can appear twice or trigger duplicate delivery | Keep desktop history and delivery on the native path. |
| An older desktop snapshot arrives after a newer event | New history or read state can be overwritten | Accept snapshots only when their revision is current or newer. |
| Browser or native permission is blocked | The system notice is not shown | Check support and permission, but keep the notice in app history. |
| Concurrent preference changes use an old snapshot | A later choice can undo an earlier choice | Queue changes and apply each one to the latest saved snapshot. |
| A pipeline policy save fails | The old choice must remain active, and a false success message can mislead the user | Keep the policy surface open, restore the saved choice, and show an error until the user retries. |
| Queue limit saves a partial general-settings object | Other host settings can be lost | Send the current general settings with only the queue limit changed. |
| Queue limit cannot load from the host | The user cannot know or change the active threshold | Show the load error and allow a retry. |
| Background access has no usable host, relay, or platform permission | Mobile alerts can be delayed or absent | Read host settings, request permission, and show the reported delivery problem. |
| The same provider is local and also supplied by an alert host | The user can receive duplicate alerts | Warn about the duplicate source and let the user remove the host. |
| Provider status data is stale or its source fails | The user can mistake old data for current health | Show the last successful check and stale-source note. |
Key files
| File | Why to read it |
|---|---|
| src/…/notificationStore.ts | Defines device-level alert choices and one-time watch state. |
| src/…/notificationCenterStore.ts | Defines center snapshots, selection, read actions, and serialized updates. |
| src/…/websocket.ts | Shows live browser delivery and reconnect recovery. |
| src/…/useNotificationEvents.ts | Connects accepted client events to presentation and system delivery. |
| src/…/changePreference.ts | Coordinates ordered preference changes and fired-watch refresh. |
| src/…/useNotifyItems.tsx | Defines the user-facing pipeline and provider notification policies. |
| src/…/PipelineNotifyMenu.tsx | Shows the compact pipeline policy choices and missed-run control. |
| src/…/PipelineNotifyPolicy.tsx | Shows the full pipeline policy dialog and save behavior. |
| src/…/NotificationPreferencesSection.tsx | Presents notification kinds, providers, watched pipelines, muted pipelines, and the queue threshold. |
| src/…/PreferenceSwitches.tsx | Defines the user-facing alert-kind and provider controls. |
| src/…/QueueLimitInput.tsx | Connects the stuck-queue threshold to host general settings. |
| src/…/NotificationCenter.tsx | Shows the compact center and providers affecting pipelines now. |
| src/…/NotificationsPage.tsx | Shows full notification history across desktop and mobile shells. |
| src/…/NotificationDetailsModal.tsx | Presents notice details and related actions. |
| src/…/useDesktopNotifications.ts | Bridges React actions and native desktop notification history. |
| src/…/systemNotifications.ts | Defines support, permission, and system-notice behavior. |
| src/…/NotificationsSection.tsx | Explains local, remote, desktop, and background notification settings. |
| src/…/AlertHostGroup.tsx | Shows the connected alert host and duplicate-source warning. |
| src/…/BackgroundNotificationsCard.tsx | Controls relay-backed background delivery. |
| src/…/MobileDevicesCard.tsx | Manages older paired mobile devices and test pushes. |
| src/…/ProviderStatusModal.tsx | Presents provider connection, service status, and recovery context. |
| src/…/useGeneralSettingsQueries.ts | Shows the host settings write contract used by the queue limit. |
| crates/…/notifications.rs | Owns desktop history snapshots and native notification state. |
| crates/…/tauri_event_bus.rs | Defines native event admission for desktop and mobile shells. |
| crates/…/local_notifications.rs | Coordinates local settings, background alerts, and preference sync. |
| crates/…/system_notifications.rs | Defines native notices and click-target handling. |