Conversation
…ches TransferPathLeg derived its toStop from transfer.stop(), but that is direction-relative: a transfer obtained through RaptorTransitDataProvider#getTransfersToStop(int) (the reverse-search path) reports stop() as the leg's origin, not its destination. The correct, direction-independent destination stop was already computed and threaded through PathBuilderLeg (every caller of PathBuilder#transfer(transfer, toStop) already passes it explicitly - see ForwardPathMapper and ReversePathMapper), but PathBuilderLeg#createTransferPathLeg() never used it, letting TransferPathLeg's constructor silently re-derive the wrong value from transfer.stop() instead. TransferPathLeg now takes toStop as an explicit constructor parameter, and createTransferPathLeg() passes the already-correct PathBuilderLeg#toStop() through instead of leaving it to be recomputed. The existing basic-path forward/reverse-search test only asserts on the path's rendered string, which (misleadingly) does not depend on TransferPathLeg#toStop() and therefore didn't catch this. Added a direct assertion on the reverse-search transfer leg's fromStop()/toStop() to PathMapperTest, which fails with the expected <3> but was <2> before this fix and passes after it. closes opentripplanner#8047
t2gran
force-pushed
the
fix-reverse-transfer-leg-stop
branch
from
October 1, 2026 00:17
5fa2c03 to
e0dc038
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #8062 +/- ##
==========================================
Coverage 74.61% 74.62%
- Complexity 22875 22876 +1
==========================================
Files 2533 2533
Lines 88523 88523
Branches 8752 8752
==========================================
+ Hits 66055 66058 +3
+ Misses 19399 19396 -3
Partials 3069 3069 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TransferPathLeg derived its toStop from transfer.stop(), but that is direction-relative: a transfer obtained through
RaptorTransitDataProvider#getTransfersToStop(int) (the reverse-search path) reports stop() as the leg's origin, not its destination. The correct, direction-independent destination stop was already computed and threaded through PathBuilderLeg (every caller of PathBuilder#transfer(transfer, toStop) already passes it explicitly - see ForwardPathMapper and ReversePathMapper), but PathBuilderLeg#createTransferPathLeg() never used it, letting TransferPathLeg's constructor silently re-derive the wrong value from transfer.stop() instead.
TransferPathLeg now takes toStop as an explicit constructor parameter, and createTransferPathLeg() passes the already-correct PathBuilderLeg#toStop() through instead of leaving it to be recomputed. This is also one step closer to NOT hold a reference to the transfer in transfer arrivals - this is not needed and would save memory and speed up the search.
The existing basic-path forward/reverse-search test only asserts on the path's rendered string, which (misleadingly) does not depend on TransferPathLeg#toStop() and therefore didn't catch this. Added a direct assertion on the reverse-search transfer leg's fromStop()/toStop() to PathMapperTest, which fails with the expected <3> but was <2> before this fix and passes after it.
Issue
closes #8047
Unit tests
✅ Updated
Documentation
✅ JavaDoc added
Changelog
✅ Minor bugfix - not visible in the APIs
Bumping the serialization version id
🟥 No serialized data changed