fix(cache-storage): 손상 pointer에서도 inspect가 상태와 후보를 보여 준다

문제: inspect()는 active pointer 읽기가 실패하면 그 실패를 그대로
돌려준다. 손상 pointer(CORRUPT_DATA)는 조회·cleanup을 막고 다음
activation이 rollback 없이 덮어쓰는 상태인데, 그 상태를 진단할 유일한
관리 API도 같이 멈춘다. 운영자는 어떤 후보가 남았는지, 다음 activation이
무엇을 덮어쓰고 그 뒤 cleanup이 무엇을 지울지 모른 채 배포한다.
PublicCacheInspection에는 pointer 상태를 담을 칸이 없다.

고른 방법: PublicCacheInspection에 activePointer("NONE" | "READABLE" |
"UNREADABLE")를 둔다. pointer 읽기가 CORRUPT_DATA면 UNREADABLE로 적고
activeReleaseRegistryId는 null로 둔 채 후보 목록을 끝까지 채운다. 일시
오류(UNAVAILABLE 등)는 지금처럼 실패로 돌려준다. activation이 이미 쓰는
"CORRUPT_DATA만 손상으로 본다" 규칙과 같다. recipe fake도 같은 칸을
채운다. 리뷰가 함께 적은 inspect 전용 operation 이름은 공유 operation
union을 바꾸는 일이라 이번에 하지 않았다.

위험·한계: 공개 포트 타입에 필수 칸이 하나 는다. 결과를 읽는 쪽은
그대로지만 이 포트를 직접 구현한 쪽은 칸을 채워야 한다([계약]).
repo 안 소비자는 없다. inspect의 signal·판정 불가(0929/02-02)는
그대로다. service-worker-pwa 번들 9,733 → 9,758 / 10,100 gzip B.

검증:
- RED: public-response-cache-repair.test.ts 새 테스트가 activePointer
  없음으로 실패.
- GREEN: 같은 파일 11건 통과(손상 중 inspect ok, UNREADABLE, 후보
  r1·r2 verified, 일시 오류는 UNAVAILABLE). cache 단위 3파일 +
  tests/recipes 63건 통과. check:types, 바꾼 파일 eslint,
  check:optional-recipes:source PASS, verify:documentation 통과.

Refs: docs/reviews/2026-11-03-maturity-review/02-adapters-browser-files-cache.md 02-05
This commit is contained in:
DongHyeonka
2026-11-04 20:16:38 +09:00
parent f19d4c6e9c
commit 7e7614fd48
6 changed files with 88 additions and 4 deletions
@@ -40,6 +40,15 @@ export type CachedPublicResponse = Readonly<{
}>;
export type PublicCacheInspection = Readonly<{
/**
* 2026-11-03 02-05. `UNREADABLE` is a damaged pointer, or one this policy
* no longer accepts: lookup and cleanup stop on it and the next verified
* activation replaces it with an empty rollback list. The candidates are
* still listed so the operator can see what that activation and the
* cleanup after it will keep. A transient pointer read is a failure.
*/
activePointer: "NONE" | "READABLE" | "UNREADABLE";
/** `null` unless `activePointer` is `READABLE`. */
activeReleaseRegistryId: string | null;
ownedCacheCount: number;
unreadableOwnedCacheCount: number;