Skip to content

GTFS-RT Trip Update schedule status > fix wrong 1 min validity#180

Merged
mmathieum merged 4 commits into
masterfrom
mm/fix_validity_useful_poi_status_etc
Jul 22, 2026
Merged

GTFS-RT Trip Update schedule status > fix wrong 1 min validity#180
mmathieum merged 4 commits into
masterfrom
mm/fix_validity_useful_poi_status_etc

Conversation

@mmathieum

@mmathieum mmathieum commented Jul 22, 2026

Copy link
Copy Markdown
Member

Also clarify useful VS validity.
Also fixes UI showing static data every min before reloading RT data (because 1 min old RT data was not "useful")

Also clarify useful VS validity.
Also fixes UI showing static data every min before reloading RT data (because 1 min old RT data was not "useful")
@mmathieum mmathieum self-assigned this Jul 22, 2026
@mmathieum mmathieum added the P2 🔼 Priority 2: High label Jul 22, 2026
@mmathieum mmathieum linked an issue Jul 22, 2026 that may be closed by this pull request
@mmathieum
mmathieum marked this pull request as ready for review July 22, 2026 21:00
@mmathieum
mmathieum requested a review from Copilot July 22, 2026 21:00

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.

Pull request overview

This PR clarifies and corrects “useful vs validity” semantics for status objects, particularly for GTFS-RT Trip Updates, so that real-time data isn’t treated as “not useful” after only 1 minute (which was causing the UI to fall back to static data before RT refresh completes).

Changes:

  • Rename/standardize status expiry from validityInMs to maxValidityInMs across POIStatus-based models and provider contract columns.
  • Update GTFS-RT Trip Updates schedule creation to use the provider’s max validity rather than the 1-minute refresh validity.
  • Add isValid() helpers (and refactor isUseful() to delegate) for clearer status staleness checks.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderTests.kt Updates test schedule construction to use maxValidityInMs.
src/main/java/org/mtransit/android/MtLogExt.kt Adjusts date-time log formatting (time style).
src/main/java/org/mtransit/android/commons/provider/status/StatusProviderContract.kt Renames projection/column constant to T_STATUS_K_MAX_VALIDITY and keeps max validity defaults.
src/main/java/org/mtransit/android/commons/provider/status/StatusProvider.java Maps DB validity column to the renamed contract column alias.
src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt Uses statusMaxValidityInMs when building/caching schedules for trip updates.
src/main/java/org/mtransit/android/commons/data/ServiceUpdate.java Refactors usefulness to isValid() for clarity.
src/main/java/org/mtransit/android/commons/data/ScheduleExt.kt Renames schedule factory parameter and introduces makeSchedule2 with deprecation wrapper.
src/main/java/org/mtransit/android/commons/data/Schedule.java Switches schedule usefulness to isValid() and adds an overridden validity rule.
src/main/java/org/mtransit/android/commons/data/POIStatus.java Renames stored validity field to maxValidityInMs, updates cursor/ContentValues mapping, and adds isValid().
src/main/java/org/mtransit/android/commons/data/News.java Refactors usefulness to isValid() and modernizes hashCode() implementation for longs.
src/main/java/org/mtransit/android/commons/data/AvailabilityPercent.java Uses getMaxValidityInMs() when copying from a POIStatus.
src/main/java/org/mtransit/android/commons/data/AppStatus.java Uses getMaxValidityInMs() when copying from a POIStatus.

Comment thread src/main/java/org/mtransit/android/commons/data/ScheduleExt.kt Outdated
Comment thread src/main/java/org/mtransit/android/commons/data/Schedule.java
mmathieum added a commit to mtransitapps/mtransit-for-android that referenced this pull request Jul 22, 2026
@mmathieum
mmathieum merged commit d3100e9 into master Jul 22, 2026
4 checks passed
@mmathieum
mmathieum deleted the mm/fix_validity_useful_poi_status_etc branch July 22, 2026 21:12
mmathieum added a commit to mtransitapps/mtransit-for-android that referenced this pull request Jul 22, 2026
montransit added a commit to mtransitapps/ca-moose-jaw-transit-bus-android that referenced this pull request Jul 23, 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-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180
- parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
montransit added a commit to mtransitapps/ca-mrc-nicolet-yamaska-bili-bus-android that referenced this pull request Jul 23, 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-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180
- parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
montransit added a commit to mtransitapps/ca-st-hyacinthe-transport-collectif-bus-android that referenced this pull request Jul 23, 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-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180
- parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 🔼 Priority 2: High

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status (schedule, availability...) > clarify useful VS validity 🤯

2 participants