Two small holes in the IndexedDB kernel (src/adapters/platform/):
- runIndexedDbTransaction: a `fail(x)` after `succeed()` kept the success
candidate, so the abort it triggered was reported as an anonymous
NATIVE_EXCEPTION and `x` was lost. `fail` now replaces a success
candidate; an earlier failure still wins.
- openIndexedDbDatabase: when the open had already settled (caller abort,
terminal BLOCKED, blocked deadline, close) before `onupgradeneeded`
fired, the upgrade still ran and committed the migration. The handler now
aborts the versionchange transaction when the open is already settled.
Tests that encoded the old behavior were updated in this commit:
tests/unit/indexeddb-transaction.test.ts ("an abort after succeed...")
expected NATIVE_EXCEPTION and now expects the caller's failure, and
tests/unit/indexeddb-runtime.test.ts ("times out a blocked upgrade...")
expected the late upgrade to commit and its connection to be closed; it now
expects no schema commit. Both fail without the fix.
Verified: new tests (fail after succeed on a real fake DB does not commit,
first failure still wins, late upgrade after caller abort and after
BLOCKED is aborted without running the upgrade callback) were RED and are
GREEN. All gates pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SESSION_END, LOGOUT and ACCOUNT_DELETION purges validated every row they
were about to delete and checked the dataset budget counters on each step.
One unreadable record, a record without a valid sidecar, a bad receipt or
a budget counter off by one aborted the batch with CORRUPT_DATA, and the
next batch restarted and hit the same row, so the partition's personal
data never left the device.
The partition purge now deletes by key without making row validity a
precondition. Rows that fail validation are counted and reported as one
CORRUPT_DATA observation per batch through the existing observe channel.
Per-row budget arithmetic is removed; the transaction that finds every
store empty resets the budget row to zero, which also heals a drifted
counter. Between batches the budget can only read high (blocks writes,
never admits). The purge still opens only the partition's own database,
whose name is derived from the partition token. RETENTION_SWEEP is
unchanged and still fails closed on corrupt rows.
Verified: new test "R-5.4 completes a LOGOUT/ACCOUNT_DELETION purge past
corrupt rows" seeds a corrupt record, an invalid sidecar, an invalid
orphan sidecar, an invalid receipt and a drifted budget. Before the fix
the first batch failed CORRUPT_DATA; now the purge reaches COMPLETE, all
rows are gone, the budget is zero, a CORRUPT_DATA observation is emitted,
and a second partition routed through the same factory keeps its row.
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>
2902 -> 2744줄 (코드 2807 -> 2563, 주석 12 -> 111). 네 번째이자 마지막
사본이다. 손수 abort 리스너가 0이 되어 래칫을 22에서 21로 조인다.
RT-1을 보존했다: 번역기가 CLOSED -> unavailable을 명시 매핑한다. 빠뜨리면
close() 중 진행 중이던 open이 ABORTED로 보고된다.
RT-2는 보존하지 못했다. 사양은 "의미 동일"이라고 썼지만 실제로는 blocked
데드라인 이후 재시도가 새 factory.open()을 띄운다(이행 전에는 안 띄웠다).
커널에 "settle 이후에도 살아 있는 요청"을 알려줄 훅이 없어서 커널을 고치지
않고는 불가능하다. 연결 누수나 데이터 위험은 없고 낭비되는 요청만 는다.
다음 커밋에서 커널에 onSettled를 추가해 복원한다.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>