Add NO_DIRECT_MODE_CONNECTION routing error code for direct-only searches#7494
Open
vpaturet wants to merge 2 commits intoopentripplanner:dev-2.xfrom
Open
Add NO_DIRECT_MODE_CONNECTION routing error code for direct-only searches#7494vpaturet wants to merge 2 commits intoopentripplanner:dev-2.xfrom
vpaturet wants to merge 2 commits intoopentripplanner:dev-2.xfrom
Conversation
62848e1 to
934887b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7494 +/- ##
==========================================
Coverage 71.02% 71.02%
- Complexity 20995 21009 +14
==========================================
Files 2348 2352 +4
Lines 87252 87280 +28
Branches 8640 8638 -2
==========================================
+ Hits 61968 61994 +26
- Misses 22291 22298 +7
+ Partials 2993 2988 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ches When a direct-only search (no transit modes requested) returns no itineraries, attach a new NO_DIRECT_MODE_CONNECTION error code so clients can distinguish "no direct route found" from "something went wrong." This eliminates ~97% of the "routing result is empty but there is no errors" warnings in production, which are caused by clients fanning out parallel direct-mode requests (flex, foot, bicycle, car, etc.) alongside transit queries.
934887b to
c23e7c5
Compare
Contributor
Author
|
Moving temporarily to draft, it seems the error message mapping is incorrect. |
Contributor
Author
|
Added a dedicated error message for no direct mode conection |
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
Add a new
NO_DIRECT_MODE_CONNECTIONrouting error code returned when a direct-only search(no transit modes requested) yields no itineraries. This gives API consumers a clear reason
code for empty results and eliminates ~97% of the "routing result is empty but there is no
errors" warnings in production.
Issue
Production logs show ~876 "empty routing result" warnings per minute (87.6% of all warnings).
96.7% are direct-only searches
(
transportModes: []) — clients fan outparallel direct-mode requests (flex, foot, bicycle, car, bike_rental, scooter_rental) alongside
transit queries. When a direct mode can't find a route, the result is empty with no error code.
The root cause: direct routing methods (
routeDirectStreet,routeDirectFlex,routeDirectCarpooling) returnRoutingResult.ok(List.of())when they find nothing — no erroris ever attached. The
RoutingErrorsAttacheronly handles transit-related errors. For direct-onlysearches, transit is disabled, so no error codes apply.
Example query:
returns currently:
and with the fix:
How it works
A new
checkForEmptyDirectModeResult()method inRoutingWorkerchecks after the filter chainwhether:
!request.journey().transit().enabled())OUTSIDE_BOUNDS)If all three are true, the new
NO_DIRECT_MODE_CONNECTIONerror is attached. This naturallysilences the warning in
DefaultRoutingService.logResponse()sincegetRoutingErrors()is nolonger empty.
The error code is exposed in both the TransModel (
noDirectModeConnection) and GTFS(
NO_DIRECT_MODE_CONNECTION) GraphQL schemas.Unit tests
EnumTypesTest#assertAllRoutingErrorCodesAreMappedvalidates the new code is mappedGraphQLUtilsTestvalidates the GTFS enum mappingTransmodelGraphQLSchemaTest#testSchemaBuildvalidates schema integrityDocumentation