Skip to content

Conversation

@vpaturet
Copy link
Contributor

@vpaturet vpaturet commented Oct 10, 2025

Summary

As detailed in #6948, there is a regression in the way invalid locations are handled in the plan query.
This PR fixes the regression.

  • Since Cleanup RouteRequest - make it immutable #6653 it is not possible anymore to build an invalid RouteRequest since validation is performed in RouteRequestBuilder (invalid requests throw RoutingValidationException).
    As a consequences some code branches end up with a null request that triggers an NPE.

  • This PR fixes the issue by building an empty TripPlan (without itineraries) in the case of an invalid route request.

Additional refactoring: introducing a builder for PlanResponse

Issue

Closes #6948

Unit tests

Added unit tests.

Documentation

No

Changelog

skip

@vpaturet vpaturet self-assigned this Oct 10, 2025
@vpaturet vpaturet added !Bug Apply to issues describing a bug and PRs witch fixes it. +Skip Changelog This is not a relevant change for a product owner since last release. labels Oct 10, 2025
@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 63.75000% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.25%. Comparing base (3281ab7) to head (fe4b0f9).
⚠️ Report is 104 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...nner/apis/transmodel/TransmodelGraphQLPlanner.java 0.00% 18 Missing ⚠️
...ipplanner/apis/transmodel/model/plan/TripType.java 53.84% 6 Missing ⚠️
...ripplanner/apis/transmodel/model/PlanResponse.java 93.93% 0 Missing and 2 partials ⚠️
...anner/routing/api/request/RouteRequestBuilder.java 0.00% 2 Missing ⚠️
...nner/routing/algorithm/mapping/TripPlanMapper.java 87.50% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6961      +/-   ##
=============================================
+ Coverage      72.18%   72.25%   +0.06%     
- Complexity     19839    19967     +128     
=============================================
  Files           2155     2163       +8     
  Lines          80051    80353     +302     
  Branches        8082     8113      +31     
=============================================
+ Hits           57785    58056     +271     
- Misses         19419    19438      +19     
- Partials        2847     2859      +12     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vpaturet vpaturet marked this pull request as ready for review October 10, 2025 07:00
@vpaturet vpaturet requested a review from a team as a code owner October 10, 2025 07:00
@vpaturet vpaturet marked this pull request as draft October 10, 2025 07:08
@vpaturet vpaturet force-pushed the fix_npe_in_trip_plan_query branch 3 times, most recently from 8815c32 to 0de51c3 Compare October 10, 2025 16:29
@vpaturet vpaturet force-pushed the fix_npe_in_trip_plan_query branch 4 times, most recently from b944032 to e3ee8e7 Compare October 21, 2025 13:35
@vpaturet vpaturet force-pushed the fix_npe_in_trip_plan_query branch from e3ee8e7 to 4ef5f1a Compare October 21, 2025 14:57
@vpaturet vpaturet marked this pull request as ready for review October 22, 2025 14:13
@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Oct 23, 2025
@optionsome optionsome requested a review from t2gran October 23, 2025 13:09
@vpaturet vpaturet removed the Entur Test This is currently being tested at Entur label Oct 24, 2025
@t2gran t2gran added the Entur Test This is currently being tested at Entur label Oct 24, 2025
@vpaturet vpaturet removed the Entur Test This is currently being tested at Entur label Oct 24, 2025
Copy link
Member

@t2gran t2gran left a comment

Choose a reason for hiding this comment

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

Thank you for this fix. The commits was easy to review by them self, and I only fond a small naming issue.

@vpaturet vpaturet force-pushed the fix_npe_in_trip_plan_query branch from 5ce7816 to fe4b0f9 Compare October 24, 2025 12:36
@vpaturet vpaturet requested a review from t2gran October 24, 2025 12:37
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. +Skip Changelog This is not a relevant change for a product owner since last release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled exception in TransModel API when querying to/from an invalid location

2 participants