Add an OTP2 GraphQL protocol field and point Puget Sound at it (#1780)#1799
Merged
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (17)
📝 WalkthroughWalkthroughOTP2 routing now uses an optional per-region GraphQL URL instead of a boolean flag. Database mappings, request target resolution, GraphQL endpoint construction, Apollo client caching, bundled region data, migration tests, and bicycle mode requests were updated. ChangesOTP2 GraphQL routing
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant RegionConfig
participant TripRequestBuilder
participant Otp2Planner
participant ApolloClient
RegionConfig->>TripRequestBuilder: provide otpBaseGraphqlUrl
TripRequestBuilder->>TripRequestBuilder: resolve OTP target and protocol
TripRequestBuilder->>Otp2Planner: pass OTP2 base URL
Otp2Planner->>Otp2Planner: append /gtfs/v1
Otp2Planner->>ApolloClient: create or reuse client for endpoint
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 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 |
…sAway#1780) OneBusAway#1794 selected OTP2 with a `usesOtp2GraphQl` boolean layered on the single `otpBaseUrl` — but the OBA regions directory doesn't publish that key, and a region's GraphQL endpoint is a different host than its OTP1 REST server (Puget Sound's REST server is otp.prod.sound.obaweb.org/otp/routers/default), so the two URLs can't share one field. The directory carries a dedicated `otpBaseGraphqlUrl` key instead — the mechanism for pointing a region at its OTP2 server on demand. Replace the boolean with an `otpBaseGraphqlUrl` field end to end (RegionDto → Room → Region): a non-blank value is both the explicit OTP2 signal and the OTP mount base. `TripRequestBuilder.usesOtp2`/`formattedOtpBaseUrl` derive from it, and `Otp2Planner` appends OTP2's fixed `/gtfs/v1` gtfs GraphQL mount to reach the endpoint — mirroring the OTP1 path appending `/plan`, and matching the custom-URL hint that already takes an `…/otp` base. Selection stays explicit, never sniffed. Point Puget Sound at its OTP2 GraphQL server in the bundled regions seed (otpBaseGraphqlUrl = …/prod/otp; the base serves the OTP root, base + /gtfs/v1 serves GraphQL — both verified live). Other bundled regions stay on OTP1. Fix the OTP2 bikeshare mode encoding: `Otp2PlanRequestBuilder` sent bare BICYCLE_RENTAL in the access/egress (Transit+Bike) and direct (Bikeshare) mode lists, which OTP2 rejects with a BadRequestError ("BIKE_RENTAL needs to be combined with WALK mode for the same leg"). Both lists now include WALK, verified against the live server. Device-verified end to end (Pixel 7 Pro, Puget Sound). Because OneBusAway#1794 is unreleased, this revises the v6 schema/migration in place (regions.uses_otp2_graphql → regions.otp_base_graphql_url) rather than shipping a dead column plus a churn migration; contributors on merged main clear app data. NOTE: the live regions directory must be repointed to match before this ships — it currently serves Puget Sound otpBaseGraphqlUrl = sound-transit-otp.ibi- transit.com/prod/, which 404s, and would break Puget Sound trip planning as soon as a device refreshes regions over the bundled seed.
bmander
force-pushed
the
feature/region-otp2-graphql-url
branch
from
July 12, 2026 02:49
ec0a79b to
ffba434
Compare
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
Follow-up to #1794. That PR added the OTP 2.x GraphQL trip-planning path but selected it with a
usesOtp2GraphQlboolean layered on the singleotpBaseUrl. The OBA regions directory doesn't publish that key, and a region's GraphQL host is different from its OTP1 REST host (Puget Sound's REST server isotp.prod.sound.obaweb.org/otp/routers/default/), so the two URLs can't share one field — no region could actually be flipped to OTP2 through the directory.This replaces the boolean with a dedicated
otpBaseGraphqlUrlregion field — the mechanism for pointing a region at its OTP2 server on demand, per the maintainer — and points Puget Sound at its OTP2 GraphQL server.What changed
otpBaseGraphqlUrlfield end to end:RegionDto(wire) → Roomregions.otp_base_graphql_url(v6 migration + exported schema) →Regiondomain → mappers/adapters. A non-blank value is both the explicit "use OTP2" signal and the OTP mount base — a nullable URL wherenull/blank means "OTP1 REST". No second boolean to keep in sync.TripRequestBuilderresolves the custom-URL-or-region target once (OtpTarget);Otp2Plannerappends OTP2's fixed gtfs GraphQL mount/gtfs/v1to the base — mirroring the OTP1 path appending/plan, and matching the custom-URL hint that already takes an…/otpbase. Selection stays explicit, never sniffed.otpBaseGraphqlUrl = …/prod/otp). Other bundled regions stay on OTP1 (guarded byRegionsDecodeTest).Otp2PlanRequestBuildersent bareBICYCLE_RENTALin the access/egress (Transit+Bike) and direct (Bikeshare) mode lists, which OTP2 rejects with aBadRequestError("BIKE_RENTAL needs to be combined with WALK mode for the same leg"). Both lists now includeWALK.regions.uses_otp2_graphql→regions.otp_base_graphql_url) rather than shipping a dead column plus a churn migration. Contributors on mergedmainclear app data once.Test plan
:onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true(+ unit/androidTest source sets) — clean under the strict CI gateOtp2GraphQlEndpointTest(base →/gtfs/v1append + trailing-slash edge),Otp2PlanRequestBuilderTest(WALK in bike mode lists),RegionsDecodeTest(Puget Sound OTP2, others OTP1),AppDatabaseMigrationTest(v5→v6 addsotp_base_graphql_url)…/prod/otp/gtfs/v1and returns itineraries, including a Transit+Bike trip (the bikeshare-mode fix), confirmed against the live OTP 2.x server via the request/response bodiesReal devices fetch the live regions directory and cache it over the bundled seed. The live directory currently serves Puget Sound
otpBaseGraphqlUrl = https://sound-transit-otp.ibi-transit.com/prod/, which 404s — with this client shipped, that stale value would activate OTP2 against a dead URL and break Puget Sound trip planning on the next region refresh. The live directory's Puget SoundotpBaseGraphqlUrlmust be updated to the intended OTP2 base (…/otp) before/when this ships.Closes #1780
🤖 Generated with Claude Code
Summary by CodeRabbit