From eb0e649c30f989fc485d7278dc82b5ae89011596 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Wed, 1 Jul 2026 15:08:16 -0500 Subject: [PATCH] fix(test): avoid observeAll() in MessageDaoRetentionTest (CI compile glitch) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The androidTest compile failed ONLY in CI with "Unresolved reference 'observeAll'" on the single line using dao.observeAll(), while every other MessageDao call in the same file resolved, the identical observeAll().first().map{}.toSet() in LibreMailDatabaseTest compiled fine in the same unit, and the file compiled cleanly locally (even `clean --no-build-cache`). That points to a Kotlin incremental-compilation artifact specific to the newly-added file, not a code error. Replace the observeAll()-based readback with explicit getById point lookups — a clearer per-row assertion that also sidesteps the glitch. Verified on the API 37 emulator (5/5). Co-Authored-By: Claude Opus 4.8 --- .../data/local/MessageDaoRetentionTest.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoRetentionTest.kt b/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoRetentionTest.kt index ecb2a74..9e4e2e5 100644 --- a/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoRetentionTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoRetentionTest.kt @@ -5,10 +5,10 @@ import android.content.Context import androidx.room.Room import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 -import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking import org.junit.After import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull import org.junit.Assert.assertNull import org.junit.Before import org.junit.Test @@ -138,10 +138,14 @@ class MessageDaoRetentionTest { dao.deleteSyncedInWindowNotIn("acct", "INBOX", minWindowUid = 20, keepIds = listOf("kept")) - assertEquals( - setOf("below", "kept", "search", "other-folder"), - dao.observeAll().first().map { it.id }.toSet(), - ) + // Read survivors back with point lookups (getById) rather than observeAll(): explicit about each + // row's fate, and it keeps the assertion off the Flow API. + assertNull("gone-1 is in-window and unkept -> deleted", dao.getById("gone-1")) + assertNull("gone-2 is in-window and unkept -> deleted", dao.getById("gone-2")) + assertNotNull("below-window history must survive", dao.getById("below")) + assertNotNull("the kept row must survive", dao.getById("kept")) + assertNotNull("search rows are not synced -> untouched", dao.getById("search")) + assertNotNull("other folders are untouched", dao.getById("other-folder")) } /**