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

Fix max-stop limit in StreetNearbyStopFinder #6160

Conversation

habrahamsson-skanetrafiken
Copy link
Contributor

Summary

This PR fixes an issue in the StreetNearbyStopFinder with the max-stops counting.

The issue is that we use a SkipEdgeStrategy to keep track of how many stops we've passed. But a skip-edge strategy will be called once per edge, not once per vertex. This means that if a stop has n incoming edges it will be counted n times and thus we might terminate the search before we've reached the desired number of stops.

The documentation in SearchTerminationStrategy clearly says that it should be used for these kinds of purposes.

Unit tests

  • Enabled a few tests that were disabled in StreetNearbyStopFinderTest since they will now pass.
  • Added a new specific test for this regression as a separate file. (Is it ok to add ad-hoc test files like this?)
  • Unit tests for the new MaxCountTerminationStrategy.

Bumping the serialization version id

No

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

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

Project coverage is 69.89%. Comparing base (c5a988e) to head (94403bf).
Report is 299 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...der/module/nearbystops/StreetNearbyStopFinder.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6160      +/-   ##
=============================================
- Coverage      69.90%   69.89%   -0.01%     
+ Complexity     17709    17704       -5     
=============================================
  Files           1996     1996              
  Lines          75328    75325       -3     
  Branches        7713     7713              
=============================================
- Hits           52659    52652       -7     
- Misses         19992    19997       +5     
+ Partials        2677     2676       -1     

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

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

A very good pull request with great test coverage.

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken merged commit 1f25aae into opentripplanner:dev-2.x Nov 7, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants