Keep the installed app badge current from background Updates #1281

Closed
opened 2026-08-22 21:52:50 +00:00 by timmy · 0 comments
Owner

User problem

The opt-in installed-app badge only reconciles after the dashboard opens. Web Push already wakes the service worker while Stackchain is closed, but unread payloads do not carry the authoritative unread total and the worker cannot read the page-local preference. The icon therefore remains stale in the exact mobile background flow it is meant to support.

Evidence

  • frontend/mobile-app-badge.js stores opt-in only in localStorage and updates only from page-side reconciliation.
  • frontend/service-worker.js renders unread push notifications but never reconciles the Badging API.
  • src/push_notifications.py has a complete unread snapshot but sends only per-delivery counts.
  • Closed #1278 added foreground badging; historical #549/#647 added Web Push and inbox routing. Neither covers background badge reconciliation. No open issue or recent commit duplicates this flow.

Acceptance

  • Individual and digest unread push payloads include a bounded authoritative unread total from a complete snapshot.
  • Badge opt-in is synchronized to service-worker-readable device-local storage.
  • With opt-in enabled, a valid unread push updates the installed badge while preserving the existing notification and route.
  • Disabled, unsupported, malformed, non-update, and duplicate totals do not change the badge.
  • Foreground reconciliation continues to clear/correct the badge.
  • Behavioral backend, service-worker, controller, focused, and full-suite tests pass.
## User problem The opt-in installed-app badge only reconciles after the dashboard opens. Web Push already wakes the service worker while Stackchain is closed, but unread payloads do not carry the authoritative unread total and the worker cannot read the page-local preference. The icon therefore remains stale in the exact mobile background flow it is meant to support. ## Evidence - `frontend/mobile-app-badge.js` stores opt-in only in `localStorage` and updates only from page-side reconciliation. - `frontend/service-worker.js` renders unread push notifications but never reconciles the Badging API. - `src/push_notifications.py` has a complete unread snapshot but sends only per-delivery counts. - Closed #1278 added foreground badging; historical #549/#647 added Web Push and inbox routing. Neither covers background badge reconciliation. No open issue or recent commit duplicates this flow. ## Acceptance - Individual and digest unread push payloads include a bounded authoritative unread total from a complete snapshot. - Badge opt-in is synchronized to service-worker-readable device-local storage. - With opt-in enabled, a valid unread push updates the installed badge while preserving the existing notification and route. - Disabled, unsupported, malformed, non-update, and duplicate totals do not change the badge. - Foreground reconciliation continues to clear/correct the badge. - Behavioral backend, service-worker, controller, focused, and full-suite tests pass.
timmy self-assigned this 2026-08-22 21:52:50 +00:00
timmy closed this issue 2026-08-22 22:36:26 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#1281
No description provided.