Colota - Android GPS Location tracker
refactor: remove maxRetries setting and always retry failed uploads indefinitely
Max Dietrichcafe70385506
diff --git a/apps/docs/docs/api-reference.md b/apps/docs/docs/api-reference.mdindex 19f5a677..47359595 100644--- a/apps/docs/docs/api-reference.md+++ b/apps/docs/docs/api-reference.md@@ -128,16 +128,17 @@ Your server only needs to return a 2xx status code. The response body is not rea## Error Handling-| Error Type | Behavior |-| --- | --- |-| **Any non-2xx response** | Queued for retry with exponential backoff |-| **Network timeout** | Retried with backoff (10s connection, 10s read timeout) |-| **Max retries exceeded** | Item permanently deleted from queue (location data remains in the database and can still be exported). Enable "Retry Failed Uploads" to retry indefinitely instead. |+| Error Type | Behavior |+| ------------------------ | ------------------------------------------ |+| **Any non-2xx response** | Queued for retry |+| **Network timeout** | Retried (10s connection, 10s read timeout) |-There is no distinction between 4xx and 5xx in retry behavior - all failures are retried.+There is no distinction between 4xx and 5xx in retry behavior - all failures are retried indefinitely. Failed items stay in the queue until they succeed or you clear the queue manually. Location data is never deleted.## Retry Strategy+When consecutive sync attempts fail, Colota uses exponential backoff:+```Attempt 1: ImmediateAttempt 2: +30s delay@@ -146,7 +147,7 @@ Attempt 4: +300s delay (5 minutes)Attempt 5+: +900s delay (15 minutes)```-By default, failed items are permanently deleted from the sync queue after 5 failed send attempts. Enable **Retry Failed Uploads** in advanced settings to keep retrying indefinitely. Either way, the location data itself is never deleted - it stays in the `locations` table and can still be exported.+Failed items stay in the queue indefinitely until they succeed. The queue can be cleared manually in Settings > Data Management if needed.## Network Requirementsdiff --git a/apps/docs/docs/configuration/server-settings.md b/apps/docs/docs/configuration/server-settings.mdindex 8c672c5e..5d158519 100644--- a/apps/docs/docs/configuration/server-settings.md+++ b/apps/docs/docs/configuration/server-settings.md@@ -4,13 +4,12 @@ sidebar_position: 3# Server Settings-| Setting | Description | Default | Range |-| -------------------- | ----------------------------------------- | --------------- | ----------- |-| Endpoint | HTTP(S) URL of your server | Empty (offline) | -- |-| HTTP Method | POST (JSON body) or GET (query params) | POST | POST / GET |-| Sync Interval | Batch mode interval | Instant (0) | 0s - Custom |-| Retry Failed Uploads | Keep retrying failed uploads indefinitely | Off | On/Off |-| Offline Mode | Disable all network activity | Disabled | On/Off |+| Setting | Description | Default | Range |+| ------------- | -------------------------------------- | --------------- | ----------- |+| Endpoint | HTTP(S) URL of your server | Empty (offline) | -- |+| HTTP Method | POST (JSON body) or GET (query params) | POST | POST / GET |+| Sync Interval | Batch mode interval | Instant (0) | 0s - Custom |+| Offline Mode | Disable all network activity | Disabled | On/Off |## Endpoint URL@@ -56,7 +55,7 @@ The UI simplifies to remove sync-related elements that don't apply:- Server Endpoint and Test Connection- Authentication & Headers- API Field Mapping-- Sync Interval, Retry Failed Uploads, Wi-Fi Only Sync+- Sync Interval, Wi-Fi Only Sync- Queue statistics (Queued / Sent counts)- Queue actions (Sync Now, Clear Sent History, Clear Queue)- Queue info in the tracking notification@@ -75,16 +74,16 @@ Toggle offline mode off in Settings to return to online mode. If you had an endp## Retry Behavior-When a sync attempt fails, Colota retries with exponential backoff:+When sync attempts fail, Colota uses exponential backoff:```Attempt 1: Immediate-Attempt 2: +30s-Attempt 3: +60s (1 minute)-Attempt 4: +300s (5 minutes)-Attempt 5+: +900s (15 minutes)+Attempt 2: +30s delay+Attempt 3: +60s delay (1 minute)+Attempt 4: +300s delay (5 minutes)+Attempt 5+: +900s delay (15 minutes)```-By default, failed uploads are **permanently deleted after 5 failed send attempts**. Enable **Retry Failed Uploads** in advanced settings to keep retrying indefinitely - failed uploads stay in the queue until they succeed. Note that this may cause queue buildup if your server is unreachable for extended periods.+Failed uploads stay in the queue and are retried indefinitely until they succeed. No data is ever dropped due to failed sync attempts. You can clear the queue manually in Settings > Data Management if needed.The app also auto-syncs when network connectivity is restored.diff --git a/apps/docs/docs/guides/deep-link-setup.md b/apps/docs/docs/guides/deep-link-setup.mdindex 0d3e6960..ae4933ee 100644--- a/apps/docs/docs/guides/deep-link-setup.md+++ b/apps/docs/docs/guides/deep-link-setup.md@@ -22,7 +22,6 @@ The `config` parameter is a base64-encoded JSON object. Only include the setting"interval": 10,"distance": 5,"syncInterval": 300,- "maxRetries": 5,"retryInterval": 30,"accuracyThreshold": 50,"filterInaccurateLocations": true,@@ -64,7 +63,6 @@ The `config` parameter is a base64-encoded JSON object. Only include the setting| `interval` | number | GPS polling interval in seconds (must be > 0) || `distance` | number | Minimum movement in meters before recording a new location || `syncInterval` | number | Batch sync interval in seconds (0 = instant) |-| `maxRetries` | number | Max retry attempts for failed uploads || `retryInterval` | number | Seconds between retry attempts || `accuracyThreshold` | number | Discard locations less accurate than this (meters) || `filterInaccurateLocations` | boolean | Enable accuracy filtering |diff --git a/apps/mobile/android/app/src/main/java/com/colota/data/DatabaseHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/data/DatabaseHelper.ktindex 5dbd6d4c..bdb73e61 100644--- a/apps/mobile/android/app/src/main/java/com/colota/data/DatabaseHelper.kt+++ b/apps/mobile/android/app/src/main/java/com/colota/data/DatabaseHelper.kt@@ -161,7 +161,6 @@ class DatabaseHelper private constructor(context: Context) :"syncInterval" to "0","accuracyThreshold" to "50.0","filterInaccurateLocations" to "false",- "maxRetries" to "5","retryInterval" to "30","isOfflineMode" to "false","isWifiOnlySync" to "false",diff --git a/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt b/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.ktindex f2d980cb..55644e78 100644--- a/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt+++ b/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt@@ -923,7 +923,6 @@ class LocationForegroundService : Service() {endpoint = config.endpoint,syncIntervalSeconds = config.syncIntervalSeconds,retryIntervalSeconds = config.retryIntervalSeconds,- maxRetries = config.maxRetries,isOfflineMode = config.isOfflineMode,isWifiOnlySync = config.isWifiOnlySync,authHeaders = secureStorage.getAuthHeaders(),diff --git a/apps/mobile/android/app/src/main/java/com/colota/service/ServiceConfig.kt b/apps/mobile/android/app/src/main/java/com/colota/service/ServiceConfig.ktindex 60f17bec..391a000d 100644--- a/apps/mobile/android/app/src/main/java/com/colota/service/ServiceConfig.kt+++ b/apps/mobile/android/app/src/main/java/com/colota/service/ServiceConfig.kt@@ -20,7 +20,6 @@ data class ServiceConfig(val interval: Long = 5000L,val minUpdateDistance: Float = 0f,val syncIntervalSeconds: Int = 0,- val maxRetries: Int = 5,val accuracyThreshold: Float = 50.0f,val filterInaccurateLocations: Boolean = false,val retryIntervalSeconds: Int = 30,@@ -43,7 +42,6 @@ data class ServiceConfig(interval = saved["interval"]?.toLongOrNull() ?: 5000L,minUpdateDistance = saved["minUpdateDistance"]?.toFloatOrNull() ?: 0f,syncIntervalSeconds = saved["syncInterval"]?.toIntOrNull() ?: 0,- maxRetries = saved["maxRetries"]?.toIntOrNull() ?: 5,accuracyThreshold = saved["accuracyThreshold"]?.toFloatOrNull() ?: 50.0f,filterInaccurateLocations = saved["filterInaccurateLocations"]?.toBoolean() ?: false,retryIntervalSeconds = saved["retryInterval"]?.toIntOrNull() ?: 30,@@ -88,7 +86,6 @@ data class ServiceConfig(interval = config.getDoubleOrNull("interval")?.toLong() ?: dbConfig.interval,minUpdateDistance = config.getDoubleOrNull("minUpdateDistance")?.toFloat() ?: dbConfig.minUpdateDistance,syncIntervalSeconds = config.getIntOrNull("syncInterval") ?: dbConfig.syncIntervalSeconds,- maxRetries = config.getIntOrNull("maxRetries") ?: dbConfig.maxRetries,accuracyThreshold = config.getDoubleOrNull("accuracyThreshold")?.toFloat() ?: dbConfig.accuracyThreshold,filterInaccurateLocations = config.getBooleanOrNull("filterInaccurateLocations") ?: dbConfig.filterInaccurateLocations,retryIntervalSeconds = config.getIntOrNull("retryInterval") ?: dbConfig.retryIntervalSeconds,@@ -110,7 +107,6 @@ data class ServiceConfig(interval = extras.getLongOrDefault("interval", dbConfig.interval),minUpdateDistance = extras.getFloatOrDefault("minUpdateDistance", dbConfig.minUpdateDistance),syncIntervalSeconds = extras.getIntOrDefault("syncInterval", dbConfig.syncIntervalSeconds),- maxRetries = extras.getIntOrDefault("maxRetries", dbConfig.maxRetries),accuracyThreshold = extras.getFloatOrDefault("accuracyThreshold", dbConfig.accuracyThreshold),filterInaccurateLocations = extras.getBooleanOrDefault("filterInaccurateLocations", dbConfig.filterInaccurateLocations),retryIntervalSeconds = extras.getIntOrDefault("retryInterval", dbConfig.retryIntervalSeconds),@@ -132,7 +128,6 @@ data class ServiceConfig(putExtra("syncInterval", syncIntervalSeconds)putExtra("accuracyThreshold", accuracyThreshold)putExtra("filterInaccurateLocations", filterInaccurateLocations)- putExtra("maxRetries", maxRetries)putExtra("retryInterval", retryIntervalSeconds)putExtra("isOfflineMode", isOfflineMode)putExtra("isWifiOnlySync", isWifiOnlySync)diff --git a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.ktindex 6cafa3da..0dad87c3 100644--- a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt+++ b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt@@ -29,7 +29,6 @@ class SyncManager(@Volatile private var endpoint: String = ""@Volatile private var syncIntervalSeconds: Int = 0@Volatile private var retryIntervalSeconds: Int = 300- @Volatile private var maxRetries: Int = 5@Volatile private var isOfflineMode: Boolean = false@Volatile private var isWifiOnlySync: Boolean = false@Volatile private var authHeaders: Map<String, String> = emptyMap()@@ -49,7 +48,6 @@ class SyncManager(endpoint: String,syncIntervalSeconds: Int,retryIntervalSeconds: Int,- maxRetries: Int,isOfflineMode: Boolean,isWifiOnlySync: Boolean,authHeaders: Map<String, String>,@@ -59,7 +57,6 @@ class SyncManager(this.endpoint = endpointthis.syncIntervalSeconds = syncIntervalSecondsthis.retryIntervalSeconds = retryIntervalSeconds- this.maxRetries = maxRetriesthis.isOfflineMode = isOfflineModethis.isWifiOnlySync = isWifiOnlySyncthis.authHeaders = authHeaders@@ -198,8 +195,6 @@ class SyncManager(val currentAuthHeaders = authHeadersval currentHttpMethod = httpMethodval currentApiFormat = apiFormat- val currentMaxRetries = maxRetries // 0 = retry forever, >0 = give up after N attempts-var totalProcessed = 0var totalSucceeded = 0var totalFailed = 0@@ -221,20 +216,8 @@ class SyncManager(for (chunk in queued.chunked(10)) {val successfulIds = mutableListOf<Long>()- val permanentlyFailedIds = mutableListOf<Long>()-- val (retriable, exceeded) = if (currentMaxRetries <= 0) {- chunk to emptyList()- } else {- chunk.partition { it.retryCount < currentMaxRetries }- }-- permanentlyFailedIds.addAll(exceeded.map { it.queueId })- if (exceeded.isNotEmpty()) {- AppLogger.w(TAG, "Removing ${exceeded.size} items that exceeded $currentMaxRetries retries")- }- val results = retriable.map { item ->+ val results = chunk.map { item ->async {try {val success = networkManager.sendToEndpoint(@@ -256,35 +239,17 @@ class SyncManager(if (success) {successfulIds.add(queueId)} else {- val item = retriable.first { it.queueId == queueId }dbHelper.incrementRetryCount(queueId, "Send failed")-- if (currentMaxRetries > 0 && item.retryCount + 1 >= currentMaxRetries) {- permanentlyFailedIds.add(queueId)- AppLogger.w(TAG, "Item $queueId reached max retries")- }}}- val toRemove = successfulIds + permanentlyFailedIdsif (successfulIds.isNotEmpty()) {- val sentLocationIds = retriable.filter { it.queueId in successfulIds }.map { it.locationId }+ val sentLocationIds = chunk.filter { it.queueId in successfulIds }.map { it.locationId }dbHelper.markLocationsSent(sentLocationIds)- }- if (permanentlyFailedIds.isNotEmpty()) {- val failedLocationIds = (retriable + exceeded).filter { it.queueId in permanentlyFailedIds }.map { it.locationId }- AppLogger.e(TAG, "Permanently dropping ${failedLocationIds.size} locations after $currentMaxRetries retries: $failedLocationIds")- LocationServiceModule.sendSyncErrorEvent(- "${failedLocationIds.size} locations dropped after $currentMaxRetries failed retries",- getCachedQueuedCount()- )- }- if (toRemove.isNotEmpty()) {- dbHelper.removeBatchFromQueue(toRemove)+ dbHelper.removeBatchFromQueue(successfulIds)- totalProcessed += toRemove.size+ totalProcessed += successfulIds.sizetotalSucceeded += successfulIds.size- totalFailed += permanentlyFailedIds.sizeonProgress?.invoke(totalSucceeded, totalFailed)}diff --git a/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt b/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.ktindex 657d017b..e61d9fbd 100644--- a/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt+++ b/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt@@ -1103,7 +1103,6 @@ class LocationForegroundServiceTest {minUpdateDistance = 0f,accuracyThreshold = 100f,filterInaccurateLocations = true,- maxRetries = 10,httpMethod = "GET"))@@ -1113,7 +1112,6 @@ class LocationForegroundServiceTest {assertEquals("https://my-server.com", config.endpoint)assertEquals(100f, config.accuracyThreshold)assertTrue(config.filterInaccurateLocations)- assertEquals(10, config.maxRetries)assertEquals("GET", config.httpMethod)}@@ -1123,7 +1121,6 @@ class LocationForegroundServiceTest {setField("config", ServiceConfig(endpoint = "https://example.com",retryIntervalSeconds = 60,- maxRetries = 3,isOfflineMode = true,isWifiOnlySync = true,httpMethod = "GET"@@ -1135,7 +1132,6 @@ class LocationForegroundServiceTest {endpoint = "https://example.com",syncIntervalSeconds = 30,retryIntervalSeconds = 60,- maxRetries = 3,isOfflineMode = true,isWifiOnlySync = true,authHeaders = mapOf("Authorization" to "Bearer token"),diff --git a/apps/mobile/android/app/src/test/java/com/Colota/service/ServiceConfigTest.kt b/apps/mobile/android/app/src/test/java/com/Colota/service/ServiceConfigTest.ktindex 569d9d2b..b6f04be1 100644--- a/apps/mobile/android/app/src/test/java/com/Colota/service/ServiceConfigTest.kt+++ b/apps/mobile/android/app/src/test/java/com/Colota/service/ServiceConfigTest.kt@@ -28,7 +28,6 @@ class ServiceConfigTest {"interval" to "5000","minUpdateDistance" to "0","syncInterval" to "0",- "maxRetries" to "5","accuracyThreshold" to "50.0","filterInaccurateLocations" to "false","retryInterval" to "30",@@ -69,7 +68,6 @@ class ServiceConfigTest {assertEquals(5000L, config.interval)assertEquals(0f, config.minUpdateDistance, 0.001f)assertEquals(0, config.syncIntervalSeconds)- assertEquals(5, config.maxRetries)assertEquals(50.0f, config.accuracyThreshold, 0.001f)assertFalse(config.filterInaccurateLocations)assertEquals(30, config.retryIntervalSeconds)@@ -86,7 +84,6 @@ class ServiceConfigTest {assertEquals(5000L, config.interval)assertEquals(0f, config.minUpdateDistance, 0.001f)assertEquals(0, config.syncIntervalSeconds)- assertEquals(5, config.maxRetries)assertEquals(50.0f, config.accuracyThreshold, 0.001f)assertFalse(config.filterInaccurateLocations)assertEquals(30, config.retryIntervalSeconds)@@ -100,7 +97,6 @@ class ServiceConfigTest {val db = mockDbHelper(mapOf("interval" to "not_a_number","syncInterval" to "abc",- "maxRetries" to "","accuracyThreshold" to "xyz","retryInterval" to "---"))@@ -108,7 +104,6 @@ class ServiceConfigTest {assertEquals(5000L, config.interval)assertEquals(0, config.syncIntervalSeconds)- assertEquals(5, config.maxRetries)assertEquals(50.0f, config.accuracyThreshold, 0.001f)assertEquals(30, config.retryIntervalSeconds)}@@ -168,7 +163,6 @@ class ServiceConfigTest {assertEquals(5000L, config.interval)assertEquals(0f, config.minUpdateDistance, 0.001f)assertEquals(0, config.syncIntervalSeconds)- assertEquals(5, config.maxRetries)assertEquals(50.0f, config.accuracyThreshold, 0.001f)assertFalse(config.filterInaccurateLocations)assertEquals(30, config.retryIntervalSeconds)@@ -232,7 +226,6 @@ class ServiceConfigTest {every { getLong("interval") } returns 10000Levery { getFloat("minUpdateDistance") } returns 5.0fevery { getInt("syncInterval") } returns 300- every { getInt("maxRetries") } returns 10every { getFloat("accuracyThreshold") } returns 25.0fevery { getBoolean("filterInaccurateLocations") } returns trueevery { getInt("retryInterval") } returns 60@@ -253,7 +246,6 @@ class ServiceConfigTest {assertEquals(10000L, config.interval)assertEquals(5.0f, config.minUpdateDistance, 0.001f)assertEquals(300, config.syncIntervalSeconds)- assertEquals(10, config.maxRetries)assertEquals(25.0f, config.accuracyThreshold, 0.001f)assertTrue(config.filterInaccurateLocations)assertEquals(60, config.retryIntervalSeconds)@@ -302,7 +294,6 @@ class ServiceConfigTest {assertEquals(120, config.syncIntervalSeconds)assertTrue(config.isOfflineMode)// Unset values fall back to DB- assertEquals(5, config.maxRetries)assertFalse(config.isWifiOnlySync)}diff --git a/apps/mobile/android/app/src/test/java/com/Colota/sync/SyncManagerTest.kt b/apps/mobile/android/app/src/test/java/com/Colota/sync/SyncManagerTest.ktindex 669a847a..bb516a03 100644--- a/apps/mobile/android/app/src/test/java/com/Colota/sync/SyncManagerTest.kt+++ b/apps/mobile/android/app/src/test/java/com/Colota/sync/SyncManagerTest.kt@@ -50,7 +50,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = true,isWifiOnlySync = false,authHeaders = emptyMap()@@ -69,7 +68,6 @@ class SyncManagerTest {endpoint = "",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -90,7 +88,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -114,7 +111,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -136,7 +132,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -159,7 +154,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = true,authHeaders = emptyMap()@@ -180,7 +174,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = true,authHeaders = emptyMap()@@ -204,7 +197,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 300,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -228,7 +220,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = headers,@@ -251,7 +242,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -275,7 +265,6 @@ class SyncManagerTest {endpoint = "",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -292,7 +281,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -310,116 +298,12 @@ class SyncManagerTest {verify { dbHelper.removeBatchFromQueue(listOf(1L)) }}- // --- syncQueue: retry exhaustion ----- @Test- fun `syncQueue removes items exceeding maxRetries`() = scope.runTest {- syncManager.updateConfig(- endpoint = "https://example.com",- syncIntervalSeconds = 0,- retryIntervalSeconds = 30,- maxRetries = 3,- isOfflineMode = false,- isWifiOnlySync = false,- authHeaders = emptyMap()- )-- val exceededItem = QueuedLocation(1L, 100L, """{"lat":52.0}""", 3)- every { dbHelper.getQueuedLocations(50) } returnsMany listOf(listOf(exceededItem), emptyList())-- syncManager.manualFlush()-- // Item exceeded retries, should be removed without sending- coVerify(exactly = 0) { networkManager.sendToEndpoint(any(), any(), any(), any()) }- verify { dbHelper.removeBatchFromQueue(listOf(1L)) }- }-- @Test- fun `syncQueue sends retriable items and removes exceeded ones in same batch`() = scope.runTest {- syncManager.updateConfig(- endpoint = "https://example.com",- syncIntervalSeconds = 0,- retryIntervalSeconds = 30,- maxRetries = 5,- isOfflineMode = false,- isWifiOnlySync = false,- authHeaders = emptyMap()- )-- val retriable = QueuedLocation(1L, 100L, """{"lat":52.0}""", 0)- val exceeded = QueuedLocation(2L, 101L, """{"lat":53.0}""", 5)- every { dbHelper.getQueuedLocations(50) } returnsMany listOf(- listOf(retriable, exceeded),- emptyList()- )- coEvery { networkManager.sendToEndpoint(any(), any(), any(), any()) } returns true-- syncManager.manualFlush()-- // Only the retriable item should be sent- coVerify(exactly = 1) { networkManager.sendToEndpoint(any(), any(), any(), any()) }- // Both should be removed (one succeeded, one exceeded)- verify { dbHelper.removeBatchFromQueue(match { it.containsAll(listOf(1L, 2L)) }) }- }-- // --- syncQueue: maxRetries=0 (retry forever) ----- @Test- fun `syncQueue retries all items when maxRetries is 0`() = scope.runTest {- syncManager.updateConfig(- endpoint = "https://example.com",- syncIntervalSeconds = 0,- retryIntervalSeconds = 30,- maxRetries = 0,- isOfflineMode = false,- isWifiOnlySync = false,- authHeaders = emptyMap()- )-- // Item with high retry count should still be sent, not treated as exceeded- val item = QueuedLocation(1L, 100L, """{"lat":52.0}""", 99)- every { dbHelper.getQueuedLocations(50) } returnsMany listOf(listOf(item), emptyList())- coEvery { networkManager.sendToEndpoint(any(), any(), any(), any()) } returns true-- syncManager.manualFlush()-- coVerify(exactly = 1) { networkManager.sendToEndpoint(any(), any(), any(), any()) }- verify { dbHelper.removeBatchFromQueue(listOf(1L)) }- // Location should NOT be deleted (it was successfully sent)- verify(exactly = 0) { dbHelper.deleteLocations(any()) }- }-- @Test- fun `syncQueue does not permanently fail items when maxRetries is 0`() = scope.runTest {- syncManager.updateConfig(- endpoint = "https://example.com",- syncIntervalSeconds = 0,- retryIntervalSeconds = 30,- maxRetries = 0,- isOfflineMode = false,- isWifiOnlySync = false,- authHeaders = emptyMap()- )-- val item = QueuedLocation(1L, 100L, """{"lat":52.0}""", 50)- every { dbHelper.getQueuedLocations(50) } returnsMany listOf(listOf(item), emptyList())- coEvery { networkManager.sendToEndpoint(any(), any(), any(), any()) } returns false-- syncManager.manualFlush()-- // Should increment retry count but NOT remove from queue or delete location- verify { dbHelper.incrementRetryCount(1L, "Send failed") }- verify(exactly = 0) { dbHelper.removeBatchFromQueue(any()) }- verify(exactly = 0) { dbHelper.deleteLocations(any()) }- }-@Testfun `syncQueue stops fetching batches when all sends fail`() = scope.runTest {syncManager.updateConfig(endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -443,7 +327,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 3,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -536,7 +419,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -558,7 +440,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -582,7 +463,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 3,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -608,7 +488,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -641,7 +520,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -676,7 +554,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -704,7 +581,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -738,7 +614,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 60,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -772,7 +647,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = true,isWifiOnlySync = false,authHeaders = emptyMap()@@ -793,7 +667,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -815,7 +688,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 1,retryIntervalSeconds = 1,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -847,7 +719,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -882,7 +753,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 3,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap()@@ -911,7 +781,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap(),@@ -933,7 +802,6 @@ class SyncManagerTest {endpoint = "https://example.com",syncIntervalSeconds = 0,retryIntervalSeconds = 30,- maxRetries = 5,isOfflineMode = false,isWifiOnlySync = false,authHeaders = emptyMap(),diff --git a/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx b/apps/mobile/src/components/features/settings/SyncStrategySettings.tsxindex 946b8393..c8ee528d 100644--- a/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx+++ b/apps/mobile/src/components/features/settings/SyncStrategySettings.tsx@@ -285,34 +285,6 @@ export function SyncStrategySettings({</View>)}- {/* Retry Forever Toggle */}- <SettingRow- label="Retry Failed Uploads"- hint={- settings.maxRetries === 0- ? "Failed uploads stay in the queue until they succeed"- : "Failed uploads are permanently deleted after 5 failed send attempts"- }- >- <Switch- value={settings.maxRetries === 0}- onValueChange={(retryForever) => {- const next = {- ...settings,- maxRetries: retryForever ? 0 : 5,- syncPreset: "custom" as const- }- onSettingsChange(next)- onImmediateSave(next)- }}- trackColor={{- false: colors.border,- true: colors.primary + "80"- }}- thumbColor={settings.maxRetries === 0 ? colors.primary : colors.border}- />- </SettingRow>-{/* Wi-Fi Only Sync Toggle */}<SettingRowlabel="Wi-Fi Only Sync"diff --git a/apps/mobile/src/components/features/settings/__tests__/SyncStrategySettings.test.tsx b/apps/mobile/src/components/features/settings/__tests__/SyncStrategySettings.test.tsxindex 6c8c3f48..ccc89133 100644--- a/apps/mobile/src/components/features/settings/__tests__/SyncStrategySettings.test.tsx+++ b/apps/mobile/src/components/features/settings/__tests__/SyncStrategySettings.test.tsx@@ -221,59 +221,6 @@ describe("SyncStrategySettings", () => {})})- describe("retry failed uploads toggle", () => {- it("shows delete hint when maxRetries is 5 (default)", () => {- const { getByText } = renderComponent({ maxRetries: 5 })-- fireEvent.press(getByText("Advanced Settings"))-- expect(getByText("Failed uploads are permanently deleted after 5 failed send attempts")).toBeTruthy()- })-- it("shows keep hint when maxRetries is 0 (retry forever)", () => {- const { getByText } = renderComponent({ maxRetries: 0 })-- fireEvent.press(getByText("Advanced Settings"))-- expect(getByText("Failed uploads stay in the queue until they succeed")).toBeTruthy()- })-- it("toggling retry on sets maxRetries to 0", () => {- const { getByText, getAllByRole } = renderComponent({ maxRetries: 5 })-- fireEvent.press(getByText("Advanced Settings"))-- const retrySwitch = getAllByRole("switch")[0]-- fireEvent(retrySwitch, "valueChange", true)-- expect(mockOnSettingsChange).toHaveBeenCalledWith(- expect.objectContaining({- maxRetries: 0,- syncPreset: "custom"- })- )- expect(mockOnImmediateSave).toHaveBeenCalled()- })-- it("toggling retry off sets maxRetries to 5", () => {- const { getByText, getAllByRole } = renderComponent({ maxRetries: 0 })-- fireEvent.press(getByText("Advanced Settings"))-- const retrySwitch = getAllByRole("switch")[0]-- fireEvent(retrySwitch, "valueChange", false)-- expect(mockOnSettingsChange).toHaveBeenCalledWith(- expect.objectContaining({- maxRetries: 5,- syncPreset: "custom"- })- )- })- })-describe("filter inaccurate locations", () => {it("shows accuracy threshold input when filter is enabled", () => {const { getByText } = renderComponent({ filterInaccurateLocations: true })diff --git a/apps/mobile/src/contexts/TrackingProvider.tsx b/apps/mobile/src/contexts/TrackingProvider.tsxindex a7ddb992..6c84c22c 100644--- a/apps/mobile/src/contexts/TrackingProvider.tsx+++ b/apps/mobile/src/contexts/TrackingProvider.tsx@@ -46,8 +46,6 @@ function parseRawSettings(allRaw: Record<string, string>): Settings {retryInterval: allRaw.retryInterval ? parseInt(allRaw.retryInterval, 10) : DEFAULT_SETTINGS.retryInterval,- maxRetries: allRaw.maxRetries ? parseInt(allRaw.maxRetries, 10) : DEFAULT_SETTINGS.maxRetries,-accuracyThreshold: allRaw.accuracyThreshold? parseFloat(allRaw.accuracyThreshold): DEFAULT_SETTINGS.accuracyThreshold,diff --git a/apps/mobile/src/screens/SetupImportScreen.tsx b/apps/mobile/src/screens/SetupImportScreen.tsxindex 2bbea15b..fdb73058 100644--- a/apps/mobile/src/screens/SetupImportScreen.tsx+++ b/apps/mobile/src/screens/SetupImportScreen.tsx@@ -123,11 +123,6 @@ function validateConfig(raw: unknown): ValidationResult {})}- if ("maxRetries" in obj && typeof obj.maxRetries === "number" && obj.maxRetries >= 0) {- settings.maxRetries = obj.maxRetries- entries.push({ label: "Max retries", value: `${obj.maxRetries}`, category: "tracking" })- }-if ("retryInterval" in obj && typeof obj.retryInterval === "number" && obj.retryInterval >= 0) {settings.retryInterval = obj.retryIntervalentries.push({ label: "Retry interval", value: `${obj.retryInterval}s`, category: "tracking" })diff --git a/apps/mobile/src/services/NativeLocationService.ts b/apps/mobile/src/services/NativeLocationService.tsindex 2d6dda20..a49549c1 100644--- a/apps/mobile/src/services/NativeLocationService.ts+++ b/apps/mobile/src/services/NativeLocationService.ts@@ -67,7 +67,6 @@ class NativeLocationService {fieldMap: settings.fieldMap,syncInterval: settings.syncInterval,retryInterval: settings.retryInterval,- maxRetries: settings.maxRetries,filterInaccurateLocations: settings.filterInaccurateLocations,accuracyThreshold: settings.accuracyThreshold,isOfflineMode: settings.isOfflineMode,diff --git a/apps/mobile/src/services/SettingsService.ts b/apps/mobile/src/services/SettingsService.tsindex d15a0dbe..eb4202f4 100644--- a/apps/mobile/src/services/SettingsService.ts+++ b/apps/mobile/src/services/SettingsService.ts@@ -41,7 +41,6 @@ export const SettingsService = {case "syncInterval":case "retryInterval":- case "maxRetries":case "accuracyThreshold":// Already in correct format (numbers)stringValue = String(value)diff --git a/apps/mobile/src/services/__tests__/NativeLocationService.test.ts b/apps/mobile/src/services/__tests__/NativeLocationService.test.tsindex cf725e3b..6a3376bf 100644--- a/apps/mobile/src/services/__tests__/NativeLocationService.test.ts+++ b/apps/mobile/src/services/__tests__/NativeLocationService.test.ts@@ -109,7 +109,6 @@ describe("NativeLocationService", () => {fieldMap: { lat: "lat", lon: "lon", acc: "acc" },syncInterval: 0,retryInterval: 30,- maxRetries: 5,filterInaccurateLocations: false,accuracyThreshold: 50,isOfflineMode: false,@@ -141,7 +140,6 @@ describe("NativeLocationService", () => {fieldMap: { lat: "lat", lon: "lon", acc: "accuracy" },syncInterval: 0,retryInterval: 30,- maxRetries: 5,filterInaccurateLocations: false,accuracyThreshold: 50,isOfflineMode: false,@@ -171,7 +169,6 @@ describe("NativeLocationService", () => {fieldMap: { lat: "lat", lon: "lon", acc: "acc" },syncInterval: 0,retryInterval: 30,- maxRetries: 5,filterInaccurateLocations: false,accuracyThreshold: 50,isOfflineMode: false,diff --git a/apps/mobile/src/types/__tests__/defaults.test.ts b/apps/mobile/src/types/__tests__/defaults.test.tsindex d48c1b88..afe100ca 100644--- a/apps/mobile/src/types/__tests__/defaults.test.ts+++ b/apps/mobile/src/types/__tests__/defaults.test.ts@@ -47,10 +47,6 @@ describe("DEFAULT_SETTINGS", () => {expect(DEFAULT_SETTINGS.apiTemplate).toBe("custom")})- it("has positive maxRetries", () => {- expect(DEFAULT_SETTINGS.maxRetries).toBeGreaterThan(0)- })-it("has offline mode disabled", () => {expect(DEFAULT_SETTINGS.isOfflineMode).toBe(false)})@@ -69,7 +65,6 @@ describe("DEFAULT_SETTINGS", () => {"apiTemplate","syncInterval","retryInterval",- "maxRetries","isOfflineMode","syncPreset","filterInaccurateLocations",diff --git a/apps/mobile/src/types/global.ts b/apps/mobile/src/types/global.tsindex 0d266e2b..01d96a94 100644--- a/apps/mobile/src/types/global.ts+++ b/apps/mobile/src/types/global.ts@@ -314,7 +314,6 @@ export interface Settings {// Sync & UploadsyncInterval: numberretryInterval: number- maxRetries: numberisOfflineMode: booleanisWifiOnlySync: boolean// UI State@@ -334,7 +333,6 @@ export const DEFAULT_SETTINGS: Settings = {filterInaccurateLocations: false,accuracyThreshold: 50,syncPreset: "instant",- maxRetries: 5,isOfflineMode: false,isWifiOnlySync: false,hasCompletedSetup: false,