Purge every private offline store after background session revocation #889

Closed
opened 2026-08-15 11:42:06 +00:00 by rockachopa · 0 comments
Member

Problem

When a revoked or absolutely expired session is handled only by the service worker, stackchain-offline-work-v2 is not deleted. Offline issue bodies, comments, and review diffs can remain on a lost device until a window later performs cleanup.

Slice

Create a shared registry of Stackchain-owned private IndexedDB databases and use it from both window and service-worker purge paths. Background revocation, absolute expiry, and explicit purge acknowledgement must delete every registered store before caches are cleared or success/notification is emitted. Idle locking must continue preserving work.

Acceptance

  • Background session_revoked purges outbox plus all registered private databases before cache deletion and client notification.
  • Absolute offline lease expiry does the same before returning the 401 response.
  • Explicit worker purge acknowledges success only after all registered deletions complete; blocked deletion reports failure.
  • Window sign-out/revocation and worker cleanup consume one registry; unrelated origin data remains untouched.
  • Idle session handling deletes no private data.
  • Behavioral tests cover the registry contract and all three worker paths.

Evidence / non-duplication

Current origin/main 2eea428: frontend/private-device-data.js deletes stackchain-offline-work-v2, while frontend/service-worker.js only deletes stackchain-unfiled-captures-v1 after revocation/expiry/purge. Historical issues #337, #399, #525, and #617 introduced adjacent cleanup behavior but no shared registry and did not cover this service-worker-only omission. All 447 historical issue titles and recent commits were checked; no issue implements this behavior.

## Problem When a revoked or absolutely expired session is handled only by the service worker, `stackchain-offline-work-v2` is not deleted. Offline issue bodies, comments, and review diffs can remain on a lost device until a window later performs cleanup. ## Slice Create a shared registry of Stackchain-owned private IndexedDB databases and use it from both window and service-worker purge paths. Background revocation, absolute expiry, and explicit purge acknowledgement must delete every registered store before caches are cleared or success/notification is emitted. Idle locking must continue preserving work. ## Acceptance - Background `session_revoked` purges outbox plus all registered private databases before cache deletion and client notification. - Absolute offline lease expiry does the same before returning the 401 response. - Explicit worker purge acknowledges success only after all registered deletions complete; blocked deletion reports failure. - Window sign-out/revocation and worker cleanup consume one registry; unrelated origin data remains untouched. - Idle session handling deletes no private data. - Behavioral tests cover the registry contract and all three worker paths. ## Evidence / non-duplication Current `origin/main` `2eea428`: `frontend/private-device-data.js` deletes `stackchain-offline-work-v2`, while `frontend/service-worker.js` only deletes `stackchain-unfiled-captures-v1` after revocation/expiry/purge. Historical issues #337, #399, #525, and #617 introduced adjacent cleanup behavior but no shared registry and did not cover this service-worker-only omission. All 447 historical issue titles and recent commits were checked; no issue implements this behavior.
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#889
No description provided.