taxi: lapsed rides are terminal, so tracking actually stops
- Commit
a4fa6eb5a1f0d1e84a5a4ef0ffa64cfee63578a7- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-30 21:26 UTC (5 days ago)
- Parents
79f266f
A ride that expired with no driver (status LAPSED) was tracked forever: isTerminal omitted LAPSED while every consumer keys its stop condition off that flag, so the foreground tracking service polled every 5 seconds indefinitely and the tracking screen showed 'Finding your driver' at 10% with a live Cancel button for a ride that no longer exists. isTerminal now includes LAPSED, matching the lifecycle model the tests already assumed. Regression pins: LAPSED joins the terminal-status set that stops polling, plus an explicit assertion with rationale. Fare math, cross-app estimate contracts, quotes/token lifecycle, deep links and card validation were audited and cleared. Verified: :taxi:testDevUnitTest BUILD SUCCESSFUL; lint errors are pre-existing on untouched files.
Diff
taxi/src/main/java/com/vayunmathur/taxi/data/Models.kt
diff --git a/taxi/src/main/java/com/vayunmathur/taxi/data/Models.kt b/taxi/src/main/java/com/vayunmathur/taxi/data/Models.ktindex 2a4e46f153..ef08170497 100644--- a/taxi/src/main/java/com/vayunmathur/taxi/data/Models.kt+++ b/taxi/src/main/java/com/vayunmathur/taxi/data/Models.kt@@ -245,8 +245,8 @@ enum class RideStatus(val wire: String) { /** Driver assigned and on the way to the pickup, but the rider isn't in the car yet. */ val isPrePickup: Boolean get() = this == PENDING || this == ACCEPTED || this == APPROACHING || this == ARRIVED - /** The ride has finished (or was cancelled) — polling should stop. */- val isTerminal: Boolean get() = this == DROPPED_OFF || this == COMPLETED || this == PROCESSED || this == CANCELED+ /** The ride has finished (or was cancelled/lapsed) — polling should stop. */+ val isTerminal: Boolean get() = this == DROPPED_OFF || this == COMPLETED || this == PROCESSED || this == CANCELED || this == LAPSED /** There is a live ride worth tracking (pre-pickup or in-trip). */ val isActive: Boolean get() = isPrePickup || this == PICKED_UP
taxi/src/test/java/com/vayunmathur/taxi/domain/RideStateTest.kt
diff --git a/taxi/src/test/java/com/vayunmathur/taxi/domain/RideStateTest.kt b/taxi/src/test/java/com/vayunmathur/taxi/domain/RideStateTest.ktindex e9d8c00847..a09aac55d4 100644--- a/taxi/src/test/java/com/vayunmathur/taxi/domain/RideStateTest.kt+++ b/taxi/src/test/java/com/vayunmathur/taxi/domain/RideStateTest.kt@@ -121,6 +121,9 @@ class RideStateTest { assertTrue(RideStatus.COMPLETED.isTerminal) assertTrue(RideStatus.PROCESSED.isTerminal) assertTrue(RideStatus.CANCELED.isTerminal)+ // Lapsed = request expired with no driver: an end state, so tracking+ // must stop instead of polling "finding driver" forever.+ assertTrue(RideStatus.LAPSED.isTerminal) assertFalse(RideStatus.PICKED_UP.isTerminal) assertFalse(RideStatus.ACCEPTED.isTerminal) }
taxi/src/test/java/com/vayunmathur/taxi/pure/RideModelsTest.kt
diff --git a/taxi/src/test/java/com/vayunmathur/taxi/pure/RideModelsTest.kt b/taxi/src/test/java/com/vayunmathur/taxi/pure/RideModelsTest.ktindex a908c5e292..924879f833 100644--- a/taxi/src/test/java/com/vayunmathur/taxi/pure/RideModelsTest.kt+++ b/taxi/src/test/java/com/vayunmathur/taxi/pure/RideModelsTest.kt@@ -82,7 +82,7 @@ class RideModelsTest { @Test fun terminalStatusesStopPolling() {- val terminal = setOf(RideStatus.DROPPED_OFF, RideStatus.COMPLETED, RideStatus.PROCESSED, RideStatus.CANCELED)+ val terminal = setOf(RideStatus.DROPPED_OFF, RideStatus.COMPLETED, RideStatus.PROCESSED, RideStatus.CANCELED, RideStatus.LAPSED) for (status in RideStatus.entries) assertEquals(status in terminal, status.isTerminal) }