Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / travel / AGENTS.md
| 1 | # AGENTS.md — travel/ (':travel') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `travel/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install travel (dev by default)._ |
| 6 | - Gradle: :travel / dir: travel/ |
| 7 | - Package roots present: ui, data, domain, network, platform |
| 8 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 9 | - Package roots present: ui, data, network, intents, domain, platform |
| 10 | - Entry files: MainActivity.kt (no Route.kt — search/results/booking/manage flow with pages) |
| 11 | - Deps: :library:room, :library:network, :library:image, Stripe Android SDK (payment sheet) |
| 12 | - Metadata: metadata_data/travel.md (present) |
| 13 | - Rust: no / screenshotTest: yes |
| 14 | |
| 15 | ### Relay server note (backend, outside this repo) |
| 16 | `travel` does not use the relay directly, but `NetworkClient.init(FIRST_PARTY)` covers `api.maproj.org`. Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Full details: root `AGENTS.md` → "Backend server (outside this repo)". |
| 17 | |
| 18 | ## Overview |
| 19 | **Purpose:** Flight + hotel booking — search/comparison, seat maps, ancillaries/offers, trip management with in-app card payment; trips persist on-device so plans stay readable offline. |
| 20 | **Key features:** |
| 21 | - Flight search form (one-way / round-trip) → results → offer review → passengers → trip → ancillaries → payment sheet → confirm → confirmation; cancel/manage on booked trips (online changes are not offered — server sends `canChange=false`) |
| 22 | - Round-trip step-by-step (grouped on-device); stays search → detail → guests → payment sheet → confirm → confirmation; seat-map picker |
| 23 | - `data/` Room (trips, local booking profiles, frequent-flyer, recent searches) + `domain/` on-device grouping/status + `network/` trip/stays DTOs + APIs |
| 24 | **Architecture / data-flow:** `ui/` search/results/booking pages → `platform/TravelViewModel` (+ `TravelUiContract`/`TravelUiState`, per-area `Travel*Ops`) → `domain/` grouping + `data/TravelRepository` over Room + `network/TravelApi`/`StaysApi`; booked trips stay readable from Room when offline. Every `*Page` is a thin binder over a stateless `*Screen` (state + `*Actions` from `platform/TravelUiContract.kt`), which is what `src/screenshotTest` renders. |
| 25 | **Entry points + reading order:** `MainActivity.kt` → `Navigation.kt` → `ui/HomePage.kt` → `ui/HomeScreen.kt` → `ui/FlightSearchForm.kt` → `platform/TravelViewModel.kt` → `platform/TravelSearchOps.kt` → `network/TravelApi.kt`. |
| 26 | - OpenAssistant read via `intents/GetTripsIntent` (`travel_get_trips`): stored trips as summaries only (name, dates, status, destination count), provider-capped at 10, behind the signature `ACCESS_TRAVEL` permission; no traveller, reference or cost data crosses |
| 27 | **Architecture / data-flow:** `ui/` search/results/booking pages → `util/TravelViewModel` (+ `TravelUiContract`/`TravelUiState`, per-area `Travel*Ops`) → `domain/` grouping + `data/TravelRepository` over Room + `network/TravelApi`/`StaysApi`; booked trips stay readable from Room when offline. |
| 28 | **Entry points + reading order:** `MainActivity.kt` → `ui/HomePage.kt` → `ui/FlightSearchForm.kt` → `util/TravelViewModel.kt` → `util/TravelSearchOps.kt` → `network/TravelApi.kt`. |
| 29 | **Gotchas:** |
| 30 | - Dialogs are routes: `Route.DatePickerDialog`/`DateRangeDialog`/`PassengerPickerDialog` (`DialogPage()` entries in `Navigation.kt`, stateless contents in `ui/dialogs/`, results via the nav result registry under the caller's key). `DateField`/`DateRangeFields`/`PassengerField` push them; never gate a picker on `remember` show-state |
| 31 | - Booking is money-moving — price/availability must be re-confirmed server-side before payment, never trusted from cached offers |
| 32 | - Offline readability is a feature (stored trips), offline booking is not — gate write paths on connectivity |
| 33 | - Payment: `POST /trips/:id/checkout` returns a payment-intent `clientSecret` + `publishableKey` (the provider's processor account, per environment); present it with `platform/StripeCheckout.kt`, then `POST /trips/:id/confirm` books it. Never book before the sheet reports Completed |
| 34 | |
| 35 | ## Key files |
| 36 | ### Root — entry + navigation |
| 37 | - com/vayunmathur/travel/MainActivity.kt |
| 38 | - com/vayunmathur/travel/Navigation.kt |
| 39 | - com/vayunmathur/travel/Route.kt |
| 40 | ### data/ — Room trips + profiles |
| 41 | - com/vayunmathur/travel/data/TravelDatabase.kt |
| 42 | - com/vayunmathur/travel/data/TravelRepository.kt |
| 43 | - com/vayunmathur/travel/data/BookedTrip.kt |
| 44 | - com/vayunmathur/travel/data/Customer.kt |
| 45 | - com/vayunmathur/travel/data/FrequentFlyer.kt |
| 46 | - com/vayunmathur/travel/data/RecentSearch.kt |
| 47 | ### domain/ — on-device offer + trip logic |
| 48 | - com/vayunmathur/travel/domain/OfferGrouping.kt |
| 49 | - com/vayunmathur/travel/domain/TripStatus.kt |
| 50 | ### intents/ — assistant IPC |
| 51 | - com/vayunmathur/travel/intents/GetTripsIntent.kt — `travel_get_trips` over `TravelRepository.getAllBookedTrips` |
| 52 | - com/vayunmathur/travel/intents/TripSummaries.kt — validated window/limit (max 10), summary mapping + destination count |
| 53 | ### platform/ — in-app card payment (Stripe payment sheet) |
| 54 | - com/vayunmathur/travel/platform/StripeCheckout.kt |
| 55 | ### network/ — airline + stays APIs |
| 56 | - com/vayunmathur/travel/network/TravelApi.kt |
| 57 | - com/vayunmathur/travel/network/OfferDto.kt |
| 58 | - com/vayunmathur/travel/network/OrderDto.kt |
| 59 | - com/vayunmathur/travel/network/ManageDto.kt |
| 60 | - com/vayunmathur/travel/network/AirlineDto.kt |
| 61 | - com/vayunmathur/travel/network/AncillaryDto.kt |
| 62 | - com/vayunmathur/travel/network/PlaceDto.kt |
| 63 | - com/vayunmathur/travel/network/StaysApi.kt |
| 64 | - com/vayunmathur/travel/network/StaysDto.kt |
| 65 | ### platform/ — ViewModel + booking ops |
| 66 | - com/vayunmathur/travel/platform/TravelViewModel.kt |
| 67 | - com/vayunmathur/travel/platform/TravelUiContract.kt |
| 68 | - com/vayunmathur/travel/platform/TravelUiState.kt |
| 69 | - com/vayunmathur/travel/platform/TravelSearchOps.kt |
| 70 | - com/vayunmathur/travel/platform/TravelBookingOps.kt |
| 71 | - com/vayunmathur/travel/platform/TravelOrderOps.kt |
| 72 | - com/vayunmathur/travel/platform/TravelCustomerOps.kt |
| 73 | - com/vayunmathur/travel/platform/TravelStayOps.kt |
| 74 | - com/vayunmathur/travel/platform/ContactAutofill.kt |
| 75 | - com/vayunmathur/travel/platform/StripeCheckout.kt |
| 76 | - com/vayunmathur/travel/platform/AppBackupAgent.kt — platform backup: `SqlCipherDbCodec` export/re-encrypt of `travel-db` (`travelDbConfigs` in `data/TravelDatabase.kt`) + `datastore_default`; raw DB/`secure_prefs` excluded in `res/xml/data_extraction_rules.xml` |
| 77 | ### ui/ — search, results, booking, trips, stays |
| 78 | - com/vayunmathur/travel/ui/HomePage.kt |
| 79 | - com/vayunmathur/travel/ui/FlightSearchForm.kt |
| 80 | - com/vayunmathur/travel/ui/FlightResultsPage.kt |
| 81 | - com/vayunmathur/travel/ui/OfferReviewPage.kt |
| 82 | - com/vayunmathur/travel/ui/PartialOffersPages.kt |
| 83 | - com/vayunmathur/travel/ui/PassengersPage.kt |
| 84 | - com/vayunmathur/travel/ui/PassengersFields.kt |
| 85 | - com/vayunmathur/travel/ui/PaymentPage.kt |
| 86 | - com/vayunmathur/travel/ui/SeatMapPage.kt |
| 87 | - com/vayunmathur/travel/ui/AncillariesPage.kt |
| 88 | - com/vayunmathur/travel/ui/ConfirmationPage.kt |
| 89 | - com/vayunmathur/travel/ui/OrderDetailPage.kt |
| 90 | - com/vayunmathur/travel/ui/ChangePage.kt |
| 91 | - com/vayunmathur/travel/ui/CancellationPage.kt |
| 92 | - com/vayunmathur/travel/ui/TripsPage.kt |
| 93 | - com/vayunmathur/travel/ui/StaySearchForm.kt |
| 94 | - com/vayunmathur/travel/ui/StayResultsScreen.kt |
| 95 | - com/vayunmathur/travel/ui/StayDetailPage.kt |
| 96 | - com/vayunmathur/travel/ui/StayGuestsPage.kt |
| 97 | - com/vayunmathur/travel/ui/StayConfirmationPage.kt |
| 98 | - com/vayunmathur/travel/ui/StaysPages.kt |
| 99 | - com/vayunmathur/travel/ui/StayLabels.kt |
| 100 | - com/vayunmathur/travel/ui/SettingsPage.kt |
| 101 | - com/vayunmathur/travel/ui/Common.kt |
| 102 | - com/vayunmathur/travel/ui/TravelFormat.kt |
| 103 | - Stateless `*Screen` slices beside their `*Page` binders: HomeScreen, OfferReviewScreen, OutboundSelectScreen, FareSelectScreen, AncillariesScreen, PassengersScreen, PaymentScreen, ConfirmationScreen, CancellationScreen, ChangeScreen, StayDetailScreen, StayGuestsScreen, StayConfirmationScreen, TripsScreen, SettingsScreen (plus FlightResultsScreen, SeatMapScreen, OrderDetailScreen, StayResultsScreen) |
| 104 | - com/vayunmathur/travel/ui/dialogs/DatePickerDialogContent.kt |
| 105 | - com/vayunmathur/travel/ui/dialogs/DateRangeDialogContent.kt |
| 106 | - com/vayunmathur/travel/ui/dialogs/PassengerPickerDialogContent.kt |
| 107 | - screenshotTest `ui/MetadataPreviews.kt` — one deterministic capture per `Route` leaf (`1-flights-home` … `20-settings`, `21-date-picker-dialog`, `22-date-range-dialog`, `23-passenger-picker-dialog`, `24-flight-results-expanded`) |
| 108 | |
| 109 | ## Verify (this module only) |
| 110 | ``` |
| 111 | ./gradlew :travel:compileDevKotlin |
| 112 | ./gradlew :travel:lint |
| 113 | ./gradlew :travel:checkMetadata |
| 114 | ``` |