Commit Graph
28 Commits
Author SHA1 Message Date
DongHyeonka 23662fb23a fix(storage): 객체를 끝까지 돈 계정 삭제 purge는 늘 partition을 지운다
문제: 승인된 LOGOUT·ACCOUNT_DELETION purge는 객체 목록을 읽고, 하나씩
지우고, 마지막에 journal 행을 한 번 센 뒤 0이면 chunk sweep으로 끝나
`chunkSweep: "COMPLETED"`를 돌려준다. 목록과 세기는 각각 한 순간만 본다.
- 다른 탭이 새 객체를 put하는 중이면 purge의 remove가 그 put이 쥔
  origin lease를 기다린다. partition에 객체가 3개 이상이면 그 put은
  목록 뒤에 commit하고 세기 전에 complete까지 끝난다. 목록에도 행 수에도
  없어 sweep이 그 chunk를 건너뛰고, 계정 삭제 뒤에도 파일이 읽힌다
  (리뷰 실험 Y1b 메모리 20/20, Chromium 6/6). 저장소 테스트는 객체
  0~1개로만 돌아서 이 틈을 놓쳤다.
- FILES_READY에서 멈춘 put의 행이 `logicalKey`를 잃으면 세지 못한다.
  staging receipt가 chunk를 sweep에서 지켜 purge마다 COMPLETED인데
  receipt·chunk·manifest가 남는다(Y2).

고른 방법: 마지막 객체까지 돈 purge는 sweep 대신 늘 partition 삭제로
끝낸다(리뷰 2.1절 (d')). exclusive partition lock이 그때 진행 중인
put·delete를 모두 기다린 뒤 디렉터리 전체(staging 포함)와 그 partition
행을 지우므로 두 경우를 함께 막는다. 객체 순회는 `removedObjects`·
`releasedBytes` 보고와 예산 단위 진행을 위해 남긴다. 예산이나 다른 탭의
변경(CONFLICT) 때문에 끝까지 돌지 못한 호출은 지금처럼
`moreObjectsAvailable: true`를 돌려주고, 그때만 journal 행을 세서 끝나지
않은 행이 있으면 바로 partition을 지운다(2026-11-03 05-01 그대로).
purge 성공 report는 이제 `partitionDeleted`와 `moreObjectsAvailable`
중 정확히 하나를 가진다(walk 뒤 abort도 more로 보고).

버린 대안:
- (a) sweep 뒤에 다시 세고 committed 객체를 한 번 더 본다: ①만 막고
  ②가 남는다. 다시 볼 때 정책상 남겨야 할 객체를 가려내려면 목록을 끝까지
  다시 읽어야 한다.
- (b)+(a): 둘 다 막지만 판단 조건이 일곱 개가 된다.
- 세기를 아예 없애기: 예산에 걸린 호출의 crash 행 처리가 다음 호출로
  밀린다. 지금 동작을 바꿀 이유가 없어 남겼다.

위험·한계:
- 모든 승인 purge가 다른 탭의 진행 중 put을 기다린다(지금까지는 끝나지
  않은 행이 있을 때만). 기다림 상한은 `mutationLockWaitTimeoutMs`
  (1103/05-02)이고 abort로 멈출 수 있다.
- 같은 partition에 LOGOUT 때 남겨야 하는 객체가 섞이면 이 방법은 맞지
  않는다. 지금 정책 검사는 OPAQUE_PARTITION이면 LOGOUT·ACCOUNT_DELETION
  모두 purge만 허용해 그런 객체가 생기지 않는다.
- port의 `chunkSweep`은 아무도 채우지 않는다. 읽는 코드가 깨지지 않게
  타입은 남기고 `@deprecated`로 적었다.
- recipe fake의 purge도 늘 `partitionDeleted`다.
- `logicalKey`를 잃은 행 자체는 여전히 남는다(05-03 설계). 그 bytes는
  이제 남지 않는다.
- Firefox·WebKit에서 Y1은 돌리지 않았다. browser spec은 객체 0·3개
  두 경우로 늘렸다.

검증: desktop batch에서 확인
- node scripts/run-vitest.ts run tests/unit/opfs-worker-runtime.test.ts
  tests/unit/opfs-byte-store.test.ts tests/unit/indexeddb-opfs-journal.test.ts
- node scripts/run-vitest.ts run tests/recipes/browser-file-storage-contracts.test.ts
- corepack pnpm test:browser-capabilities tests/browser-capabilities/opfs-runtime.spec.ts --project=chromium

Refs: 1103/05-01
2026-11-05 22:08:19 +09:00
DongHyeonka f6b74ed496 fix(storage): put idle 상한이 lock 대기 상한보다 짧지 않은 OPFS 정책을 거절한다
문제: putIdleTimeoutMs < mutationLockWaitTimeoutMs는 05-07이 기대는
관계다(멈춘 put이 idle 상한에서 origin lock을 놓아야 줄 선 writer가
대기 상한 전에 돈다). 이 관계가 opfs-policy.ts 주석에만 있고, 정책
검사는 각 값의 범위만 본다. 두 값을 뒤집은 정책은 조용히 통과하고,
멈춘 put 하나가 다른 탭의 모든 쓰기를 BLOCKED로 끝낸다.

고른 방법: assertOpfsRuntimePolicy가 putIdleTimeoutMs >=
mutationLockWaitTimeoutMs를 TypeError로 거절한다. 다른 정책 오류와
같은 자리·같은 방식이다. 기본값(2분 < 10분)과 repo 안의 모든 정책은
이미 관계를 지킨다.

위험·한계: 이 관계를 어긴 정책을 쓰던 다운스트림은 조립 때 실패한다.
의도한 동작이다.

검증:
- RED: opfs-worker-runtime.test.ts 새 2건(같음, 김)이 throw 없음으로 실패.
- GREEN: OPFS 단위 3파일 + tests/recipes + tests/contract 174건 통과.
  check:types, 바꾼 파일 eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 0929/05-09
2026-11-04 20:56:03 +09:00
DongHyeonka 8da33a5cf0 test(storage): 메모리 OPFS 파일 시스템을 테스트 helper로 옮긴다
문제: OPFS worker runtime을 메모리에서 돌리는 MemoryDirectory·MemoryFile이
tests/unit/opfs-worker-runtime.test.ts 안에만 있다. 05-04를 고치려면
recipe fake와 runtime에 같은 시나리오를 돌리는 parity 테스트가
tests/recipes에 필요한데, 그 테스트는 이 파일 시스템을 쓸 수 없다.
unit 테스트가 recipe를 import하면 optional-recipe 제거 드릴이 깨지므로
parity 테스트를 unit 쪽에 둘 수도 없다.

고른 방법: 그 블록(MemoryNode·MemoryFile·MemoryDirectory·fileHandle·
notFound)을 그대로 tests/helpers/memory-opfs.ts로 옮기고 export한다.
memory-indexeddb.ts와 같은 자리다. 코드는 바꾸지 않았다. helper는 src를
import하지 않아 browser-file-storage 제거 드릴에서도 남아도 된다.

위험·한계: 동작 변경 없음.

검증: opfs-worker-runtime.test.ts 82건 통과. check:types:test, 바꾼 파일
eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 05-04
2026-11-04 20:40:25 +09:00
DongHyeonka fd6b6315c0 fix(storage): 소속 partition이 없는 손상 journal 행을 따로 세고 경보에서 뺀다
문제: partition 삭제는 journal 행을 LOGICAL_KEY_INDEX로 찾는다. 인덱스에는
logicalKey 값이 있는 행만 들어가므로, 그 값까지 깨진 행은 승인된
ACCOUNT_DELETION으로도 지워지지 않는다(X4: partition 파일 0개인데 행은
남음). 그 행은 reconcile마다 corruptTransactions 1, OBJECT_RECONCILE
DEGRADED/CORRUPT_DATA로 남는다. runbook은 "키로 찾으므로 손상 row도
지워진다", "partition이 승인된 purge로 지워질 때만 함께 지워진다"고 적고
수동 삭제를 금지한다. 운영자는 늘 켜진 경보를 받지만 할 수 있는 일이 없고,
그 경보가 진짜 손상을 가린다.

고른 방법(리뷰 (a)+(b)): 소속을 모르는 행은 지울 근거가 없으므로 지우지
않는다. 대신
- journal의 listIncomplete가 손상 행 가운데 이 authority의 partition 키
  범위에 들지 않는 행을 unattributedRows로 따로 센다(0이면 칸 없음).
- reconcile report에 unattributedCorruptTransactions를 싣고(0이면 칸
  없음), DEGRADED 관측은 purge가 지울 수 있는 손상 행이 있을 때만 낸다.
- runbook §0·§7 문장을 코드와 맞추고, 이런 행에 대해 할 일(같은 수면
  없음, 늘면 writer를 찾음, 수동 삭제 금지)을 적었다.
버린 대안: (a)만 — 경보가 계속 켜진다. (c) 소속을 모르는 행 자동 삭제 —
그 행이 가리키던 staging을 추적할 근거가 사라진다(runbook §0 3번).

위험·한계: 공개 타입에 선택 칸 두 개가 는다(OpfsJournalPage
.unattributedRows, OpfsReconciliationReport
.unattributedCorruptTransactions). 직접 만든 journal이 칸을 채우지 않으면
지금처럼 모든 손상 행이 경보에 남는다. 소속 없는 행만 있을 때 관측이
SUCCEEDED가 되므로, 그 수는 report로만 보인다. 이런 행의 staging은 purge의
partition 삭제 조건(countPartitionTransactions)에 잡히지 않는다.
offline-indexeddb 번들 37,555 → 37,705 / 38,500 gzip B.

검증:
- RED: indexeddb-opfs-journal.test.ts 새 테스트가 unattributedRows 없음,
  opfs-worker-runtime.test.ts 새 X4 테스트가 unattributedCorruptTransactions
  없음으로 실패.
- GREEN: 키 있는 손상 행은 removePartition이 지우고 키 없는 행은 남는다.
  키 없는 행만 있으면 관측 SUCCEEDED, 키 있는 손상 행이 더해지면
  DEGRADED:CORRUPT_DATA. OPFS 단위 3파일 + optional-runtime-host +
  tests/recipes + tests/contract 176건 통과. check:types, 바꾼 파일
  eslint, check:optional-recipes:source PASS, verify:documentation 통과.

Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 05-03
2026-11-04 20:38:17 +09:00
DongHyeonka 7b55f0f83d fix(storage): partition lock을 기다리는 put·delete가 자기 abort로 끝난다
문제: withTransactionLock은 partition lock을 signal 없이 요청한다
(withPartitionLock("shared", operation, undefined, run)). put·remove의
request.signal이 거기까지 오지 않고, Web Locks 요청은 signal이 없으면
시간 제한도 없다. mutationLockWaitTimeoutMs는 worker의 origin lease에만
걸린다. 다른 탭의 partition 삭제가 큰 업로드를 기다리는 동안 같은
partition에 put·remove(또는 만료 객체를 지우는 open)를 부르고 취소하면,
삭제가 끝날 때까지 결과가 오지 않는다(X5: abort 뒤 200 ms 동안 대기).
05-01로 정상 purge도 partition 삭제를 쓰게 되어 이 대기가 더 자주 난다.

고른 방법: put·remove가 request.signal을 withTransactionLock에 넘기고,
withPartitionLock은 kernel createAbortableOperation으로 caller signal과
mutationLockWaitTimeoutMs를 묶은 signal로 lock을 요청한다. caller
abort면 ABORTED, 시간이 다 되면 BLOCKED(retryable, RETRY)다. worker의
acquireLease와 같은 값·같은 결과다. lock을 얻으면 바로 close해 타이머를
지운다(얻은 lock에 대한 abort는 Web Locks에서 아무 일도 하지 않는다).
lock 전 abort는 journal begin 전이라 보상할 것이 없다.
버린 대안: signal만 넘기기(리뷰 최소안). 취소는 되지만 "상한 없음"이
남는다. 새 정책 값 추가. 같은 의미의 값이 이미 있다.

위험·한계: 같은 상한이 partition 삭제(exclusive)의 기다림에도 걸린다.
다른 탭 put이 10분(기본값)보다 오래 걸리면 purge가 BLOCKED로 끝나고
호출자가 다시 부른다. 전에는 끝없이 기다렸다. 실제 브라우저에서 abort
경합은 돌리지 않았고 Node Web Locks로만 확인했다. offline-indexeddb
번들 37,521 → 37,555 / 38,500 gzip B.

검증:
- RED: opfs-worker-runtime.test.ts 새 2건. abort한 put이 200 ms 안에
  끝나지 않음(STILL_WAITING), 가짜 시계로 상한을 넘겨도 put이 끝나지
  않아 10초 timeout.
- GREEN: OPFS 단위 3파일 + optional-runtime-host + tests/recipes 151건
  통과. check:types, 바꾼 파일 eslint, check:optional-recipes:source
  PASS, verify:documentation 통과.
- browser: heavy lock 안에서 opfs-runtime·indexeddb-runtime spec 3엔진
  27/27 통과. 첫 실행은 dev server가 실행 중에 페이지를 다시 불러
  5건이 "Execution context was destroyed"로 떨어졌고, 다시 돌려 통과했다.

Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 05-02
2026-11-04 20:34:28 +09:00
DongHyeonka d13a393600 fix(storage): 계정 삭제 purge가 끝나지 않은 put을 보면 partition을 지운다
문제: 손상이 없는 LOGOUT·ACCOUNT_DELETION purge는 commit된 object 행과
참조 없는 chunk만 본다. 같은 partition의 끝나지 않은 journal 행
(PREPARING·FILES_READY)은 보지 않고, sweep은 staging receipt가 가리키는
chunk를 건너뛰면서도 COMPLETED를 돌려준다. 그래서
- 다른 탭이 put 중이면 purge가 "COMPLETED"를 보고한 뒤 그 객체가
  그대로 읽힌다(X1, 실제 Chromium·Firefox에서도 같음).
- commit 직전에 멈춘 put(FILES_READY)은 purge 뒤 다음 reconcile이
  commit해 계정 삭제한 사용자 파일이 객체로 다시 생긴다(X2).
- 업로드 중 멈춘 put(PREPARING)은 chunk가 grace 기간 동안 남고(X2b),
  그 행이 손상됐으면 partition 삭제도 일어나지 않아 영원히 남는다(X3).
손상이 있을 때만 partition 삭제가 진행 중 put까지 기다렸다 지웠다.

고른 방법(리뷰 5.1절 (c)): LOGOUT·ACCOUNT_DELETION이 객체를 다 돈 뒤
그 partition 키를 가진 journal 행 수를 센다. 하나라도 있으면(읽을 수
있든 없든) sweep 대신 이미 있는 partition 삭제로 넘긴다. partition
삭제는 exclusive partition lock으로 진행 중 put·delete가 돌아오기를
기다린 뒤 디렉터리와 그 partition의 행을 모두 지운다(e5b7b3e).
OpfsJournalPort에 countPartitionTransactions(scope)를 더했다.
removePartition이 지우는 같은 LOGICAL_KEY_INDEX 범위를 세므로, 센 행은
삭제가 지운다.
버린 대안: (a) 문서에 "reconcile 먼저" 안내 — X1·X3을 막지 못한다.
(b) report에 수만 추가 — 지울 방법이 없다(X3). (d) 항상 partition
삭제 — 더 단순하지만 끝나지 않은 행이 없을 때의 예산 단위 진행과
removedObjects·releasedBytes 보고를 잃는다.

위험·한계:
- 공개 포트에 필수 메서드가 하나 는다. OpfsJournalPort를 직접 구현한
  쪽은 추가해야 한다([계약]).
- 끝나지 않은 행이 하나라도 있으면 purge가 예산 없는 partition 삭제가
  되고, 다른 탭의 진행 중 put이 끝날 때까지 기다린다. 그 put의 결과도
  지운다(손상 경로와 같은 의미). purge가 행을 센 뒤 시작한 put은
  남는다(point-in-time).
- 기존 테스트 "never sweeps the chunk of a put that runs while the purge
  does"는 X1 동작을 기대값으로 고정하고 있었다. 새 의미로 바꿨다.
  0929/05-02 테스트는 덮어쓰기가 purge의 목록과 remove 사이에 끝나도록
  바꿔 CONFLICT 경로를 계속 본다.
- 소속을 알 수 없는(logicalKey가 깨진) 행은 여기서도 세지 못한다(05-03).
- WebKit은 기본 정책에서 OPFS 지원 판정을 통과하지 못해 browser spec이
  일찍 끝난다. offline-indexeddb 번들 37,423 → 37,521 / 38,500 gzip B.

검증:
- RED: opfs-worker-runtime.test.ts 새 4건(X1, FILES_READY, PREPARING,
  손상 행)이 partitionDeleted 없음으로 실패.
- GREEN: OPFS 단위 3파일 + optional-runtime-host + tests/recipes +
  tests/contract 172건 통과. journal에 countPartitionTransactions 테스트
  1건(손상 행 포함, 다른 partition 제외, 삭제 뒤 0).
- browser: opfs-runtime.spec.ts에 X1 2탭 판을 더했다. heavy lock 안에서
  3엔진 9/9 통과(WebKit은 지원 판정에서 끝남).
- check:types, 바꾼 파일 eslint, check:optional-recipes:source PASS,
  verify:documentation 통과.

Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 05-01
2026-11-04 20:29:34 +09:00
DongHyeonka e5b7b3e857 fix(storage): partition 삭제가 다른 탭의 진행 중인 put을 기다린다 (0929/05-01)
문제: 손상 때문에 끝나지 못한 LOGOUT·ACCOUNT_DELETION purge의 partition
삭제는 두 단계다. 디렉터리를 origin lease 안에서 지우고, 이어서 journal
row를 lease 밖에서 지운다. origin lease는 put의 BEGIN~FINISH만 막는다.
그래서 다른 탭에서 journal `begin`을 끝낸 put이 두 단계 사이에 BEGIN을
하면 새 디렉터리에 파일을 쓰고, 두 번째 단계가 그 put의 row를 지운다.
put은 다음 journal 단계에서 `CONFLICT`로 실패하지만 파일을 치울 주체가
없다.
- markFilesReady 전에 row가 지워지면: 보상이 manifest·staging을 지우고
  chunk가 남는다.
- commitPut 전에 지워지면: 보상이 없어 manifest·FILES_READY staging
  receipt·chunk가 남는다. staging receipt가 chunk를 GC·sweep에서 지키고
  row가 없어 reconcile도 보지 않으므로 영원히 남는다. 다음 LOGOUT purge는
  `chunkSweep: COMPLETED`를 보고하면서 이 bytes를 남긴다.
- commit 뒤 complete 전에 지워지면: put은 성공하지만 object는 없고
  manifest·chunk가 남는다.
삭제 전체가 put의 FINISH~commit 사이에 들어가는 경우(72edb55가 가정한
경우)는 수정 전에도 put이 `CONFLICT`로 실패하고 bytes가 남지 않았다.

고른 방법: partition 단위 Web Lock
(`<mutationLockName>:partition:<a>:<ns>:<p>`)을 둔다. 모든 put·delete는
`withTransactionLock` 안에서 journal `begin`부터 끝날 때까지 shared로
쥐고, partition 삭제는 디렉터리·journal 두 단계를 exclusive로 쥔 채 한다.
mutation은 삭제 전체보다 앞이거나 뒤에만 놓인다. 진행 중이던 put은 끝난
뒤 삭제가 지우고, 삭제가 lock을 요청한 뒤 온 put은 삭제 뒤에 돈다.
lock 순서는 partition lock → origin lease 하나뿐이라 교착이 없다
(per-transaction lock은 `ifAvailable`이라 기다리지 않는다). 기다리는
동안 purge `signal`을 abort하면 `ABORTED`를 반환한다.

버린 대안:
- commitPut `CONFLICT`면 보상: commitPut 전 경우만 고치고 chunk와
  commit 뒤 경우가 남는다. 또 port가 "CONFLICT = 아무것도 commit 안 됨"을
  약속하지 않아 동봉 구현에 기대는 숨은 결합이 생긴다.
- commit까지 origin lease 쥐기: lease는 worker 안에 있고 journal은 page
  쪽이다. 두 번째 단계(row 삭제)가 lease를 쓰지 않아 commitPut 전 경우가
  그대로다.
- row를 먼저 지우고 디렉터리를 나중에: 그 사이 begin한 put이 디렉터리
  단계 전에 FINISH하면 파일 없는 COMMITTED row가 생긴다. 중간 실패 뒤
  재호출로 이어서 끝나는 성질도 잃는다.
- 디렉터리 → row → 디렉터리: 같은 이유로 파일 없는 commit이 생긴다.

위험·한계:
- 삭제는 진행 중인 put·delete를 기다린다. source가 멈춘 put은 put idle
  bound(05-07)까지 삭제를 붙잡는다. 수정 전에도 그 put은 origin lease를
  쥐고 있어 디렉터리 단계가 같은 시간을 기다렸다.
- reconcile은 partition lock을 쥐지 않는다. reconcile은 파일을 새로 쓰지
  않으므로(검증·정리·finalize만) 삭제와 겹쳐도 bytes를 남기지 않는다고
  보았고, 이 경우는 테스트하지 않았다.
- put·delete마다 Web Lock 요청이 하나 늘어난다.
- offline-indexeddb 레시피 gzip 37,327 → 37,423 B(한도 38,500).
- 공개 타입·배럴 변경 없음.

검증:
- RED(수정 전, put 결과 단언을 넣기 전): 새 it.each 5건 중 3건 실패.
  디렉터리를 put BEGIN 전에 지운 경우만 실패했다.
  markFilesReady 앞: chunk 1개 남음. commitPut 앞: staging receipt·chunk·
  manifest 남음. complete 앞: chunk·manifest 남음.
  삭제 전체가 FINISH~commit 사이인 2건은 통과(put CONFLICT, bytes 0).
  "put은 삭제 앞에 끝난다" 단언을 더한 뒤 수정 전 코드: 5건 모두 실패.
- GREEN: 5건 + abort 테스트 1건 통과. 같은 5건 10회 반복 10/10.
- `node scripts/run-vitest.ts run tests/unit/opfs-worker-runtime.test.ts
  tests/unit/opfs-byte-store.test.ts tests/unit/indexeddb-opfs-journal.test.ts
  tests/recipes` 136건 통과.
- tsc app·test·web-worker·recipes 통과. 바꾼 파일 eslint 통과.
  `check-adapter-inventory` PASS, `check-optional-recipes`(source) PASS,
  `verify-documentation-readiness` PASS_SCOPED.
- 미실행: `check:browser-file-storage-boundaries`·`check:architecture`
  (pnpm 필요), Playwright OPFS spec(webServer가 pnpm).

Refs: docs/reviews/2026-11-01-maturity-review/README.md 14.4
2026-11-03 20:22:49 +09:00
DongHyeonka 72edb55475 fix(storage): 손상 행을 건너뛰고 끝나지 못한 삭제는 partition을 지운다 (0929/05-01)
문제: OPFS journal의 `listCommittedObjects`·`listIncomplete`는 손상 행
하나에 목록 전체를 `CORRUPT_DATA`로 실패시킨다. 그래서
- 승인된 LOGOUT·ACCOUNT_DELETION purge가 그 partition의 정상 객체까지
  하나도 지우지 못하고, 개인 바이트가 기기에 계속 남는다.
- journal DB는 authority 단위라 손상 행 하나가 모든 partition의
  reconcile과 orphan GC를 멈춘다.
스스로 풀리지 않고, runbook은 journal 수동 삭제를 금지해 출구가 없다.

고른 방법 (리뷰의 (c)):
1. 두 목록은 손상 행을 건너뛰고 `corruptRows`로 센다. 행은 지우지
   않는다. 꽉 찬 페이지는 다음 행 앞에서 멈추므로 한 행은 그 행에 닿은
   페이지에서 한 번만 센다. reconcile은 `corruptTransactions`로 보고하고,
   0이 아니면 `OBJECT_RECONCILE` `DEGRADED` / `CORRUPT_DATA`로 관측한다.
2. LOGOUT·ACCOUNT_DELETION purge가 손상 때문에 끝날 수 없으면(건너뛴
   object 행, 손상으로 `CORRUPT_DATA`가 된 remove나 chunk sweep,
   `STAGING_STATE_UNREADABLE`) partition을 통째로 지운다.
   - 승인: 기존 `maintenanceReasonAllowed` + authority proof 요청·소비를
     통과한 뒤에만 이 지점에 온다. IndexedDB의 database 전체 삭제
     (0929 05-03)와 같은 조건이다.
   - 파일: 새 worker 요청 `REMOVE_PARTITION`이 origin mutation lease를
     쥔 채 `authorities/<a>/<ns>/<p>`를 지운다.
   - 행: 새 journal 메서드 `removePartition`이 그 partition 키로 시작하는
     object·journal·chunk reference 행과 budget 행을 키로 찾아 지운다.
     손상 행도 지워진다. scope binding 행은 남긴다.
   - 보고: `partitionDeleted: true`, `corruptObjects`,
     `moreObjectsAvailable: false`. 파일을 먼저, 행을 나중에 지워서 중간에
     실패해도 다시 부르면 이어서 끝난다.
버린 대안:
- 현상 유지: 손상이 있으면 삭제가 영구히 실패한다.
- 1만: reconcile·GC와 정상 객체 purge는 돌지만 손상 행의 바이트가 남는다.
- journal DB 전체 삭제: 같은 authority의 다른 partition까지 지운다.
기존 테스트 주석("손상 행이 목록 전체를 실패시키는 것이 의도")과
runbook(`browser-file-storage-recovery.md`)을 새 동작에 맞게 고쳤다.

위험·한계:
- 공개 계약 변경. `OpfsJournalPort`에 `removePartition`, 두 page 타입에
  `corruptRows`가 필수로 생겼다. journal이나 worker gateway를 직접 구현한
  쪽은 추가해야 한다(adapter가 생성 시점에 TypeError로 알린다).
  report에는 `corruptTransactions`(필수)와 `corruptObjects`·
  `partitionDeleted`(선택)가 생겼다.
- lease는 put의 BEGIN~FINISH만 막는다. 그 밖에 있던 다른 tab의 같은
  partition put은 journal 행이 지워져 다음 journal 단계에서 실패할
  것으로 보지만, 이 경합은 실행으로 확인하지 않았다.
- partition 삭제는 IndexedDB 전체 삭제처럼 시간 예산에 묶이지 않는다.
- reconcile GC의 `isChunkReferenced` 손상(리뷰 근거 ③)과 reconcile 쪽
  `STAGING_STATE_UNREADABLE`(④)은 이번 결정 범위 밖이다. purge에서만
  partition 삭제로 빠져나간다.
- offline-indexeddb 레시피 gzip: 36,889 → 37,327 B (한도 36,900, 427 B
  초과). 예산은 올리지 않았다.
- 실제 브라우저(Playwright OPFS spec)에서는 돌리지 않았다.

검증:
- RED (수정 전): journal 4건 실패 — `listIncomplete`·
  `listCommittedObjects`가 `CORRUPT_DATA`, `removePartition is not a
  function`. adapter·worker 4건 실패 — LOGOUT·ACCOUNT_DELETION purge가
  `CORRUPT_DATA`, reconcile이 `CORRUPT_DATA`, `REMOVE_PARTITION` 뒤에도
  디렉터리가 남음. 승인 거절 테스트는 수정 전후 모두 통과(가드).
- GREEN: `node scripts/run-vitest.ts run tests/unit tests/recipes`
  177 files 2,523건 통과, `tests/contract` 41건 통과.
  `tsc` app·test·node·web-worker·service-worker·recipes 통과, 바꾼 파일
  eslint 통과, `check-adapter-inventory` 통과.
- 미실행: `check:browser-file-storage-boundaries`(pnpm 필요),
  `check:architecture`(pnpm 필요), Playwright OPFS spec.

Refs: docs/reviews/2026-09-29-maturity-review/05-adapters-storage-kernel.md 05-01
2026-11-03 01:23:05 +09:00
DongHyeonka c4052f0f8e fix(storage): 여러 페이지를 다 지운 purge를 끝났다고 보고한다 (1101/13.6)
문제: OPFS `enforcePolicies`의 LOGOUT·ACCOUNT_DELETION purge가
journal 목록을 두 페이지 이상 읽으면, 객체를 모두 지워도
`moreObjectsAvailable: true`를 보고하고 chunk sweep을 하지 않는다.
페이지를 넘길 때 `moreObjectsAvailable = page.value.moreAvailable`가
true를 넣고, 마지막 페이지의 `||=`가 그 값을 그대로 둔다. 호출자는
다시 불러야 끝나고, 그 사이 chunk 바이트가 기기에 남는다.

고른 방법: 페이지 넘김 대입을 지운다. 대신 "다음 페이지를 읽기 전에
멈췄다"(객체 한도나 시간 예산 소진)는 루프 머리에서 true로 적는다.
`while` 조건을 루프 안 첫 검사로 옮긴 것이다. 0929/05-02(`85d8b59`)의
"건너뛴 객체가 있으면 true" 규칙은 그대로다. 그 값을 지우는 대입이
없다(마지막 페이지는 `||=`, PRESSURE 대입은 sweep하지 않는 purge).
버린 대안: 건너뜀 표시를 별도 변수로 나누기. 페이지 넘김 true가
남는 한 마지막 페이지에서 여전히 섞여 고쳐지지 않는다.

위험·한계:
- 동봉 IndexedDB journal은 페이지 한도를 "남은 객체 한도"로 받아 꽉 찬
  페이지를 돌려주므로, 한 번의 호출에서 두 번째 페이지가 생기지 않는다.
  결함은 port가 허용하는 짧은 페이지를 돌려주는 journal에서 드러난다.
  테스트도 그 journal(페이지 1개씩)로 재현했다.
- 동작 차이 하나: 앞선 시간 검사를 통과한 직후 첫 페이지를 읽기 전에
  시간이 다 되면, 전에는 `moreObjectsAvailable: false`로 sweep을
  시도했고 이제는 true로 보고하고 sweep하지 않는다. 아무 객체도 읽지
  않았으니 이쪽이 사실에 맞다.
- offline-indexeddb 레시피 gzip: 36,896 → 36,889 B (한도 36,900).

검증:
- RED: 새 테스트 "finishes a purge that walked more than one journal
  page"가 수정 전 `moreObjectsAvailable: true`, `chunkSweep` 없음으로
  실패했다.
- GREEN: `node scripts/run-vitest.ts run tests/unit/opfs-worker-runtime.test.ts
  tests/unit/opfs-byte-store.test.ts tests/unit/indexeddb-opfs-journal.test.ts`
  103건 통과. `tsc` app·test·web-worker 통과, 바꾼 파일 eslint 통과.

Refs: docs/reviews/2026-11-01-maturity-review/README.md 13.6절
2026-11-03 01:23:05 +09:00
DongHyeonka 68e88b081d fix(opfs): 객체를 못 지운 purge가 완료와 chunk sweep을 보고하지 않는다 (0929/05-02)
문제: OPFS purge는 remove가 CONFLICT·NOT_FOUND면 그 객체를 건너뛴다.
chunk sweep 조건은 "남은 객체가 없다"가 아니라 !moreObjectsAvailable
&& !deadlineReached && !aborted라서, 다른 탭이 같은 객체를 덮어쓰는 동안
ACCOUNT_DELETION purge를 부르면 {removedObjects: 0,
moreObjectsAvailable: false, chunkSweep: "COMPLETED"}를 돌려준다. 객체와
chunk는 남아 있는데 보고는 완료로 읽힌다. port 주석은 sweep이 "once
every object is removed"라고 약속하고 runbook도 COMPLETED를 완료
조건으로 적는다.

고른 방법: 지난 리뷰의 첫 방향. 건너뛸 때 moreObjectsAvailable을 true로
두어 report가 미완료를 드러내고 sweep 조건이 sweep을 막게 한다
(chunkSweep 칸이 빠진다). port 계약은 바꾸지 않고 코드를 기존 주석에
맞춘다. 이 값을 뒤에서 false로 되돌리는 대입이 없다는 근거(다음
페이지로 넘어가는 대입은 그 페이지에 객체가 더 있을 때만 실행되고,
PRESSURE는 sweep하지 않는다)를 코드 주석에 적었다. port의
moreObjectsAvailable 주석과 runbook에 "다시 호출한다"를 더했다.

버린 대안:
- skippedObjects 칸을 report에 더하고 완료 조건을 "skippedObjects === 0
  그리고 COMPLETED"로 고친다: port 추가와 문서 조건 변경이 필요하고
  번들도 더 커진다. offline-indexeddb 예산 여유가 9 B뿐이다.
- 따로 skipped 플래그를 두고 끝에서 합친다: 같은 동작에 바이트가 더 든다.

위험·한계:
- offline-indexeddb 레시피 번들 36,891 -> 36,896 / 36,900 gzip B.
  예산은 올리지 않았지만 여유가 4 B로 줄었다([0929] 05-04).
- 별도로 발견했고 고치지 않은 것: 여러 페이지에 걸친 purge는 마지막
  페이지의 OR 대입이 앞 페이지에서 넘어올 때 넣은 true를 유지해, 다
  지워도 moreObjectsAvailable true를 보고하고 sweep하지 않는다. 보수적
  방향이라 다시 부르면 끝나지만 한 번에 끝나지 않는다. 코드로만
  확인했고 실행하지 않았다. 동작 변경이라 범위 밖.
- 실제 브라우저(Playwright OPFS spec)에서는 돌리지 않았다.

검증:
- RED: opfs-worker-runtime "reports a purge that skipped a changing object
  as unfinished"가 `- "moreObjectsAvailable": true`
  `+ "moreObjectsAvailable": false`로 실패(removedObjects 0, 6번째 칸
  chunkSweep 존재).
- GREEN: 같은 파일 64/64 통과. 두 번째 purge가 removedObjects 1,
  chunkSweep COMPLETED, partition 파일 0개로 끝난다.
- 회귀: opfs-worker-runtime, opfs-byte-store, indexeddb-opfs-journal,
  indexeddb-local-draft 4파일 104/104 통과. tsc app·test·web-worker·
  recipes 통과, eslint 통과, verify-documentation-readiness PASS_SCOPED,
  check-optional-recipes PASS.

Refs: docs/reviews/2026-09-29-maturity-review/05-adapters-storage-kernel.md
2026-11-01 22:25:41 +09:00
donghyeon-kaandClaude Opus 5.5 33bf559bce fix(storage): check the fixed object id grammar at every write, not only by sample (05-10)
Resolving a policy only rejected predicates that admitted one of seven sample
ids, so a policy also allowing ':', '@' or letters passed BEGIN_PUT and failed
at FINISH_PUT. Writes now require the grammar alongside the policy, and the
samples cover those widenings so they are refused when the policy is resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 14:02:35 +09:00
DongHyeonkaandClaude Opus 5.5 e872bfa27d docs(storage): state that a stream can outlive a replaced OPFS generation (05-14)
Orphan GC counts its grace from when a chunk was written, so a read of an
older generation can lose its chunks once a newer put commits. Refreshing
every dropped chunk would rewrite whole objects, so the port now states the
contract instead: the stream ends NOT_FOUND / REHYDRATE and a reopen reads
the new generation. A test pins that outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:59:43 +09:00
DongHyeonkaandClaude Opus 5.5 3767ed7ccb fix(storage): refuse an OPFS policy that widens the object id grammar and keep one stableJson (05-10)
isObjectIdAllowed could be widened while stored objects, journal rows and
paths keep the fixed opaque id grammar, so such a policy failed puts late.
Resolving the policy now rejects a predicate that admits ids just outside
the grammar, and the prepared-object check uses the policy's own grammar.
The worker and the journal share one stableJson that throws on values JSON
cannot carry instead of writing NaN as null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:48:03 +09:00
DongHyeonkaandClaude Opus 5.5 2b24f6d8f0 fix(storage): fail a put whose source stalls so the OPFS origin lock is freed (05-07)
A put holds the origin-wide mutation lock from BEGIN to FINISH, and the page
waited on its source with no bound, so one stalled source blocked every
tab's writes until their lock wait failed. Each wait for source bytes is now
bounded by putIdleTimeoutMs; the put fails NOT_READABLE (retryable) and its
compensation releases the lock. The port now says writes are one at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:41:31 +09:00
DongHyeonkaandClaude Opus 5.5 6ab564f376 fix(storage): sweep a purged OPFS partition's chunks without the GC grace (05-04)
A LOGOUT or ACCOUNT_DELETION purge removed object directories only; chunk
bytes stayed until a GC 24 h later that might never run for that user.
Once every object is gone the purge now sweeps the partition's unreferenced
chunks at once and reports how the sweep ended. Chunks the journal or a
staged put still references are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:29:07 +09:00
DongHyeonkaandClaude Opus 5.5 47cf040586 fix(storage): treat an empty OPFS receipt as none and keep reconcile going past a failed row (05-02)
A first receipt write that hit the quota left a zero-byte receipt.json that
cleanup and orphan GC could not parse, so reconcile and GC for the whole
authority stopped for good. An empty receipt now counts as no receipt, and
reconcile counts a failed row, observes it and moves on to the rest and GC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:12:33 +09:00
DongHyeonkaandClaude Opus 5.5 8fc816ee25 fix(storage): hold a per-transaction lock so reconcile skips a live OPFS put (05-01)
Reconcile cleaned up any incomplete journal row, including a put still
running in another tab, and the put then reported success for deleted files.
Put and delete now hold a Web Lock per transaction from begin to return;
reconcile takes those locks with ifAvailable, re-reads the page under them
and reports the rows it skipped (D-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:09:30 +09:00
DongHyeonkaandClaude Opus 5.5 9f1dc51d89 perf(storage): open OPFS objects after a manifest-only check (Q-6.5-6)
openObject used to send VERIFY_OBJECT, which read and hashed every chunk,
and then streamed the object with READ_CHUNK, which read and hashed every
chunk again. A large object did twice the I/O before the first byte and
could exceed the RPC timeout during the pre-check.

VERIFY_OBJECT now takes an optional `manifestOnly` flag. openObject sends
it, so the pre-check only compares the stored manifest with the caller's
copy. Integrity is kept on the stream: READ_CHUNK still hashes each chunk,
and at the last chunk it also checks the chunk list against the root digest
before releasing the bytes, so a stream never ends as a success on an
unverified object. An empty object has no chunk to read, so its root digest
is still checked at open. verifyObject (reconcile) keeps the full check.

Verified: new tests in tests/unit/opfs-worker-runtime.test.ts were RED
(open read each chunk; a corrupted chunk or forged root failed at open) and
are GREEN (open reads no chunk bytes, each chunk is read once, a corrupted
chunk and a forged root digest fail the stream, empty objects are checked
at open, verifyObject still detects a corrupted chunk). All gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:30:26 +09:00
DongHyeonkaandClaude Opus 5.5 e74d835d6a fix(storage): verify stored OPFS objects by their own chunk size (R-5.5)
Prepared objects were validated in three places with different rules. The
worker required integrity.chunkSizeBytes, chunk sizes, chunk count and
object size to match the current runtime policy; the journal checked the
object against itself; the page only checked the shape. Changing
chunkSizeBytes (allowed by opfs-policy) made every existing object fail:
open returned INTEGRITY_FAILED, FILES_READY reconcile failed CORRUPT_DATA
(and, had cleanup succeeded, would have rolled back a valid object), and
COMMITTED reconcile failed INVALID_INPUT at FINALIZE_PUT.

The journal's policy-free rules move to opfs-prepared-object.ts, the one
definition of isPreparedObject (and of the physical schema check). The
worker's VERIFY_OBJECT, READ_CHUNK, FINALIZE_PUT and FILES_READY receipt
paths and the page's FINISH_PUT parse use it, so a stored object is
checked against its own manifest. The current policy still governs new
writes only: validateObjectWriteInput, BEGIN_PUT's chunk size check and
APPEND_CHUNK's size and count limits are unchanged. stableJson keeps its
two copies; they differ in how a non-finite number fails and unifying
them would change error mapping.

Verified: new test "R-5.5 stored objects are checked against their own
chunk size" writes an object with 64 KiB chunks, then reconciles and opens
it through a 128 KiB runtime. Before the fix reconcile failed CORRUPT_DATA
and open failed INTEGRITY_FAILED; now reconcile commits without rollback,
the bytes read back, and a new put uses 128 KiB chunks. A new journal test
pins that a 4 MiB-chunk object round-trips and an inconsistent one is
still rejected (passes before and after). Inventory and the storage
detail review list the new file.
Gates: check:architecture, check:types:app/test/web-worker, lint,
test:component pass; test:unit passes except removal-fixture.test.ts
(needs gitignored release artifacts absent from a fresh worktree);
check:adapter-inventory accepts the new row but still reports two rows
already missing at f0d3953 (http/platform-error-mapping.ts,
telemetry/feature-telemetry.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:27:48 +09:00
DongHyeonkaandClaude Opus 5.5 68f4a93a19 fix(storage): keep mutation lock waits out of the RPC timeout (R-5.3)
A put holds the origin-wide OPFS mutation lock from BEGIN to FINISH, and
every other BEGIN_PUT, REMOVE_OBJECT, FINALIZE_PUT, cleanup and GC request
queues on it. The page started each request's 60s RPC timer at post time,
so a second put or a remove queued behind an upload longer than 60s failed
UNAVAILABLE while the worker kept waiting and later ran it anyway.

Per D-3 the lock scope is unchanged. The worker now acquires the lock
through one wrapper built on the platform abortable-operation kernel that
bounds the wait by a new policy value, mutationLockWaitTimeoutMs (default
10 min, validated 1s..1h); a request still queued at the bound leaves the
queue and fails BLOCKED, retryable, and a lease granted after the wait
ended is released at once. The page gives requests that can queue on the
lock (listed once in the protocol as OPFS_LOCK_WAITING_REQUEST_KINDS) a
timer of rpcTimeoutMs + mutationLockWaitTimeoutMs, so queue time never
eats the request's own 60s. Other requests keep rpcTimeoutMs.

Verified: new tests "R-5.3 lock waiting is not counted against the RPC
timeout" use an exclusive FIFO lease manager and the real client and
runtime. Before the fix a put and a remove queued behind a stalled put
settled as failures at 60s, and at the policy bound they reported
UNAVAILABLE instead of BLOCKED. Now they wait, then complete once the
lock frees, or fail BLOCKED at the bound with the queue emptied.
Gates: check:architecture, check:types:app/test/web-worker, lint,
test:component pass; the hand-rolled abort ratchet in
check:adapter-inventory stays at 21; test:unit passes except
removal-fixture.test.ts, which needs gitignored release artifacts absent
from a fresh worktree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:27:48 +09:00
DongHyeonkaandClaude Opus 5.5 e28e9f75fb fix(storage): refresh chunk mtime when a put reuses it (R-5.2)
writeImmutableChunk returned early when a chunk with the same digest
already existed, so the chunk kept its old lastModified. Orphan GC decides
"not referenced" from the page journal and deletes in the worker; another
tab's GC holding a stale answer could delete a day-old chunk right after
this put reused it and left staging, and the committed object then failed
INTEGRITY_FAILED on open.

A dedup hit now rewrites the identical bytes through the atomic writable
path, which refreshes lastModified so DELETE_ORPHAN_CHUNK's grace check
skips it. Readers of the committed chunk see either copy, never a partial
file. The mutation lock scope is unchanged.

Verified: new test "R-5.2 a dedup-reused chunk is protected by the grace
period again" ages a committed chunk, reuses it from a second put and
finalizes. Before the fix LIST_ORPHAN_CANDIDATES still returned the reused
digest; now it is neither listed nor deleted and the second object
verifies.
Gates: check:architecture, check:types:app/test/web-worker, lint,
test:component pass; test:unit passes except removal-fixture.test.ts,
which needs gitignored release artifacts absent from a fresh worktree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:27:48 +09:00
DongHyeonkaandClaude Opus 5.5 d758934e9c fix(storage): page orphan GC candidates by digest cursor (R-5.1)
LIST_ORPHAN_CANDIDATES returned at most 100 old chunks in directory order,
committed ones included, and had no way to continue. Once more than 100
day-old committed chunks existed, every reconcile got the same referenced
page, deleted nothing and reported DEADLINE_REACHED; real orphans behind it
leaked quota forever.

The request now takes an optional afterDigest cursor. The worker walks
prefix directories and chunk names in ascending digest order and returns
only digests after the cursor. The coordinator pages on with the last
digest of each page until no more are available or its deadline hits.
The gateway method gets the cursor as a new trailing optional parameter.
Deletion safety checks (journal reference, staging receipts, grace period)
are unchanged.

Verified: new test "R-5.1 orphan GC pages past referenced chunks" wires the
real worker runtime, client gateway and coordinator. Before the fix it
failed with inspected 100, deleted 0, DEADLINE_REACHED; now both orphans
(lowest and highest digest) are deleted and all 150 referenced chunks
remain. The existing listOrphanCandidates call-arity assertion now expects
the extra undefined cursor argument.
Gates: check:architecture, check:types:app/test/web-worker, lint,
test:component pass; test:unit passes except removal-fixture.test.ts,
which needs gitignored release artifacts absent from a fresh worktree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:27:48 +09:00
DongHyeonkaandClaude Opus 5 632b230c82 fix: report OPFS completion honestly and bound public cache staging
A durable write whose journal transaction could not be completed returned
plain success with `SUCCEEDED` telemetry. The payload was committed but
the transaction stayed `COMMITTED`, so the reconcile backlog and its quota
pressure grew while every caller was told the write had settled. That is
now a `RECONCILE` failure with the effect certainty preserved, and an
unfinished delete is observed `DEGRADED` rather than clean.

The worker seam lost causes in both directions. A bootstrap failure
answered every request with kind `CAPABILITIES`, so the gateway read a
kind mismatch and replaced the real `BLOCKED` or `QUOTA_EXCEEDED` with a
generic `UNSUPPORTED`; the envelope's correlation is now captured once at
the listener. On the client, the pending row and its timer were released
before the reply was decoded, so a trap that threw inside the decoder left
the public promise pending with nothing left to time it out, and a
throwing `requestId` getter produced a timeout instead of a prompt
protocol failure.

Public cache staging handed its signal to each `Request` and called that
ownership. A fetch that ignored it held the mutation lock forever, and a
digest that finished after the abort still wrote both the asset and the
activation marker — publishing a release nobody was waiting for. One
terminal owner now covers the whole staging body and every await
re-checks it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 01:25:26 +09:00
DongHyeonkaandClaude Opus 5 6a8281a941 fix: make OPFS finalization and public cache repair failure-atomic
STO-RR-01. finalizePut re-acquired the origin mutation lease it was already
holding. A Web Lock is not reentrant, so an ordinary PUT stopped for good at
FINALIZE; it now calls the locked cleanup directly. A strict non-reentrant fake
lease manager pins one acquire and one release per finalization. The adapter no
longer reports a failed finalization as a plain write success either: the
journal row stays COMMITTED for reconciliation, but the caller is told the
write did not settle.

STO-RR-02. A failure raised while serving a validated request now carries that
request's kind. Defaulting every catch to CAPABILITIES made the client's own
expected-kind check reject genuine quota, integrity and abort failures as
protocol breaches and report them as UNSUPPORTED. Only an envelope the runtime
could not read still answers at protocol level.

STO-RR-03. The worker client decodes a response instead of adopting it: exact
own-data descriptors, the negotiated protocol version, the exact awaited kind,
a code inside the closed BrowserDataFailure set and a boolean retryable. An
accessor, a proxy trap, an inherited or extra field and an unknown code all
close the call as UNSUPPORTED rather than leaving it to time out.

STO-RR-04. A marker read that fails transiently is unknown, not damaged, so it
no longer deletes the candidate that may be serving traffic. Only a confirmed
corrupt or missing marker enters the repair path.

STO-RR-05. Staging never deletes a candidate it did not create. A repair
replaces exact entries in place, so a failed fetch leaves every healthy asset
and the active release usable; a candidate this call created is still removed
on failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 14:00:41 +09:00
DongHyeonkaandClaude Opus 5 f6098242be fix: bound migration commits and version the OPFS worker protocol
STO-06: the IndexedDB codec migration commit chain runs entirely inside
IndexedDB callbacks, so up to maxRows records could keep executing past the
caller's cooperative deadline. The monotonic budget is now re-checked before
each record's first write; a started record still completes atomically, the
checkpoint advances only to the last safe key, and a clock failure aborts the
transaction rather than committing an unbounded batch.

STO-07: every OPFS worker request and response now carries
OPFS_WORKER_PROTOCOL_VERSION = 2, responses echo their request kind, and the
client validates the envelope and failure shape strictly while remembering the
expected kind per pending request. A page/worker release mismatch or a reply for
a different operation closes as UNSUPPORTED instead of being decoded as a value
of the wrong shape. UNSUPPORTED is used deliberately: the closed browser-data
taxonomy has no INCOMPATIBLE code and none was invented.

SW-10 and the OPFS/Web Push V2 wire rollouts remain deferred: they are
expand/dual-read/drain/contract deployments across releases rather than a single
in-repo change. The ledger records them as DEFERRED_TO_MIGRATION.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 00:41:12 +09:00
DongHyeonkaandClaude Opus 5 618da9abf5 fix: preserve OPFS recovery authority during cleanup
Repair the compensating half of the OPFS put saga.

The coordinator now owns a single abortPreparedPut() driven by a
composition-owned bounded signal instead of the caller's already aborted one,
and the worker client no longer issues a duplicate fire-and-forget abort.
Journal rows and budget reservations are released only after the physical
effect is confirmed CLEANED or ALREADY_CLEAN; a timeout, malformed response or
EFFECT_UNKNOWN keeps PREPARING/FILES_READY and returns OBJECT_RECONCILE.

New writes carry a transaction-unique physicalGenerationId through the staging
receipt, manifest path and prepared object, so a late compensation deletes only
its own transaction's directory even when a newer transaction legitimately
reuses the same logical generation. v1 paths, receipts and prepared objects stay
readable through the rollback window.

Abort and cleanup hold the origin mutation lease through physical deletion and
staging removal. A transaction that never reached staging returns ALREADY_CLEAN
without waiting for the lease, which would otherwise deadlock against the BEGIN
it is cancelling.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 23:21:58 +09:00
DongHyeonka c6da03369c refactor: 리펙토링 2026-08-01 19:39:59 +09:00
donghyeon-ka 6c52cdb916 feat: 기능 추가 과정중 2026-07-30 15:58:20 +09:00