Skip to content

GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops#178

Merged
mmathieum merged 6 commits into
masterfrom
mm/gtfs_rt_tu_skipped_wrong_stop_seq
Jul 21, 2026
Merged

GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops#178
mmathieum merged 6 commits into
masterfrom
mm/gtfs_rt_tu_skipped_wrong_stop_seq

Conversation

@mmathieum

Copy link
Copy Markdown
Member

No description provided.

@mmathieum mmathieum self-assigned this Jul 21, 2026
@mmathieum mmathieum changed the title GTFS-RT > Trip Updates > SKIPPED stops w/ wrong stop_sequence #exo GTFS-RT > Trip Updates > try to fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops Jul 21, 2026
@mmathieum
mmathieum requested a review from Copilot July 21, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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 targetUUID and 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.

Comment thread src/main/java/org/mtransit/android/commons/provider/GTFSRealTimeProvider.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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 using MTLog.w here 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.

@mmathieum
mmathieum marked this pull request as ready for review July 21, 2026 19:26
@mmathieum
mmathieum merged commit 1f1d2b6 into master Jul 21, 2026
5 checks passed
@mmathieum
mmathieum deleted the mm/gtfs_rt_tu_skipped_wrong_stop_seq branch July 21, 2026 19:26
mmathieum added a commit to mtransitapps/ca-richelieu-citvr-bus-android that referenced this pull request Jul 21, 2026
- 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
mmathieum added a commit to mtransitapps/ca-montreal-amt-train-android that referenced this pull request Jul 21, 2026
- 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
mmathieum added a commit to mtransitapps/ca-edmonton-ets-bus-android that referenced this pull request Jul 21, 2026
- 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
montransit added a commit to mtransitapps/mtransit-for-android that referenced this pull request Jul 21, 2026
… fix wrong stop sequence when trip stop passed once & keep all cancelled trips/stops mtransitapps/commons-android#178
mmathieum added a commit to mtransitapps/fr-sncf-voyageurs-train-android that referenced this pull request Jul 21, 2026
- 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
montransit added a commit to mtransitapps/ca-st-hyacinthe-transport-collectif-bus-android that referenced this pull request Jul 22, 2026
- 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
montransit added a commit to mtransitapps/ca-moose-jaw-transit-bus-android that referenced this pull request Jul 22, 2026
- 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
montransit added a commit to mtransitapps/ca-mrc-nicolet-yamaska-bili-bus-android that referenced this pull request Jul 22, 2026
- 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
montransit added a commit to mtransitapps/ca-montreal-rem-light-rail-android that referenced this pull request Jul 22, 2026
- 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
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.

2 participants