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

Improve paging - avoid duplicates and missed itineraries when paging #5551

Merged
merged 49 commits into from
Dec 14, 2023

Conversation

t2gran
Copy link
Member

@t2gran t2gran commented Dec 6, 2023

Summary

There was a few smaller issues with the paging. This PR clean up the code and fixes a few bugs. It also improve the token serialization framework. Ideally this PR could be split in at least 3 PRs, but that would lead to problems with the forward and backward compatibility.

NOTE! This PR breaks the forward and backward compatibility for paging. It would be possible to stay backwards compatible, but the cost is probably higher than the gain. Hence; we advice to roll out this when traffic is low - minimising the impact for end users.

Overview

  • Add support for boolean and enums in tokens
  • Make tokens human-readable after base64 decode
  • Make paging a isolated component with PagingServicethe entry point
    • This enable us to write a clean module test on the paging testing all paging logic in isolation.
    • There is also almost 100% branch coverage on each unit.
  • Use the last kept itinerary as page-cut, not first removed
  • Make search-window [inclusive, exclusive] - this fixes a bug
  • The latest-arrival-time should not change for arriveBy search when paging back

Issue

Closes #5040

Unit tests

✅ Unit-test
✅ Module test

Documentation

The JavaDoc is updated, but the paging design doc is not - we will do that in another PR.

Changelog

Bumping the serialization version id

Not requiered.

Removing itineraries outside the search-window is the responsibility of another filter.
� Conflicts:
�	src/test/java/org/opentripplanner/model/plan/pagecursor/DeduplicationPageCutTest.java
� Conflicts:
�	src/test/java/org/opentripplanner/model/plan/pagecursor/DeduplicationPageCutTest.java
� Conflicts:
�	src/test/java/org/opentripplanner/model/plan/pagecursor/DeduplicationPageCutTest.java
This will allow us to write a proper unit test on the paging logic.
This is used to allow a function can save a result in the box.
…tests.

Turn on debug using the system property on the cmd line: "-DtestDebug"
…ng into PagingServiceFactory

This will enable us to write unit test on the mapping and module test on the paging.
Co-authored-by: Leonard Ehrenfried <[email protected]>
@leonardehrenfried
Copy link
Member

Can you resolve the conflicts?

Copy link
Contributor

@jtorin jtorin left a comment

Choose a reason for hiding this comment

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

I've not finished the whole PR yet, will continue in another session.

@t2gran t2gran requested a review from jtorin December 11, 2023 15:17
Copy link
Contributor

@jtorin jtorin left a comment

Choose a reason for hiding this comment

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

Second and last batch of review comments.

(It was like being on a quest with Falkor... 😅)

t2gran and others added 5 commits December 12, 2023 14:43
The unit-test for CharacterEscapeFormatter is also improved.
This also address a few comments from the review. More unit-tests are
added and a few is cleaned.

# Conflicts:
#	src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java
@t2gran t2gran requested a review from jtorin December 12, 2023 16:39
@t2gran
Copy link
Member Author

t2gran commented Dec 12, 2023

@jtorin Thank you for a very good review! I think I have fixed all issues now, except one comment I did not understand.

t2gran added a commit to entur/OpenTripPlanner-LegacyHSLFork that referenced this pull request Dec 12, 2023
@t2gran t2gran force-pushed the serialize_page_token branch from 74156d0 to ad2e35d Compare December 13, 2023 12:46
@t2gran t2gran requested a review from jtorin December 13, 2023 15:55
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.

I must admit that this code goes a little over my head but the code quality is solid. I've picked up on a typo but overall this looks good.

…n/deletionflagger/OutsideSearchWindowFilter.java

Co-authored-by: Leonard Ehrenfried <[email protected]>
@t2gran t2gran merged commit e478e32 into opentripplanner:dev-2.x Dec 14, 2023
5 checks passed
@t2gran t2gran deleted the serialize_page_token branch December 14, 2023 10:11
t2gran pushed a commit that referenced this pull request Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Entur Test This is currently being tested at Entur Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid duplicates when paging trip queries
3 participants