Trip planning: migrate OTP1 request-building off the vendored POJOs#1787
Merged
Conversation
TripRequestBuilder/TripPlanRepository still built the outgoing OTP `/plan` request with the vendored, unpublished org.opentripplanner.api.ws.Request/ Message and routing.core.OptimizeType/TraverseMode types even after #1782 migrated the response side. Retargets request-building onto app-owned types (TripPlanRequest, OtpErrorId in api/contract/OtpPlanModels.kt) alongside the existing OtpResponseDto family, reusing the existing TripMode enum instead of TraverseMode. Also fixes a real bug found while doing this: the pre-1.0-OTP-server bike-rental URL rewrite in TripPlanRepository.requestPlan() has been dead since the bikeshare feature shipped in 2017 — nothing ever called the vendored Request.setBikeRental(true), since bikeshare mode has always been requested via the BICYCLE_RENT mode-string token instead. Now derives the flag from that token's presence in the built mode string, the one source of truth valid on both the direct UI-build path and the trip-plan-monitor's bundle-restore path. The opentripplanner-pojos dependency itself stays in build.gradle: bikeshare (BikeRentalStation) is still a live consumer, tracked separately in #1779. Tracking: #1778 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughTrip planning now uses app-owned request and error contracts. ChangesOTP trip planning migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TripRequestBuilder
participant TripPlanRepository
participant OtpWebService
participant OtpPlanParser
TripRequestBuilder->>TripPlanRepository: provide TripPlanRequest
TripPlanRepository->>OtpWebService: execute /plan request
OtpWebService-->>TripPlanRepository: return OTP response
TripPlanRepository->>OtpPlanParser: parse response
OtpPlanParser-->>TripPlanRepository: return parsed result or error
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6 tasks
This was referenced Jul 12, 2026
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
TripRequestBuilder/TripPlanRepositorystill built the outgoing OTP/planrequest with the vendored, unpublishededu.usf.cutr.opentripplanner.android:opentripplanner-pojos:1.0.0-SNAPSHOTjar (org.opentripplanner.api.ws.Request/Message,org.opentripplanner.routing.core.OptimizeType/TraverseMode) even after #1782 migrated the response side onto the app-ownedTripItinerarydomain model.TripPlanRequest(an OTP/planquery-parameter map) andOtpErrorId(the OTP wire error-id vocabulary) — placed inapi/contract/OtpPlanModels.ktalongside the existingOtpResponseDto/OtpErrorDtofamily, matching this codebase's existing layering.TripModeenum (already used for the response side) instead ofTraverseModefor building the OTPmodequery parameter.OptimizeTypeis gone entirely — replaced by the two literal wire values ("QUICK"/"TRANSFERS") it ever produced.Bug fix found along the way: the pre-1.0-OTP-server bike-rental URL rewrite in
TripPlanRepository.requestPlan()has been dead code since the bikeshare feature shipped in 2017 — nothing ever called the vendoredRequest.setBikeRental(true), since bikeshare mode has always been requested via theBICYCLE_RENTmode-string token instead (a completely separate mechanism). A user selecting bikeshare mode against a region running a pre-1.0 OTP server would send a mode string that server can't parse. Now derives the flag by checking for that token's presence in the builtmodequery string — the one source of truth valid on both the direct UI-build path and the trip-plan-monitor's bundle-restore path (initFromBundleSimplenever repopulatesmModeId).The
opentripplanner-pojosdependency itself stays inbuild.gradle: bikeshare (BikeRentalStation) is still a live consumer, tracked separately in #1779. Once that lands, the dependency can be removed entirely.Tracking: #1778
Test plan
./gradlew :onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true— clean./gradlew :onebusaway-android:testObaGoogleDebugUnitTest -PwarningsAsErrors=true— all pass, including newOtpErrorIdTest(pins the 18 transcribed wire error-ids against the vendored jar) andModeStringRequestsBikeRentalTest(pins the bike-rental-detection fix)lintObaGoogleDebug) not run locally per this repo's convention — left to CI🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests