Versioning service-worker caches safely
A service worker can keep serving an old interface after the server release is complete. Cache names, activation and compatibility need the same release discipline as backend schemas.
Separate cache purposes
Use distinct versioned stores for the application shell, generated pages and runtime assets. Define expiration and offline behaviour for each rather than deleting every cache belonging to the origin.
Coordinate activation
A newly installed worker may control pages built for an older asset set. Avoid immediate activation unless the interface can tolerate it, and provide a visible refresh path when a breaking shell update is waiting.
Test interrupted upgrades
Exercise offline launch, a deployment between page and asset requests, two open tabs and rollback to the previous worker. Confirm that failed fetches return an intentional offline response rather than an unrelated cached document.
Only remove cache names owned by the current application; other tools and applications may share the same origin storage.