diff --git a/docs/operations/browser-file-storage-recovery.md b/docs/operations/browser-file-storage-recovery.md index 28243706..afe09ffb 100644 --- a/docs/operations/browser-file-storage-recovery.md +++ b/docs/operations/browser-file-storage-recovery.md @@ -592,6 +592,19 @@ Service Worker를 별도 선택한 조합에서만 추가. 워커의 fetch 가 부르는 화면이 없으므로 기본 경로는 뒤쪽이다. 따라서 결함 있는 워커가 waiting에 있으면 탭을 모두 닫았다 다시 연 사용자부터 그 워커를 쓴다. 기다리지 말고 다음 release로 교체하거나 `REMOVE_REGISTRATION` release를 배포한다. +- 활성화를 기다리는 동안 소유 캐시는 release 수만큼 쌓인다. 캐시를 지우는 곳은 + activate 하나이고, 현재 캐시와 마커가 가장 높은 직전 캐시 1개만 남긴다 + (`service-worker-lifecycle.ts` `onActivate`). 새 release가 waiting 워커를 + 밀어내도 밀려난 워커의 후보 캐시는 지우지 않는다. 예: 탭 하나를 연 채 A 활성 + 상태에서 B, C를 받으면 소유 캐시는 A·B·C 3개다. 탭을 모두 닫아 C가 활성화되면 + C·A 2개로 줄어든다(리뷰 1103/06-04 실험 L2, chromium·webkit). 캐시 하나는 + 사전 캐시 크기(상한 5 MiB, `src/contracts/service-worker.ts`)다. origin 쿼터에 + 닿으면 다음 install이 `QUOTA_EXCEEDED`로 실패하고, 저장소가 부족하면 브라우저가 + origin 저장소 전체(IndexedDB·OPFS 포함)를 지울 수 있다. 사용자가 탭을 오래 + 열어 두고 release가 잦은 제품은 `requestActivation()`을 부르는 화면을 붙여 + waiting 기간을 줄인다. install이 밀려난 캐시를 지우지 않는 이유: install하는 + 워커는 활성 워커의 캐시 이름을 모르고, 마커 쓰기에 실패한 활성 캐시는 마커가 + 없어 후보와 구별되지 않는다. - 제거는 `ACTIVE → REMOVE_REGISTRATION → PURGE_OWNED_RESOURCES → null` 순서로 release를 나눈다(`src/contracts/service-worker.ts` `InstalledServiceWorkerSelection`). 소유 캐시는 `PURGE_OWNED_RESOURCES` release의 diff --git a/docs/operations/release-cache-rollback.md b/docs/operations/release-cache-rollback.md index d3661342..1f374cd2 100644 --- a/docs/operations/release-cache-rollback.md +++ b/docs/operations/release-cache-rollback.md @@ -181,7 +181,11 @@ same build as the HTML and assets it caches. name is the asset-set digest, so if N's cache is still there as the retained previous cache, the install reuses it and never deletes it on failure (`service-worker-static-assets.ts` `installStaticAssets`). Tabs still on N+1 keep worker N+1, so N+1's assets - stay reachable for the rolling window above. + stay reachable for the rolling window above. Only activation deletes owned + caches (current plus the highest-marked previous one). While a worker + waits, every release that replaces the waiting worker leaves its cache + behind, so a scope holds one precache per release until its tabs close + (review 1103/06-04; `docs/operations/browser-file-storage-recovery.md` §8). 2. **Turn the worker off without a rebuild.** Set `CAPABILITY_OVERRIDES.SERVICE_WORKER: "DISABLED"` in the runtime config. The next boot unregisters the owned registration and registers nothing; owned