fix(storage): prevent history wipe on transient dataStore errors#1052
Open
ifoche wants to merge 1 commit intodevelopmentfrom
Open
fix(storage): prevent history wipe on transient dataStore errors#1052ifoche wants to merge 1 commit intodevelopmentfrom
ifoche wants to merge 1 commit intodevelopmentfrom
Conversation
StorageDataStoreClient.getObject() was catching ALL errors and returning undefined, making network failures indistinguishable from missing keys. Collection mutation methods (saveObjectInCollection, etc.) treated undefined as "empty collection" via ?? [], then overwrote the dataStore key — wiping sync history on any transient error. Now getObject returns undefined only for 404 (key not found) and re-throws on network errors, 5xx, and timeouts. Also applies the same fix to getMetadataByKey. Adds 6 unit tests. StorageConstantClient was verified to not have this bug — it queries constants via the models API which returns empty arrays (not 404s) for missing entries. Closes: https://app.clickup.com/t/869c32tg2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
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.
Summary
StorageDataStoreClient.getObject()silently returningundefinedon all errors (network, 5xx, timeout), which was indistinguishable from "key not found" (404)saveObjectInCollectioncall — the existing history was treated as empty and overwritten with just the new entrygetObjectreturnsundefinedonly for 404 and re-throws on transient errors. Same fix applied togetMetadataByKey()StorageConstantClientwas verified to not have this bug (it uses the models API which returns empty arrays, not 404s)Related Tasks
Test plan
yarn test— all 394 tests pass (48 files)yarn build core-app— builds cleanlyundefined(e.g., first-time app setup works correctly)🤖 Generated with Claude Code