4abca173f83c
test: pin 2-paired-device reconcile counts (v2.9.18)
- time
- 2026-07-31 13:06 UTC · 2 months ago
- machine
- koh2
- parent
- 453bcdaba9ef
↓ peach-android-4abca173.tar.gzatlas at this save
files changed2 files
VERSION+1 −1app/src/test/java/com/peachpasswords/sync/CloudRelayReconnectListenerTest.kt+41 −0VERSION+1 −1
@@ -1 +1 @@1-2.9.17\ No newline at end of file1+2.9.18\ No newline at end of fileapp/src/test/java/com/peachpasswords/sync/CloudRelayReconnectListenerTest.kt+41 −0
@@ -139,6 +139,47 @@139139 )140140 }141141 142+ @Test143+ fun `reconcile logs both paired devices as eligible when 2 direct-trust extensions are paired`() = runBlocking {144+ // This is the wire output visible at the 00:14:42.592 moment in the145+ // logcat you saw after Firefox + Chrome both paired. The count has to146+ // grow as a new device is added — any off-by-one or stale-cache bug147+ // shows up here as the wrong N.148+ val devices = listOf(149+ PairedDevice(150+ deviceId = "firefox",151+ deviceName = "Firefox",152+ deviceType = "extension",153+ trustSource = "direct",154+ pairedAt = 1L,155+ ),156+ PairedDevice(157+ deviceId = "chrome",158+ deviceName = "Chrome",159+ deviceType = "extension",160+ trustSource = "direct",161+ pairedAt = 2L,162+ ),163+ )164+ val fakeDeviceStore = object : PairedDeviceRegistry {165+ override fun getAll() = devices166+ override fun get(id: String) = devices.firstOrNull { it.deviceId == id }167+ override fun upsert(device: PairedDevice) = Unit168+ override fun applyManifestBatch(batch: DeviceManifestRegistryBatch) = true169+ }170+171+ val logs = capturePeachSyncLogs {172+ logRelayReconcileInventory(fakeDeviceStore)173+ }174+175+ assertEquals(176+ listOf(177+ Log.INFO to "cloud-relay: reconcile start — 2 paired device(s), 2 eligible",178+ ),179+ logs,180+ )181+ }182+142183 private data class KeyPair(val publicKey: ByteArray, val privateKey: ByteArray)143184 144185 private fun keys(): KeyPair {