Files
clean-architecture-frontend…/scripts/lib/self-unregistering-service-worker.ts
T
DongHyeonkaandClaude Opus 5.5 9f2305a562 fix(service-worker): ship a self-unregistering worker for REMOVE_REGISTRATION (06-03)
A worker that stops the page from booting had no exit: every off switch was
page code. A REMOVE_REGISTRATION release now writes a service-worker.js that
skips waiting and unregisters itself (D-5), checked end to end in the browser.
The runbook and rollback doc now name only paths that exist in code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:21:02 +09:00

18 lines
837 B
TypeScript

/**
* 06-03 (D-5). The emergency exit for a worker that stops the page from
* booting. A `REMOVE_REGISTRATION` release writes this as `service-worker.js`.
* The browser's own update check (navigation, `updateViaCache: "none"`) then
* installs it over any worker of this scope without a page: it skips waiting,
* and on activation unregisters the registration. It has no fetch handler, so
* every request goes to the network. Owned caches stay for the
* `PURGE_OWNED_RESOURCES` release, as with the page-side removal.
*/
export const SELF_UNREGISTERING_SERVICE_WORKER = `// Generated by scripts/build-frontend.ts (REMOVE_REGISTRATION).
self.addEventListener("install", (event) => {
event.waitUntil(self.skipWaiting());
});
self.addEventListener("activate", (event) => {
event.waitUntil(self.registration.unregister());
});
`;