Expose DB Corrupt Error and Rethrow Errors - #82
Merged
Eliran Eretz-Kedosha (eliranek1) merged 4 commits intoApr 15, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves debuggability and correctness of IndexedDB/InMemory providers by surfacing previously swallowed failure modes (blocked opens/deletes, version changes, upgrade data loss, and cursor migration errors), and by returning/propagating real errors and promises to callers.
Changes:
- Add telemetry hooks for
onblocked,onversionchange, and ChromiumdataLoss/dataLossMessage, and improve open/upgrade/transaction error formatting. - Stop swallowing migration cursor errors; ensure
removeRangereturns the removal promise. - Fix InMemory error propagation and add extensive test coverage for the new behaviors.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/extended-idb.d.ts | Adds global typing for Chromium’s non-standard IDBVersionChangeEvent.dataLoss* fields. |
| src/ObjectStoreProvider.ts | Extends UpgradeMetadata to include dataLoss and dataLossMessage. |
| src/IndexedDbProvider.ts | Adds blocked/versionchange handlers, rethrows migration cursor errors, improves error messages, fixes removeRange return. |
| src/InMemoryProvider.ts | Ensures getKeysForRange rejects with the actual error. |
| src/tests/ObjectStoreProvider.spec.ts | Adds tests for new error/telemetry behavior and promise/error propagation fixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vladar
previously approved these changes
Apr 15, 2026
vladar
left a comment
There was a problem hiding this comment.
Looks good to me, but Copilot comment about flaky tests is a valid concern.
amshankamsft
approved these changes
Apr 15, 2026
mlaw-
approved these changes
Apr 15, 2026
Eliran Eretz-Kedosha (eliranek1)
merged commit Apr 15, 2026
0300101
into
master
4 of 5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Several error conditions in the IndexedDB provider were being silently swallowed, making production issues difficult to diagnose:
dataLoss/dataLossMessage— Chromium's non-standardIDBVersionChangeEventproperties were completely ignored, meaning total data loss during upgrades went undetectedonblockedevents — No handler onIDBOpenDBRequestordeleteDatabase, so blocked opens/deletes were invisibleonversionchange— Not handled, providing no visibility when another connection triggers a version upgraderemoveRangemissingreturn— Theremove()call result was discarded, so callers couldn't await completiongetKeysForRangerejecting withvoid 0— Actual error object was thrown away"Wiping db success"logged unconditionally — Logged even after a failed wipe[object Object]in error messages — DB open errors used${err}instead oferr.message/err.nameerror.name— Onlymessagewas logged, omitting the DOMException name (e.g.,QuotaExceededError)Changes
IndexedDbProvider.ts
onblockedhandler onIDBOpenDBRequest— logs when open is blocked by existing connectionsevent.dataLoss/event.dataLossMessageinonupgradeneeded, log error on"total", pass throughUpgradeMetadataonversionchangehandler — logs a warning (does not auto-close; existing connection has priority)onblockedhandler on_deleteDatabaseInternalremoveRangetoreturn this.remove(keys)err?.target?.error?.message/.name"Wiping db success"→"Wiping db completed"error.namein transaction error/abort detail stringsObjectStoreProvider.ts
dataLoss?: "none" | "total"anddataLossMessage?: stringtoUpgradeMetadataInMemoryProvider.ts
getKeysForRangeto reject with the actual error instead ofvoid 0extended-idb.d.ts
IDBVersionChangeEventwithdataLossanddataLossMessage(Chromium non-standard properties)ObjectStoreProvider.spec.ts
Testing
All tests pass in ChromeHeadless via
yarn test:ci.