travel: a recent-search re-run rebuilds the same search that was run
- Commit
8cc62041624c452f7ac1f78b7133d8bcf6ae07e7- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 15:24 UTC (4 days ago)
- Parents
9f57f59
RecentSearch stored only part of the query despite its own
contract ('all fields needed to rebuild the query are
stored'): flight children/infants/maxConnections and stay
rooms/coordinates were never recorded, and the re-run
hard-coded children="", infants=0, no connection cap and
rooms=1. A SFO:JFK search for 1 adult + child(5) + infant
re-ran priced for one passenger; a 2-room Paris stay re-ran
as 1 room.
The entity gains the missing columns (defaulted, so legacy
rows keep their old re-run shape) with a DB v5->v6 migration
and schema; both recording sites now store the full query
and the rebuild (routeForRecent) carries every field back.
Six regression tests cover recording through both flight
entry points and stays, rebuild equality, and legacy rows.
Verified: :travel:testDevUnitTest 425 tests pass; lint
errors are pre-existing on untouched files.Diff
travel/schemas/com.vayunmathur.travel.data.TravelDatabase/6.json
diff --git a/travel/schemas/com.vayunmathur.travel.data.TravelDatabase/6.json b/travel/schemas/com.vayunmathur.travel.data.TravelDatabase/6.jsonnew file mode 100644index 0000000000..bcca2f0b11--- /dev/null+++ b/travel/schemas/com.vayunmathur.travel.data.TravelDatabase/6.json@@ -0,0 +1,307 @@+{+ "formatVersion": 1,+ "database": {+ "version": 6,+ "identityHash": "b50064ba97a563063642c7ffcbe81f76",+ "entities": [+ {+ "tableName": "RecentSearch",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `vertical` TEXT NOT NULL, `label` TEXT NOT NULL, `origin` TEXT, `destination` TEXT, `depart` TEXT, `returnDate` TEXT, `adults` INTEGER NOT NULL, `cabin` TEXT NOT NULL, `children` TEXT NOT NULL, `infants` INTEGER NOT NULL, `maxConnections` INTEGER NOT NULL, `rooms` INTEGER NOT NULL, `latitude` REAL, `longitude` REAL, `createdAt` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "vertical",+ "columnName": "vertical",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "label",+ "columnName": "label",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "origin",+ "columnName": "origin",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "destination",+ "columnName": "destination",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "depart",+ "columnName": "depart",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "returnDate",+ "columnName": "returnDate",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "adults",+ "columnName": "adults",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "cabin",+ "columnName": "cabin",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "children",+ "columnName": "children",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "infants",+ "columnName": "infants",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "maxConnections",+ "columnName": "maxConnections",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "rooms",+ "columnName": "rooms",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "latitude",+ "columnName": "latitude",+ "affinity": "REAL"+ },+ {+ "fieldPath": "longitude",+ "columnName": "longitude",+ "affinity": "REAL"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "createdAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "BookedTrip",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`orderId` TEXT NOT NULL, `bookingReference` TEXT NOT NULL, `route` TEXT NOT NULL, `departDate` TEXT NOT NULL, `amount` TEXT NOT NULL, `currency` TEXT NOT NULL, `passengersJson` TEXT NOT NULL, `status` TEXT NOT NULL, `type` TEXT NOT NULL, `awaitingPayment` INTEGER NOT NULL, `paymentRequiredBy` TEXT NOT NULL, `remoteSyncedAt` INTEGER NOT NULL, `customerId` TEXT NOT NULL, `tripId` TEXT NOT NULL, `checkoutExpiresAt` TEXT NOT NULL, `lastName` TEXT NOT NULL, `failureMessage` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`orderId`))",+ "fields": [+ {+ "fieldPath": "orderId",+ "columnName": "orderId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "bookingReference",+ "columnName": "bookingReference",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "route",+ "columnName": "route",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "departDate",+ "columnName": "departDate",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "amount",+ "columnName": "amount",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "currency",+ "columnName": "currency",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "passengersJson",+ "columnName": "passengersJson",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "type",+ "columnName": "type",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "awaitingPayment",+ "columnName": "awaitingPayment",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "paymentRequiredBy",+ "columnName": "paymentRequiredBy",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "remoteSyncedAt",+ "columnName": "remoteSyncedAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "customerId",+ "columnName": "customerId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "tripId",+ "columnName": "tripId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "checkoutExpiresAt",+ "columnName": "checkoutExpiresAt",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastName",+ "columnName": "lastName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "failureMessage",+ "columnName": "failureMessage",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "createdAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "orderId"+ ]+ }+ },+ {+ "tableName": "FrequentFlyer",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`airlineIata` TEXT NOT NULL, `accountNumber` TEXT NOT NULL, `airlineName` TEXT NOT NULL, PRIMARY KEY(`airlineIata`))",+ "fields": [+ {+ "fieldPath": "airlineIata",+ "columnName": "airlineIata",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "accountNumber",+ "columnName": "accountNumber",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "airlineName",+ "columnName": "airlineName",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "airlineIata"+ ]+ }+ },+ {+ "tableName": "Customer",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `email` TEXT NOT NULL, `givenName` TEXT NOT NULL, `familyName` TEXT NOT NULL, `phoneNumber` TEXT NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "email",+ "columnName": "email",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "givenName",+ "columnName": "givenName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "familyName",+ "columnName": "familyName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phoneNumber",+ "columnName": "phoneNumber",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ }+ ],+ "setupQueries": [+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'b50064ba97a563063642c7ffcbe81f76')"+ ]+ }+}\ No newline at end of file
travel/src/main/java/com/vayunmathur/travel/data/RecentSearch.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/data/RecentSearch.kt b/travel/src/main/java/com/vayunmathur/travel/data/RecentSearch.ktindex c0278a91d2..442197ea7b 100644--- a/travel/src/main/java/com/vayunmathur/travel/data/RecentSearch.kt+++ b/travel/src/main/java/com/vayunmathur/travel/data/RecentSearch.kt@@ -22,5 +22,16 @@ data class RecentSearch( val returnDate: String? = null, val adults: Int = 1, val cabin: String = "economy",+ /** Flight child ages (comma-separated, as searched); blank when none. */+ val children: String = "",+ /** Flight lap infants, as searched. */+ val infants: Int = 0,+ /** Flight connection cap, as searched (-1 = no cap). */+ val maxConnections: Int = -1,+ /** Stay room count, as searched. */+ val rooms: Int = 1,+ /** Stay search coordinates from the picked suggestion, when it carried any. */+ val latitude: Double? = null,+ val longitude: Double? = null, val createdAt: Long = System.currentTimeMillis(), )
travel/src/main/java/com/vayunmathur/travel/data/TravelDatabase.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/data/TravelDatabase.kt b/travel/src/main/java/com/vayunmathur/travel/data/TravelDatabase.ktindex b309d89440..c7e164d675 100644--- a/travel/src/main/java/com/vayunmathur/travel/data/TravelDatabase.kt+++ b/travel/src/main/java/com/vayunmathur/travel/data/TravelDatabase.kt@@ -93,7 +93,7 @@ interface CustomerDao { @Database( entities = [RecentSearch::class, BookedTrip::class, FrequentFlyer::class, Customer::class],- version = 5,+ version = 6, exportSchema = true, ) /** Travel Database: a room database implementation for travel database. */@@ -145,6 +145,21 @@ abstract class TravelDatabase : RoomDatabase() { connection.execSQL("ALTER TABLE BookedTrip ADD COLUMN failureMessage TEXT NOT NULL DEFAULT ''") } },+ object : androidx.room3.migration.Migration(5, 6) {+ override suspend fun migrate(connection: SQLiteConnection) {+ // Query fields a recent re-run needs to rebuild the search+ // it came from (children/infants/connection cap for+ // flights, rooms + coordinates for stays). Rows written+ // before this migration keep the pre-existing re-run+ // defaults via the column defaults.+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN children TEXT NOT NULL DEFAULT ''")+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN infants INTEGER NOT NULL DEFAULT 0")+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN maxConnections INTEGER NOT NULL DEFAULT -1")+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN rooms INTEGER NOT NULL DEFAULT 1")+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN latitude REAL")+ connection.execSQL("ALTER TABLE RecentSearch ADD COLUMN longitude REAL")+ }+ }, ) } }
travel/src/main/java/com/vayunmathur/travel/platform/TravelSearchOps.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/platform/TravelSearchOps.kt b/travel/src/main/java/com/vayunmathur/travel/platform/TravelSearchOps.ktindex c4852d8227..a7690031b5 100644--- a/travel/src/main/java/com/vayunmathur/travel/platform/TravelSearchOps.kt+++ b/travel/src/main/java/com/vayunmathur/travel/platform/TravelSearchOps.kt@@ -52,6 +52,9 @@ private fun TravelViewModel.recordFlightSearch(query: FlightQuery, leg: FirstLeg returnDate = leg.returnDate, adults = query.adults, cabin = query.cabin,+ children = query.children,+ infants = query.infants,+ maxConnections = query.maxConnections, ) ) }
travel/src/main/java/com/vayunmathur/travel/platform/TravelStayOps.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/platform/TravelStayOps.kt b/travel/src/main/java/com/vayunmathur/travel/platform/TravelStayOps.ktindex 787ed208fc..3a99fd4cc6 100644--- a/travel/src/main/java/com/vayunmathur/travel/platform/TravelStayOps.kt+++ b/travel/src/main/java/com/vayunmathur/travel/platform/TravelStayOps.kt@@ -34,6 +34,9 @@ fun TravelViewModel.searchStays( depart = checkIn, returnDate = checkOut, adults = adults,+ rooms = rooms,+ latitude = latitude,+ longitude = longitude, ) ) stayResultsMutable.value = StaySearchState(loading = true, hasSearched = true)
travel/src/main/java/com/vayunmathur/travel/ui/HomePage.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/ui/HomePage.kt b/travel/src/main/java/com/vayunmathur/travel/ui/HomePage.ktindex 65ff90dbf8..ee081f8bbb 100644--- a/travel/src/main/java/com/vayunmathur/travel/ui/HomePage.kt+++ b/travel/src/main/java/com/vayunmathur/travel/ui/HomePage.kt@@ -222,17 +222,26 @@ private fun TripSummaryCard(trip: BookedTrip, onClick: () -> Unit) { /** Rebuild the results Route for a stored search (flight or stay). */ private fun openRecent(backStack: NavBackStack<Route>, recent: RecentSearch) {+ backStack.add(routeForRecent(recent))+}++/**+ * The results route that re-runs [recent] with the query it was recorded+ * from: every stored query field (passengers, connection cap, rooms,+ * coordinates) is carried back, so the re-run searches the same travellers,+ * rooms and route as the original search.+ */+internal fun routeForRecent(recent: RecentSearch): Route { if (recent.vertical == "STAYS") {- backStack.add(- Route.StayResults(- place = recent.origin.orEmpty(),- checkIn = recent.depart.orEmpty(),- checkOut = recent.returnDate.orEmpty(),- rooms = 1,- adults = recent.adults,- )+ return Route.StayResults(+ place = recent.origin.orEmpty(),+ checkIn = recent.depart.orEmpty(),+ checkOut = recent.returnDate.orEmpty(),+ rooms = recent.rooms,+ adults = recent.adults,+ latitude = recent.latitude ?: Double.NaN,+ longitude = recent.longitude ?: Double.NaN, )- return } val origin = recent.origin.orEmpty() val destination = recent.destination.orEmpty()@@ -242,14 +251,12 @@ private fun openRecent(backStack: NavBackStack<Route>, recent: RecentSearch) { } else { "$origin:$destination:$depart" }- backStack.add(- Route.FlightResults(- slices = slices,- adults = recent.adults,- children = "",- infants = 0,- cabin = recent.cabin,- maxConnections = -1,- )+ return Route.FlightResults(+ slices = slices,+ adults = recent.adults,+ children = recent.children,+ infants = recent.infants,+ cabin = recent.cabin,+ maxConnections = recent.maxConnections, ) }
travel/src/test/java/com/vayunmathur/travel/platform/TravelRecentRerunTest.kt
diff --git a/travel/src/test/java/com/vayunmathur/travel/platform/TravelRecentRerunTest.kt b/travel/src/test/java/com/vayunmathur/travel/platform/TravelRecentRerunTest.ktnew file mode 100644index 0000000000..d876e7e832--- /dev/null+++ b/travel/src/test/java/com/vayunmathur/travel/platform/TravelRecentRerunTest.kt@@ -0,0 +1,220 @@+package com.vayunmathur.travel.platform++import androidx.test.core.app.ApplicationProvider+import com.vayunmathur.travel.Route+import com.vayunmathur.travel.data.BookedTrip+import com.vayunmathur.travel.data.Customer+import com.vayunmathur.travel.data.FrequentFlyer+import com.vayunmathur.travel.data.RecentSearch+import com.vayunmathur.travel.data.TravelRepository+import com.vayunmathur.travel.network.TravelRaw+import com.vayunmathur.travel.network.travelTransport+import com.vayunmathur.travel.ui.routeForRecent+import kotlin.test.AfterTest+import kotlin.test.BeforeTest+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlinx.coroutines.flow.Flow+import kotlinx.coroutines.flow.MutableStateFlow+import org.junit.runner.RunWith+import org.robolectric.RobolectricTestRunner+import org.robolectric.annotation.Config+import org.robolectric.shadows.ShadowLooper++/**+ * Regression: a recent search must re-run the query it was recorded from.+ * Before the fix the recent stored only adults + cabin (flights) / adults+ * (stays), and the re-run hard-coded the rest, so a search for+ * 1 adult + a child aged 5 + a lap infant re-ran as one adult, and a+ * 2-room stay re-ran as 1 room โ different travellers, rooms and prices+ * from the search the chip labels.+ */+@RunWith(RobolectricTestRunner::class)+@Config(sdk = [34])+class TravelRecentRerunTest {++ private class FakeRepo(ctx: android.content.Context) : TravelRepository(ctx) {+ val inserted = mutableListOf<RecentSearch>()+ override fun observeRecent(limit: Int): Flow<List<RecentSearch>> = MutableStateFlow(emptyList())+ override fun observeBookedTrips(): Flow<List<BookedTrip>> = MutableStateFlow(emptyList())+ override fun observeFrequentFlyers(): Flow<List<FrequentFlyer>> = MutableStateFlow(emptyList())+ override fun observeCustomers(): Flow<List<Customer>> = MutableStateFlow(emptyList())+ override suspend fun getAllFrequentFlyers(): List<FrequentFlyer> = emptyList()+ override suspend fun insertRecent(value: RecentSearch) { inserted += value }+ override suspend fun clearRecent() {}+ override suspend fun trimRecent(keep: Int) {}+ }++ private lateinit var repo: FakeRepo++ private val offerJson = """{"offerId":"off_1","itineraryId":"itin_1","totalAmount":"400.00","currency":"USD","passengerIds":["pax_1"],"passengers":[{"id":"pax_1","type":"adult"}],"slices":[{"origin":"SFO","destination":"JFK","departureAt":"2027-06-24T07:15:00","arrivalAt":"2027-06-24T15:50:00","segments":[{"carrierIata":"AS","flightNumber":"100","origin":"SFO","destination":"JFK","departureAt":"2027-06-24T07:15:00","arrivalAt":"2027-06-24T15:50:00"}]}]}"""++ @BeforeTest+ fun open() {+ repo = FakeRepo(ApplicationProvider.getApplicationContext())+ travelTransport = { _, url, _ ->+ when {+ url.contains("/stays/search") -> TravelRaw(200, "[]")+ url.contains("/flights") ->+ TravelRaw(200, """{"offerRequestId":"req_1","offers":[$offerJson]}""")+ else -> TravelRaw(404, """{"message":"not found"}""")+ }+ }+ }++ @AfterTest fun clear() { travelTransport = null }++ private fun vm(): TravelViewModel {+ val ctx = ApplicationProvider.getApplicationContext<android.content.Context>()+ return TravelViewModel(ctx as android.app.Application, repo)+ }++ private fun idle() { repeat(5) { ShadowLooper.idleMainLooper() } }++ @Test+ fun searchFlights_recordsChildrenInfantsAndConnectionCap() {+ val v = vm()+ v.searchFlights(+ FlightQuery(+ slices = "SFO:JFK:2027-06-24",+ adults = 1,+ children = "5",+ infants = 1,+ cabin = "business",+ maxConnections = 1,+ )+ )+ idle()+ val recent = repo.inserted.singleOrNull()+ assertEquals("5", recent?.children, "inserted=${repo.inserted}")+ assertEquals(1, recent?.infants, "inserted=${repo.inserted}")+ assertEquals(1, recent?.maxConnections, "inserted=${repo.inserted}")+ assertEquals("business", recent?.cabin, "inserted=${repo.inserted}")+ }++ @Test+ fun startPartialSearch_recordsChildrenInfantsAndConnectionCap() {+ val v = vm()+ v.startPartialSearch(+ FlightQuery(+ slices = "SFO:JFK:2027-06-24,JFK:SFO:2027-06-28",+ adults = 2,+ children = "7,9",+ infants = 1,+ cabin = "economy",+ maxConnections = 0,+ isRoundTrip = true,+ )+ )+ idle()+ val recent = repo.inserted.singleOrNull()+ assertEquals("7,9", recent?.children, "inserted=${repo.inserted}")+ assertEquals(1, recent?.infants, "inserted=${repo.inserted}")+ assertEquals(0, recent?.maxConnections, "inserted=${repo.inserted}")+ assertEquals("2027-06-28", recent?.returnDate, "inserted=${repo.inserted}")+ }++ @Test+ fun searchStays_recordsRoomsAndCoordinates() {+ val v = vm()+ v.searchStays("Paris", "2027-06-24", "2027-06-26", rooms = 2, adults = 3, latitude = 48.8566, longitude = 2.3522)+ idle()+ val recent = repo.inserted.singleOrNull()+ assertEquals(2, recent?.rooms, "inserted=${repo.inserted}")+ assertEquals(3, recent?.adults, "inserted=${repo.inserted}")+ assertEquals(48.8566, recent?.latitude, "inserted=${repo.inserted}")+ assertEquals(2.3522, recent?.longitude, "inserted=${repo.inserted}")+ }++ @Test+ fun routeForRecent_flightRebuildsRecordedQuery() {+ val recent = RecentSearch(+ vertical = "FLIGHTS",+ label = "SFO โ JFK",+ origin = "SFO",+ destination = "JFK",+ depart = "2027-06-24",+ returnDate = "2027-06-28",+ adults = 1,+ cabin = "business",+ children = "5",+ infants = 1,+ maxConnections = 1,+ )+ assertEquals(+ Route.FlightResults(+ slices = "SFO:JFK:2027-06-24,JFK:SFO:2027-06-28",+ adults = 1,+ children = "5",+ infants = 1,+ cabin = "business",+ maxConnections = 1,+ ),+ routeForRecent(recent),+ )+ }++ @Test+ fun routeForRecent_stayRebuildsRecordedQuery() {+ val recent = RecentSearch(+ vertical = "STAYS",+ label = "Paris",+ origin = "Paris",+ depart = "2027-06-24",+ returnDate = "2027-06-26",+ adults = 3,+ rooms = 2,+ latitude = 48.8566,+ longitude = 2.3522,+ )+ assertEquals(+ Route.StayResults(+ place = "Paris",+ checkIn = "2027-06-24",+ checkOut = "2027-06-26",+ rooms = 2,+ adults = 3,+ latitude = 48.8566,+ longitude = 2.3522,+ ),+ routeForRecent(recent),+ )+ }++ @Test+ fun routeForRecent_legacyDefaultsKeepOldRerunShape() {+ // A recent written before the extra fields existed (column defaults:+ // no children/infants, no cap, 1 room, no coordinates) re-runs with+ // exactly the values it always re-ran with.+ val flight = RecentSearch(+ vertical = "FLIGHTS",+ label = "SFO โ JFK",+ origin = "SFO",+ destination = "JFK",+ depart = "2027-06-24",+ adults = 1,+ )+ assertEquals(+ Route.FlightResults(+ slices = "SFO:JFK:2027-06-24",+ adults = 1,+ children = "",+ infants = 0,+ cabin = "economy",+ maxConnections = -1,+ ),+ routeForRecent(flight),+ )+ val stay = RecentSearch(+ vertical = "STAYS",+ label = "Paris",+ origin = "Paris",+ depart = "2027-06-24",+ returnDate = "2027-06-26",+ adults = 2,+ )+ val stayRoute = routeForRecent(stay) as Route.StayResults+ assertEquals(1, stayRoute.rooms)+ assertEquals(2, stayRoute.adults)+ }+}