music: keep Auto tree empty when library store fails (#tests)
- Commit
4db96e933754d9161139ed78d9bb2bb2d1ddd67c- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-14 23:24 UTC (21 days ago)
- Parents
3950bd6
MusicLibraryTree's init collector had no catch: when Room's SQLCipher native is unavailable (host JVM under Robolectric) the combine flow threw UnsatisfiedLinkError on Dispatchers.Default, escaping as an uncaught exception that kotlinx-coroutines-test then blamed on the next test (MusicDetailScreensTest.nowPlaying UncaughtExceptionsBeforeTest). Catch upstream failures and leave the browse tree empty, which is the correct degradation for the car browse snapshot anyway. Verified: :music:testDevUnitTest MusicDetailScreensTest green.
Diff
music/src/main/java/com/vayunmathur/music/service/MusicLibraryTree.kt
diff --git a/music/src/main/java/com/vayunmathur/music/service/MusicLibraryTree.kt b/music/src/main/java/com/vayunmathur/music/service/MusicLibraryTree.ktindex 0de5ebae30..54bb765b9f 100644--- a/music/src/main/java/com/vayunmathur/music/service/MusicLibraryTree.kt+++ b/music/src/main/java/com/vayunmathur/music/service/MusicLibraryTree.kt@@ -18,6 +18,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel+import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch @@ -60,6 +61,11 @@ class MusicLibraryTree(context: Context) { repo.playlists, repo.matchings, ) { m, al, ar, pl, mt -> Snapshot(m, al, ar, pl, mt) }+ // A dead store (e.g. SQLCipher native missing on a host+ // JVM) must leave the tree empty, not escape as an+ // uncaught exception on Dispatchers.Default that then+ // poisons unrelated coroutines/tests sharing the process.+ .catch { } .collect { snap -> songs = snap.songs albums = snap.albums