Skip to content

Reject SIRI-ET updates with empty StopPointRefs - #6266

Merged
leonardehrenfried merged 2 commits into
opentripplanner:dev-2.xfrom
leonardehrenfried:empty-stop-point-ref
Nov 26, 2024
Merged

Reject SIRI-ET updates with empty StopPointRefs#6266
leonardehrenfried merged 2 commits into
opentripplanner:dev-2.xfrom
leonardehrenfried:empty-stop-point-ref

Conversation

@leonardehrenfried

@leonardehrenfried leonardehrenfried commented Nov 20, 2024

Copy link
Copy Markdown
Member

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/opendatahub-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
@codecov

codecov Bot commented Nov 20, 2024

Copy link
Copy Markdown

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 The issue/PR is related to RealTime updates label Nov 21, 2024
@leonardehrenfried

Copy link
Copy Markdown
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

@lassetyr lassetyr 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.

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

return UpdateError.result(trip != null ? trip.getId() : null, NOT_MONITORED, dataSource);
}

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

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.

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
Copy Markdown
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
Copy Markdown
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
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
@t2gran t2gran added this to the 2.7 (next release) milestone Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+Real-Time The issue/PR is related to RealTime updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants