Skip to content

Conversation

@matt-ramotar
Copy link
Collaborator

@matt-ramotar matt-ramotar commented Jan 11, 2026

Closes #660

Problem

When Converter.fromNetworkToLocal() throws an exception, store.stream() and store.get() hang indefinitely instead of emitting an error.

Root Cause

Conversion happens inside the Multicaster's onEach callback. Exceptions there propagate to the internal actor, which terminates and closes downstream channels silently. This means no error signal reaches collectors.

Solution

Move conversion and SourceOfTruth writes from onEach into the source flow's map operator. Exceptions are now caught and emitted as StoreReadResponse.Error.Exception, allowing callers to handle them appropriately.


Note

Addresses hanging when Converter.fromNetworkToLocal() throws by handling conversion inside the fetcher source and emitting errors.

  • In FetcherController, move conversion and SOT writes from onEach to the source map with try/catch; rethrow CancellationException, emit StoreReadResponse.Error.Exception on failure; no-op onEach to avoid actor shutdowns
  • In RealStore, adjust disk/network merge: unlock disk on network Data/NoNewData/Error; track networkErrorWithNoFallback to suppress SOT emissions for fresh requests when fallback is disabled; preserve fetcher name in origins
  • Add tests validating error emission, fetcher name propagation, flow completion on fresh, fallback enabled/disabled behavior, and recovery when conversion later succeeds

Written by Cursor Bugbot for commit 50dc877. This will update automatically on new commits. Configure here.

Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.76%. Comparing base (d4e94b4) to head (50dc877).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ilenativefoundation/store/store5/impl/RealStore.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #728      +/-   ##
==========================================
+ Coverage   79.17%   79.76%   +0.58%     
==========================================
  Files          42       42              
  Lines         941      919      -22     
  Branches      169      172       +3     
==========================================
- Hits          745      733      -12     
+ Misses        120      111       -9     
+ Partials       76       75       -1     
Files with missing lines Coverage Δ
...efoundation/store/store5/impl/FetcherController.kt 98.14% <100.00%> (ø)
...ilenativefoundation/store/store5/impl/RealStore.kt 89.39% <88.88%> (+0.67%) ⬆️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
Signed-off-by: Matt Ramotar <matt.ramotar@uber.com>
@matt-ramotar matt-ramotar merged commit 4462b92 into main Jan 11, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in Store Roadmap Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Error in store converter hangs store.get() calls indefinitely

2 participants