Preserve cached lazy workflows across offline PWA activation #977

Closed
opened 2026-08-16 17:19:18 +00:00 by timmy · 0 comments
Owner

Problem

When a new service worker activates, it deletes the previous Stackchain cache before warming content-addressed lazy workflow bundles. If connectivity drops during activation, unchanged workflows that were available offline in the previous release disappear.

Slice

Migrate exact optional-feature URL matches from prior Stackchain caches into the new cache, fetch only missing assets, and delete stale caches only after migration/warming settles. Preserve unrelated caches and non-blocking activation.

Acceptance tests

  • Offline activation copies an unchanged optional bundle before deleting the old cache.
  • Missing/changed bundles can fail without blocking sibling migrations or clients.claim().
  • Online activation fetches only assets absent from prior caches.
  • Unrelated caches are preserved and stale Stackchain caches are deleted after migration.
  • Focused and full suites pass.

Evidence / non-duplication

Current frontend/service-worker.js lines 369-378 delete old caches before Promise.allSettled(OPTIONAL_FEATURES.map(cache.add)). Historical #619/#620 introduced progressive feature caching but did not preserve prior lazy bundles across an offline activation transition; no historical issue has this normalized title.

## Problem When a new service worker activates, it deletes the previous Stackchain cache before warming content-addressed lazy workflow bundles. If connectivity drops during activation, unchanged workflows that were available offline in the previous release disappear. ## Slice Migrate exact optional-feature URL matches from prior Stackchain caches into the new cache, fetch only missing assets, and delete stale caches only after migration/warming settles. Preserve unrelated caches and non-blocking activation. ## Acceptance tests - Offline activation copies an unchanged optional bundle before deleting the old cache. - Missing/changed bundles can fail without blocking sibling migrations or `clients.claim()`. - Online activation fetches only assets absent from prior caches. - Unrelated caches are preserved and stale Stackchain caches are deleted after migration. - Focused and full suites pass. ## Evidence / non-duplication Current `frontend/service-worker.js` lines 369-378 delete old caches before `Promise.allSettled(OPTIONAL_FEATURES.map(cache.add))`. Historical #619/#620 introduced progressive feature caching but did not preserve prior lazy bundles across an offline activation transition; no historical issue has this normalized title.
timmy self-assigned this 2026-08-16 17:19:18 +00:00
timmy closed this issue 2026-08-16 17:39:10 +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#977
No description provided.