Repository navigation
Build trip stop references with the shared builder - #1797
aaronbrethorst wants to merge 1 commit into
Conversation
stopReferences existed so one stop could be listed under several IDs, one per agency that referred to it, with its own route lookup and its own parent-station pass. Each stop now has one ID, so trips-for-route, trips-for-location and stops-for-location's parent stations collect raw stop IDs and build references with BuildStopReferencesAndRouteIDsForStops, like every other handler. Route references come from each stop's routeIds through rawRouteIDsOfStops. stopReferences, appendResolvedParents, routeIDsForStops and appendUniqueStopID go, and stopsReferencedBySchedulesAndStatuses no longer queries the database: it only collects IDs. The stopReferences tests become a test of the shared builder; the one comparing its direction and code with buildStopModel has nothing left to compare.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
@aaronbrethorst, the PR description does not follow the PR template:
Keep this PR as Draft until these are fixed. This comment updates when the description changes. |
|
Performance Smoke Test ResultsStatus: PASSED
Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%. Full results uploaded as workflow artifact: k6-smoke-summary. |
|
Closing as superseded. The multi-feed static GTFS spec (#1811, |



Stacked on #1796. Part of the stop consolidation work (#1771–#1779). No issue filed yet.
What it does
trips-for-route,trips-for-location, and the parent stations instops-for-locationnow build stop references withBuildStopReferencesAndRouteIDsForStops, like every other handler. This is a refactor with no intended response change, and it removes 214 lines net.Root cause
stopReferencesexisted so one stop could be listed under several IDs, one per agency that referred to it. It had its own route lookup (routeIDsForStops) and its own parent-station pass (appendResolvedParents). After #1794 and #1796, each stop has exactly one ID, so that second builder only duplicates the shared one.Changes:
routeIds, through one helper,rawRouteIDsOfStops.stopsReferencedBySchedulesAndStatusesis nowstopIDsReferencedBySchedulesAndStatuses. It only collects IDs and no longer queries the database.stopReferences,appendResolvedParents,routeIDsForStops,appendUniqueStopID, and theStopIDMap/StopIDsByBareIDparameters.Testing
mainbefore this change: n/a (refactor). The behavior tests from Name a trip's stops by their own agency #1794 and Prefix location results with each stop's agency #1796 (TestTripStopIDs_UseTheStopsOwnAgency,TestTripsForRouteHandler_CrossAgencyInterlinedBlock,TestLocationStopIDs_UseTheStopsOwnAgency) and the existing trips-for-route, trips-for-location and stops-for-location suites pass unchanged.TestStopReferencesis nowTestBuildStopReferencesAndRouteIDsForStops_RoutelessStop. It checks a stop with no routes against the shared builder: empty non-nullrouteIds,""direction, and a resolved parent.TestStopReferences_DirectionAndCodeMatchBuildStopModelis deleted. References are now built bybuildStopModelitself, so there's nothing left to compare.collectStopIDsFromScheduletests now expect a set of raw IDs.Checklist
mainand passes on this branch.gtfsdb/(db.go,models.go,query.sql.go) ortestdata/openapi.yml(synced from upstream).r.Context()to DB/service calls, notcontext.Background().testdata/openapi.yml, has an issue open on OneBusAway/sdk-config, or is outside the SDK and the description says why.Notes for reviewers
routeIds. Route IDs within each referenced stop now follow the shared builder's natural sort by route name. Before, they came in query order.trips-for-routelogs it and returns emptyreferences.stops, asstopReferencesdid on its route-lookup failure.trips-for-locationreturns a 500, as its reference builder already did for other failures.