Add reproduction for platform-browser/BrowserKeyValueStore issue - #6857
Conversation
🦋 Changeset detectedLatest commit: 5b02317 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a single-file reproduction test that mocks IndexedDB to surface the transaction-commit bug.
BrowserKeyValueStoreTransaction.test.ts— mocksindexedDB,IDBTransaction, andIDBObjectStoreto firerequest.onsuccessbeforetransaction.onabortin the same microtask, then assertsEffect.result(store.set(...))is a failure.
The test correctly reproduces the root cause: idbRequest in BrowserKeyValueStore.ts:153 resolves the effect on request.onsuccess without tracking the transaction lifecycle. Until that is fixed, a readwrite transaction that aborts after individual request completion will report a false success.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a fix that adds idbWriteRequest to properly track IndexedDB transaction lifecycle for write operations.
idbWriteRequestinBrowserKeyValueStore.ts— new callback-based effect that creates its own readwrite transaction and resolves only ontransaction.oncomplete, mappingtransaction.onabortandtransaction.onerrortoKeyValueStoreErrorfailures.clear,set,removenow useidbWriteRequest— replaced directidbRequest+getKvsEntriesStorecalls so that write operations no longer report success before the transaction commits.
The original idbRequest remains in place for read-only operations (get, getUint8Array, size), which is appropriate since readonly transactions have no silent-abort problem.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
| @@ -0,0 +1,73 @@ | |||
| import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore" | |||
There was a problem hiding this comment.
Can we please remove this test file and merge it into the main one?
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — merged the standalone transaction test into the main test file and added a changeset.
- Moved regression test into
BrowserKeyValueStore.test.ts— theBrowserKeyValueStoreTransaction.test.tsfile was deleted and its test was folded into the existingdescribe("KeyValueStore / layerIndexedDb", …)block, using a separate database name for isolation from the sharedtestLayer. - Renamed
indexedDBtofailingIndexedDb— avoids shadowing the top-level import fromfake-indexeddb. - Added changeset —
@effect/platform-browserpatch for the transaction-commit fix.
All prior review feedback is addressed. No source implementation changes since the last review.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
KeyValueStoremutations as successfulKeyValueStoreErrorTesting
Closes EFF-299