Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject SIRI-ET updates with empty StopPointRefs #6266

Conversation

leonardehrenfried
Copy link
Member

@leonardehrenfried leonardehrenfried commented Nov 20, 2024

Summary

A SIRI feed from South Tyrol that I'm working with contains empty <StopPointRef> elements that cause the fuzzy trip matcher to crash.

For this reason I added a check that rejects any VehicleJourney which contains these empty elements.

Issue

Relates to noi-techpark/odh-mentor-otp#213

Unit tests

GTFS-RT has module tests but SIRI didn't so far but this PR adds them there, too.

Changelog

✔️

Bumping the serialization version id

cc @rcavaliere

@leonardehrenfried leonardehrenfried requested a review from a team as a code owner November 20, 2024 16:40
@leonardehrenfried leonardehrenfried changed the title Rejection SIRI updates with empty StopPointRefs Reject SIRI updates with empty StopPointRefs Nov 20, 2024
@leonardehrenfried leonardehrenfried changed the title Reject SIRI updates with empty StopPointRefs Reject SIRI-ET updates with empty StopPointRefs Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.71%. Comparing base (5b5d92f) to head (dd69e79).
Report is 74 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...nner/updater/siri/SiriTimetableSnapshotSource.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6266      +/-   ##
=============================================
- Coverage      69.71%   69.71%   -0.01%     
- Complexity     17696    17698       +2     
=============================================
  Files           2008     2008              
  Lines          75834    75840       +6     
  Branches        7765     7768       +3     
=============================================
+ Hits           52866    52869       +3     
- Misses         20256    20258       +2     
- Partials        2712     2713       +1     

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


🚨 Try these New Features:

@leonardehrenfried leonardehrenfried added the Real-Time Update The issue/PR is related to RealTime updates label Nov 21, 2024
@leonardehrenfried
Copy link
Member Author

@lassetyr Can you confirm that we never want to process calls where the StopPointRef is empty?

lassetyr
lassetyr previously approved these changes Nov 21, 2024
Copy link
Contributor

@lassetyr lassetyr left a comment

Choose a reason for hiding this comment

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

StopPointRef is a required field in SIRI ET, so rejecting these will be fine

@@ -228,6 +230,16 @@ private Result<TripUpdate, UpdateError> handleModifiedTrip(
return UpdateError.result(trip != null ? trip.getId() : null, NOT_MONITORED, dataSource);
}

for (var call : CallWrapper.of(estimatedVehicleJourney)) {

Choose a reason for hiding this comment

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

This will only be validated for modified trips, but I think we should probably enforce it for added trips as well? What do you think about moving this check to it's own method and calling it as the first thing in the SiriTimetableSnapshotSource.apply() method?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point, since there it is even more important. I changed it here: 5315ec1

Copy link
Member Author

Choose a reason for hiding this comment

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

I also added a parameterized test so both options are tested.

@leonardehrenfried leonardehrenfried merged commit 9aac708 into opentripplanner:dev-2.x Nov 26, 2024
5 checks passed
t2gran pushed a commit that referenced this pull request Nov 26, 2024
@leonardehrenfried leonardehrenfried deleted the empty-stop-point-ref branch November 26, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Real-Time Update The issue/PR is related to RealTime updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants