GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops#178
Conversation
SKIPPED stops w/ wrong stop_sequence #exoThere was a problem hiding this comment.
⚠️ Not ready to approve
New fixStopSequence() behavior is not covered by unit tests and there are a few correctness/consistency issues in the touched logging/tag code that should be addressed before approval.
Pull request overview
This PR updates the GTFS-RT Trip Updates processing to better handle feeds where stop sequences can be wrong (attempting to correct them when the stop is encountered only once) and to retain cancelled trips/stops by treating “cancelled” similarly to “real-time” for downstream filtering/cleanup.
Changes:
- Refactors trip schedule handling to be keyed by
targetUUIDand threads that through trip update processing. - Adds
fixStopSequence()to rewrite/ignore StopTimeUpdates that don’t match the static stop sequence but can be mapped by stop_id. - Updates schedule cancellation helpers to distinguish trip-level vs stop-time-level cancellation and ensures cancelled timestamps are retained in “real-time” filtering logic.
File summaries
| File | Description |
|---|---|
| src/test/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderTests.kt | Adjusts tests to pass schedules as a UUID-keyed map to match updated processing API. |
| src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderExt.kt | Refactors processing API to use schedules-by-UUID, adds stop-sequence fixing/filtering, and updates cancellation call sites. |
| src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt | Treats cancelled timestamps as “real-time” for trip retention/cleanup decisions. |
| src/main/java/org/mtransit/android/commons/provider/serviceupdate/GTFSRealTimeServiceAlertsProvider.kt | Exposes LOG_TAG via @JvmStatic for Java-side logging. |
| src/main/java/org/mtransit/android/commons/provider/GTFSRealTimeProvider.java | Routes service-alert logging through the alerts provider log tag constant. |
| src/main/java/org/mtransit/android/commons/data/ScheduleExt.kt | Renames and clarifies trip vs stop-time cancellation helpers and updates timestamp string formatting. |
| src/main/java/org/mtransit/android/commons/data/Schedule.java | Adds isRealTimeOrCancelled() helper used by Kotlin filtering logic. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 5
- Review effort level: Low
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
There was a problem hiding this comment.
⚠️ Not ready to approve
fixStopSequence() currently logs a warning for every ignored stop-time update, which can produce excessive noisy logs in real GTFS-RT feeds.
Review details
Comments suppressed due to low confidence (1)
src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderExt.kt:214
fixStopSequence()logs a warning for every ignored stop time update; in real GTFS-RT feeds this can happen frequently (extra/invalid STUs), so usingMTLog.where can create noisy logs and operational alerting. Consider downgrading this to debug (or sampling/throttling) since the STU is intentionally being dropped.
MTLog.w(LOG_TAG, "fixStopSequence($tripId) > IGNORE (no stop ID/sequence match): ${stu.toStringExt()}")
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Low
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
- commons: Target SDK `36` (Android 16) before Aug 31, 2026 mtransitapps/commons#817 - commons: Create `.aiexclude` to manage AI file exclusions mtransitapps/commons#816 - commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - commons-android: Update SSL cert mtransitapps/commons-android#177 - parser: comment fix
- commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - parser: comment fix
- commons: Target SDK `36` (Android 16) before Aug 31, 2026 mtransitapps/commons#817 - commons: Create `.aiexclude` to manage AI file exclusions mtransitapps/commons#816 - commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - commons-android: Update SSL cert mtransitapps/commons-android#177 - parser: comment fix
… fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178
- commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - commons-android: Update SSL cert mtransitapps/commons-android#177 - parser: comment fix
- commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - parser: comment fix
- commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - parser: comment fix
- commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - commons-android: Update SSL cert mtransitapps/commons-android#177 - parser: comment fix
- commons: Build(deps): Bump com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk from 1.2.1 to 1.3.0 mtransitapps/commons#819 - commons: Target SDK `36` (Android 16) before Aug 31, 2026 mtransitapps/commons#817 - commons: Create `.aiexclude` to manage AI file exclusions mtransitapps/commons#816 - commons: Allow `download()` user-agent override via `MT_DOWNLOAD_USER_AGENT` mtransitapps/commons#815 - commons: Build(deps): Bump android-gradlePlugin from 9.2.1 to 9.3.0 mtransitapps/commons#814 - commons: Fix `mt-record-screenshots.yml` #810 - commons: Switch latest APK fetch to `gh release download` and pick first APK artifact mtransitapps/commons#810 - commons-android: GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178 - commons-android: Update SSL cert mtransitapps/commons-android#177 - commons-android: GTFS-RT > Trip Updates > handle wrong stop sequence w/o loosing all data mtransitapps/commons-android#176 - commons-android: GTFS-RT Trip Update > fix same stop matching mtransitapps/commons-android#175 - commons-android: suppress - parser: comment fix
No description provided.