Skip to content

fix(android): send route_id and start_date; never report the route as trip_id - #101

Open
aaronbrethorst wants to merge 2 commits into
feed-trip-descriptor-serverfrom
feed-trip-descriptor-android
Open

fix(android): send route_id and start_date; never report the route as trip_id#101
aaronbrethorst wants to merge 2 commits into
feed-trip-descriptor-serverfrom
feed-trip-descriptor-android

Conversation

@aaronbrethorst

Copy link
Copy Markdown
Member

Summary

Second PR in the trip-descriptor stack (stacked on the server PR). The Android driver app used to copy the route id into trip_id whenever the driver left the GTFS trip id blank, so the feed published a route id as a trip id. Now:

  • ActiveTrip stores gtfsTripId (blank when the driver only knows the route — never a route id) and startDate (service date, YYYYMMDD, the device-local calendar date when the trip started, fixed for the life of the trip).
  • Every location report sends route_id and start_date; trip_id is sent only when a GTFS trip id was entered, and is omitted from the JSON entirely otherwise (explicitNulls = false).
  • Both the entered route id and GTFS trip id are trimmed before they reach the trip-start request, local state or the wire, so "5 " can't publish an unmatchable route_id.
  • A trip persisted by an older build (no new DataStore keys) still loads: blank GTFS id, start date derived from the stored start time; the legacy trip_location_id key is cleaned up on clear.
  • ZoneId is provided by Hilt so the repository is testable with a fixed zone; tests cover the date-line rollover (23:30 UTC → next day in Nairobi).
  • The smoke-test doc checks, after the first GPS fix, that the feed shows routeId/startDate and no tripId for a route-only trip, and adds a final check with a GTFS trip id filled in; the Android design spec's "server-side note" is marked resolved.

Requires the server from the previous PR: an older server rejects route_id/start_date as unknown fields with 400.

Test plan

  • ./gradlew :app:testDebugUnitTest — new/updated: RepositoriesTest (gtfs id + route + Nairobi service date; blank gtfs id stays blank; serviceDate formatting), TrackerApiTest (exact key sets with and without trip_id), TripReporterTest (wire body with and without a GTFS id)
  • ./gradlew :app:compileDebugAndroidTestKotlin
  • Manual: follow docs/android-smoke-test.md (Check 2 and the final check) against a server running the previous PR

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 4834e36d-090e-4b96-ab0b-3ed137c3f779

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant