Skip to content

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

Merged
t2gran merged 49 commits into
opentripplanner:dev-2.xfrom
entur:serialize_page_token
Dec 14, 2023
Merged

Improve paging - avoid duplicates and missed itineraries when paging#5551
t2gran merged 49 commits into
opentripplanner:dev-2.xfrom
entur:serialize_page_token

Conversation

@t2gran

@t2gran t2gran commented Dec 6, 2023

Copy link
Copy Markdown
Member

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 <mail@leonard.io>
@leonardehrenfried

Copy link
Copy Markdown
Member

Can you resolve the conflicts?

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

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

Comment thread src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java Outdated
Comment thread src/main/java/org/opentripplanner/framework/text/CharacterEscapeFormatter.java Outdated
Comment thread src/main/java/org/opentripplanner/framework/token/Serializer.java
Comment thread src/main/java/org/opentripplanner/framework/token/Token.java Outdated
Comment thread src/main/java/org/opentripplanner/framework/token/Token.java Outdated
Comment thread src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java Outdated
Comment thread src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorInput.java Outdated
Co-authored-by: Johan Torin <jtorin@users.noreply.github.com>
@t2gran
t2gran requested a review from jtorin December 11, 2023 15:17

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

Second and last batch of review comments.

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

Comment thread src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java Outdated
Comment thread src/main/java/org/opentripplanner/service/paging/PagingService.java Outdated
Comment thread src/main/java/org/opentripplanner/service/paging/PagingService.java Outdated
Comment thread src/test/java/org/opentripplanner/_support/debug/TestDebug.java Outdated
Comment thread src/test/java/org/opentripplanner/_support/debug/TestDebug.java
Comment thread src/test/java/org/opentripplanner/framework/token/TokenTypeTest.java Outdated
Comment thread src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java Outdated
Comment thread src/test/java/org/opentripplanner/service/paging/PS1_LegacyMetaDataTest.java Outdated
t2gran and others added 5 commits December 12, 2023 14:43
The unit-test for CharacterEscapeFormatter is also improved.
Co-authored-by: Johan Torin <jtorin@users.noreply.github.com>
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
….java

Co-authored-by: Johan Torin <jtorin@users.noreply.github.com>
@t2gran
t2gran requested a review from jtorin December 12, 2023 16:39
@t2gran

t2gran commented Dec 12, 2023

Copy link
Copy Markdown
Member Author

@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

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

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 <mail@leonard.io>
@t2gran
t2gran merged commit e478e32 into opentripplanner:dev-2.x Dec 14, 2023
@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 Apply to issues describing a bug and PRs witch fixes it. Entur Test This is currently being tested at Entur !Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid duplicates when paging trip queries

3 participants