GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future - #194
Conversation
…h into the future
PR Summary by QodoGTFS-RT Trip Updates: never drop CANCELLED trips for being too far ahead
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Non-scheduled bypasses freshness
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesTrip update filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt (1)
123-147: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression coverage for the new ordering.
In
src/test/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderTests.kt, exercise the provider path with:
CANCELEDand a start time beyondFUTURE_TRIP_UPDATE_MAX_DIFF_MS: accepted.SCHEDULEDwith the same start time: rejected.- An old
CANCELEDtimestamp: verify the intended no-max-age policy.- A missing trip descriptor: rejected.
These tests will protect the cancellation fix and make the broader non-
SCHEDULEDbehavior explicit.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt` around lines 123 - 147, Add regression tests in GTFSRealTimeTripUpdatesProviderTests covering isUseful/provider behavior for a future CANCELED trip being accepted, an equivalent SCHEDULED trip being rejected, an old CANCELED timestamp following the intended no-max-age policy, and a missing trip descriptor being rejected. Reuse the existing test fixtures and provider path to verify the new non-SCHEDULED ordering behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt`:
- Around line 125-129: Update the scheduleRelationship handling in
GTFSRealTimeTripUpdatesProvider so the early return bypassing max-age checks
occurs only for CANCELED and DELETED; allow ADDED, UNSCHEDULED, REPLACEMENT,
DUPLICATED, and NEW to continue through timestamp filtering. Add regression
tests covering both terminal early-return behavior and non-terminal timestamp
filtering.
---
Nitpick comments:
In
`@src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt`:
- Around line 123-147: Add regression tests in
GTFSRealTimeTripUpdatesProviderTests covering isUseful/provider behavior for a
future CANCELED trip being accepted, an equivalent SCHEDULED trip being
rejected, an old CANCELED timestamp following the intended no-max-age policy,
and a missing trip descriptor being rejected. Reuse the existing test fixtures
and provider path to verify the new non-SCHEDULED ordering behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8bcc2e83-ac25-487a-920f-6168211eaf41
📒 Files selected for processing (1)
src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt
There was a problem hiding this comment.
Pull request overview
Updates the GTFS-RT TripUpdate “usefulness” filter so that trip updates marking trips as CANCELED/DELETED are no longer discarded solely because the trip start time is far in the future, ensuring cancellations remain visible/actionable even when announced well ahead of time.
Changes:
- Treat
TripDescriptor.schedule_relationship == CANCELEDorDELETEDas always “useful” (bypass max-age and far-future filtering). - Simplify downstream logic by using a non-null local
optTripafter an early return.
…ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
…parser': - commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834) - commons: Add `detekt` mtransitapps/commons#836 - commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835 - commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834 - commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194 - commons-android: `Schedule` > + `hasRealTimeOrCancelled` - commons-android: Add `detekt` mtransitapps/commons-android#193 - commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192 - commons-java: Add `detekt` mtransitapps/commons-java#46 - parser: Add `detekt` mtransitapps/parser#84
…parser': - commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834) - commons: Add `detekt` mtransitapps/commons#836 - commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835 - commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194 - commons-android: `Schedule` > + `hasRealTimeOrCancelled` - commons-android: Add `detekt` mtransitapps/commons-android#193 - commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192 - commons-java: Add `detekt` mtransitapps/commons-java#46 - parser: Add `detekt` mtransitapps/parser#84
…parser': - commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834) - commons: Add `detekt` mtransitapps/commons#836 - commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835 - commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834 - commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194 - commons-android: `Schedule` > + `hasRealTimeOrCancelled` - commons-android: Add `detekt` mtransitapps/commons-android#193 - commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192 - commons-java: Add `detekt` mtransitapps/commons-java#46 - parser: Add `detekt` mtransitapps/parser#84
…parser': - commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834) - commons: Add `detekt` mtransitapps/commons#836 - commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835 - commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834 - commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194 - commons-android: `Schedule` > + `hasRealTimeOrCancelled` - commons-android: Add `detekt` mtransitapps/commons-android#193 - commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192 - commons-java: Add `detekt` mtransitapps/commons-java#46 - parser: Add `detekt` mtransitapps/parser#84
…parser': - commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834) - commons: Add `detekt` mtransitapps/commons#836 - commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835 - commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834 - commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194 - commons-android: `Schedule` > + `hasRealTimeOrCancelled` - commons-android: Add `detekt` mtransitapps/commons-android#193 - commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192 - commons-java: Add `detekt` mtransitapps/commons-java#46 - parser: Add `detekt` mtransitapps/parser#84
Later: could ignore when really far away into the future if it happens in the real world 🗺️ and it becomes a performance issue.