A successful request to a push service means it accepted a delivery attempt, not that a device displayed the notification or that a person read it. Devices can be offline, subscriptions can expire, services can reject a request, and alerts can become irrelevant before delivery. Give each alert an event identity, expiry deadline, current preference check, and deduplication rule. The application inbox holds the durable assignment. Push is a timely signal pointing to that state, not the only record of work. Delivery telemetry should distinguish queued, accepted, rejected, expired, and opened states without inventing a guaranteed delivered state.
Push Delivery Retries, Expiry, and Inbox Fallback
Working case
Case 47 is assigned to reviewer 29 at 09:17. An urgent alert is queued, but the reviewer’s phone is offline. At 09:26 the case is reassigned to reviewer 62. Sending the old alert at 09:31 would create confusion and could reveal that reviewer 29 previously held a private assignment. The worker checks current assignment, alert expiry, and preference before each attempt and cancels the stale item. The inbox reflects current ownership. Reviewer 62 can see the new assignment after sign-in even if push delivery fails. A duplicate worker execution must not create two distinct alerts for the same assignment event.
Implementation boundary
function alertDecision(alert, now, assignment) {
if (now >= alert.expiresAt) return "expired";
if (assignment.reviewerId !== alert.reviewerId) return "superseded";
return "attempt-send";
}
console.log(alertDecision({ expiresAt: 80, reviewerId: 29 }, 47, { reviewerId: 62 }));
// Output: supersededWrite an outbox record with an immutable alert ID, recipient scope, purpose, creation time, and expiry. Before sending, recheck current authorization, category preference, and whether the event is superseded. Use a bounded retry policy for transient push-service failures and retire a subscription on a definitive invalid-endpoint response. Apply a reasonable time-to-live so a stale urgent alert does not appear days late. Deduplicate by event identity at the application layer; a network retry can still produce uncertain outcomes, so notifications should be idempotent from the user’s perspective. Keep the inbox query independent of push subscription state.
Cost and boundaries
Sending to d active devices is O(d) attempted requests per alert. Retries multiply that work and can create queue pressure during a push-service outage, so use backoff and a deadline rather than unbounded replay. Durable inbox storage grows with assignment volume and retention policy, but it supports a reliable audit of current work. Exactly-once human display is not a realistic guarantee across push services and devices. Measure accepted sends, invalid subscriptions, expired alerts, stale cancellations, retry backlog, and inbox retrieval success instead of a fabricated delivery percentage.
Failure trace
The worker retries every failure forever. After a weekend outage, obsolete alerts for cases already resolved arrive in a burst. Add expiry and a current-state check before each retry. Another dashboard marks Accepted as Delivered and concludes the person saw an alert; that status is unsupported. Rename it and distinguish an observed click if one occurs. Disable push entirely and confirm the assignment inbox still works. Test duplicate outbox processing, a lost push-service response, endpoint invalidation, role change, account switch, and a device returning online after the alert deadline.
Verification
- Expired or reassigned work cannot trigger a stale alert.
- Duplicate processing preserves one logical alert identity.
- The in-app inbox works when push fails or is disabled.
Practice drill
Queue an urgent assignment for case 47 and force one transient push failure, one invalid endpoint, and one uncertain accepted response. Reassign or resolve the case before retry and verify stale cancellation. Execute the worker twice with the same alert ID and inspect visible grouping and inbox records. Keep a device offline until after expiry, then reconnect it. Compare the user-visible inbox with delivery telemetry and avoid labeling a push-service acceptance as a confirmed read.
Decision note
Use push as an expiring, best-effort signal; the authorized inbox carries the current work and recovery path.
Common Mistakes
- Calling push-service acceptance a confirmed device display.
- Retrying past the alert’s useful lifetime.
- Making push the only record of an assignment.
Connected lessons
Web Push and Notification Delivery; Notification Opt-In and Channel Preference; Push Subscription Account Binding and Rotation; Private Notification Payload and Click Routing; Background Jobs and the Outbox Boundary; Offline Outbox, Idempotency, and Replay; Permission Revocation and Active Sessions.
Apply and check
Build Project: private urgent assignment alerts and review Web Development: push notification decisions quiz.
