always include a walk/vehicleRentalState=null state in initial states #6244
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
Alternative fix for #6054 .
Generate an initial state with currentMode = WALK, vehicleRentalState = null in addition to the others, when requestMode.includesRenting() and arriveBy = true.
I think this solution changes some general assumptions in what states are possible, and should perhaps be discarded purely on that basis. Earlier, I think it was the case that if requestMode.includesRenting(), vehicleRentalState is never null, it's always either BEFORE_RENTING, HAVE_RENTED, RENTING_FROM_STATION, or RENTING_FLOATING, and the expectation was that it is allowed for BEFORE_RENTING or HAVE_RENTED to reach the goal without ever actually have been renting anything, and it's still a success. Now, it can be null, and it is possible that for correctness every state.getRequest().mode().includesRenting() should be state.getRequest().mode().includesRenting() && state.getVehicleRentalState() != null instead. I only changed the one at the beginning of StreetEdge.traverse, and it seems to work, but it feels incomplete.
Issue
Closes #6054
Unit tests
Because of the above mentioned expectation on the link between includesRenting and vehicleRentalState, some unit test changes were forced.
Documentation
None.
Changelog
Yes, fixes a real bug.
Bumping the serialization version id
No.