Skip to content

Fix SIRI update travel back in time - #5867

Merged
vpaturet merged 4 commits into
opentripplanner:dev-2.xfrom
entur:fix_siri_update_travel_back_in_time
Jun 7, 2024
Merged

vpaturet merged 4 commits into
opentripplanner:dev-2.xfrom
entur:fix_siri_update_travel_back_in_time

Conversation

@vpaturet

@vpaturet vpaturet commented May 24, 2024

Copy link
Copy Markdown
Contributor

Summary

As detailed in #5866, some combinations of SIRI messages lead to the creation of invalid trips where passing times do not increase along the journey.
This PR aims to fix one such scenario where:

  1. a first SIRI message creates an extra journey with invalid scheduled data and valid real time data.
  2. OTP accepts the real time data without validating the scheduled data.
  3. a second message cancels the extra journey.
  4. OTP accepts the cancellation, delete the real time data and falls back to the (invalid) scheduled data.

The canceled trip can then be queried thanks to the API parameter includeRealtimeCancellations=true

The proposed fix is to validate the scheduled data in step 2 and rejects messages that contain invalid scheduled data.

Issue

Closes #5866

Unit tests

Added unit test

@vpaturet
vpaturet force-pushed the fix_siri_update_travel_back_in_time branch 2 times, most recently from 2dc2265 to a71c690 Compare May 24, 2024 14:28
@codecov

codecov Bot commented May 24, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.47%. Comparing base (06a7e8c) to head (e7e38e4).
Report is 1 commits behind head on dev-2.x.

Current head e7e38e4 differs from pull request most recent head d84e7f5

Please upload reports for the commit d84e7f5 to get more accurate results.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5867      +/-   ##
=============================================
- Coverage      68.54%   68.47%   -0.07%     
+ Complexity     16732    16699      -33     
=============================================
  Files           1918     1914       -4     
  Lines          72734    72676      -58     
  Branches        7456     7454       -2     
=============================================
- Hits           49854    49768      -86     
- Misses         20310    20338      +28     
  Partials        2570     2570              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vpaturet

Copy link
Copy Markdown
Contributor Author

@lassetyr The fix introduces a systematic validation of scheduled data for extra journeys:
a71c690
(there is only one commit in this PR, it should be rebased when #5865 is merged)

This is likely to have little impact on performance, but may lead to more rejected messages. Is this acceptable?

@lassetyr

Copy link
Copy Markdown
Contributor

I do not see any reason why we/OTP should accept invalid data, so in my opinion, this is acceptable.

@vpaturet vpaturet self-assigned this May 28, 2024
@vpaturet vpaturet added !Bug Apply to issues describing a bug and PRs witch fixes it. +Real-Time The issue/PR is related to RealTime updates labels May 28, 2024
Comment thread src/ext/java/org/opentripplanner/ext/siri/AddedTripBuilder.java
@vpaturet
vpaturet force-pushed the fix_siri_update_travel_back_in_time branch from a71c690 to f3c38ed Compare May 29, 2024 09:35
@vpaturet
vpaturet force-pushed the fix_siri_update_travel_back_in_time branch from f3c38ed to e7e38e4 Compare May 29, 2024 09:51
@vpaturet
vpaturet marked this pull request as ready for review May 29, 2024 10:00
@vpaturet
vpaturet requested a review from a team as a code owner May 29, 2024 10:00
@t2gran t2gran added this to the 2.6 (next release) milestone Jun 3, 2024

@t2gran t2gran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code looks ok, just a few questions.

Comment thread src/main/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimes.java Outdated
@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Jun 6, 2024
@vpaturet
vpaturet merged commit 0a58d0f into opentripplanner:dev-2.x Jun 7, 2024
t2gran pushed a commit that referenced this pull request Jun 7, 2024
@t2gran
t2gran deleted the fix_siri_update_travel_back_in_time branch January 30, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it. Entur Test This is currently being tested at Entur +Real-Time The issue/PR is related to RealTime updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelation of invalid SIRI extra journey leads to travel back in time

4 participants