Fix MutableStore.write() ignoring SourceOfTruth write failures#727
Merged
matt-ramotar merged 4 commits intomainfrom Jan 11, 2026
Merged
Fix MutableStore.write() ignoring SourceOfTruth write failures#727matt-ramotar merged 4 commits intomainfrom
matt-ramotar merged 4 commits intomainfrom
Conversation
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #727 +/- ##
==========================================
+ Coverage 79.17% 79.21% +0.04%
==========================================
Files 42 42
Lines 941 919 -22
Branches 169 174 +5
==========================================
- Hits 745 728 -17
+ Misses 120 116 -4
+ Partials 76 75 -1
🚀 New features to boost your workflow:
|
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStore.kt
Show resolved
Hide resolved
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
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.
Closes #722
Problem
MutableStore.write()returnedStoreWriteResponse.Successeven whenSourceOfTruth.write()failed, causing silent data loss. Callers received explicit success while their data was never persisted.Root Cause
SourceOfTruthWithBarrier.write()caught exceptions from the delegate but only propagated errors to readers via the barrier mechanism. It never surfaced errors back to write callers. Consequently,RealStore.write()always returnedStoreDelegateWriteResult.Success.Solution
Changed
SourceOfTruthWithBarrier.write()to returnSourceOfTruth.WriteException?instead ofUnit. This enables:RealStore.write()to check the return value and return appropriateStoreDelegateWriteResultRealMutableStoreto surface write errors to callersFetcherControllerto continue working unchanged (ignores return value)Note
Fixes silent data loss by propagating SourceOfTruth write failures and gating follow-up actions.
SourceOfTruthWithBarrier.writeto returnSourceOfTruth.WriteException?; still emits barrier error to readersRealStore.writeto interpret the new return value and only cache on success, returningStoreDelegateWriteResult.Erroron failureRealMutableStorewrite flow to proceed to network only if the local write succeeds; surface local write errors asStoreWriteResponse.ErrorTestStoreto usesourceOfTruth = null; trackpostCallCountinTestUpdaterWritten by Cursor Bugbot for commit f12f175. This will update automatically on new commits. Configure here.