Restore background delivery after sign-in following outbox purge #425

Closed
opened 2026-08-09 20:39:32 +00:00 by timmy · 0 comments
Owner

Problem

Signing out or remotely revoking a device purges the service worker outbox and permanently latches background delivery off for that worker instance. A later authenticated stackchain-resume-outbox message flushes without re-arming, so queued captures, comments, replies, and reviews can remain stranded until a worker replacement.

User flow

  1. Sign out (or have the device remotely revoked), completing the privacy-preserving purge.
  2. Sign in again without waiting for a service-worker upgrade.
  3. The authenticated dashboard re-arms background delivery, resolves fresh identity, and safely delivers records belonging to that login.

Acceptance criteria

  • Purge continues to abort active requests, release claims, close storage, and block delivery until purge completes.
  • Resume during purge waits for completion and performs no early identity lookup or mutation.
  • Resume after purge lazily reopens storage, resolves fresh identity, and delivers only matching-login records.
  • Repeated resume requests remain single-flight and do not duplicate delivery or idempotency keys.
  • Service-worker purge acknowledgement semantics remain intact.
  • Focused and full test suites pass.

Evidence / non-duplication

frontend/background-issue-sync.js sets purgeRequested = true in purge() and both send() and flush() permanently refuse work afterward; no method resets it. frontend/session.js nevertheless emits stackchain-resume-outbox after authenticated startup, while frontend/service-worker.js only flushes. Historical #266 added resume for a never-purged worker; #293 added the permanent purge latch; #337 extended purge to remote revocation. No historical issue or recent commit covers re-arming after that interaction.

## Problem Signing out or remotely revoking a device purges the service worker outbox and permanently latches background delivery off for that worker instance. A later authenticated `stackchain-resume-outbox` message flushes without re-arming, so queued captures, comments, replies, and reviews can remain stranded until a worker replacement. ## User flow 1. Sign out (or have the device remotely revoked), completing the privacy-preserving purge. 2. Sign in again without waiting for a service-worker upgrade. 3. The authenticated dashboard re-arms background delivery, resolves fresh identity, and safely delivers records belonging to that login. ## Acceptance criteria - Purge continues to abort active requests, release claims, close storage, and block delivery until purge completes. - Resume during purge waits for completion and performs no early identity lookup or mutation. - Resume after purge lazily reopens storage, resolves fresh identity, and delivers only matching-login records. - Repeated resume requests remain single-flight and do not duplicate delivery or idempotency keys. - Service-worker purge acknowledgement semantics remain intact. - Focused and full test suites pass. ## Evidence / non-duplication `frontend/background-issue-sync.js` sets `purgeRequested = true` in `purge()` and both `send()` and `flush()` permanently refuse work afterward; no method resets it. `frontend/session.js` nevertheless emits `stackchain-resume-outbox` after authenticated startup, while `frontend/service-worker.js` only flushes. Historical #266 added resume for a never-purged worker; #293 added the permanent purge latch; #337 extended purge to remote revocation. No historical issue or recent commit covers re-arming after that interaction.
timmy self-assigned this 2026-08-09 20:44:46 +00:00
timmy closed this issue 2026-08-09 20:46:13 +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#425
No description provided.