fix: include parent station routes and agencies in stop references #1107
fix: include parent station routes and agencies in stop references #1107ARCoder181105 wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 7 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe stop handler now deduplicates route references across stop and parent-stop lookups before deriving agency references. The parent-station test seeds a parent-only route/trip and verifies the parent route and agency appear in the references block. ChangesStop reference population
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/restapi/stop_handler_test.go`:
- Around line 357-376: The current test only checks parent-only references and
does not cover the deduplication path in uniqueRouteIDs. Update the stop handler
test to seed the same route on both the child and parent stop fixtures, then
assert in model.Data.References.Routes that this shared route appears exactly
once. Use the existing stop handler test setup and route reference assertions as
the location to add the new fixture and count-based deduplication check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6189dd2b-59cb-4a3b-9269-e9e7dc3a0b6d
📒 Files selected for processing (2)
internal/restapi/stop_handler.gointernal/restapi/stop_handler_test.go
|



Description
Resolves #1095 by ensuring that when a requested stop is linked to a
parent_station, the parent station's routes and owning agencies are properly included in the API response'sreferencesblock.Changes Made
stop_handler.go): Updated the handler so that when parent station routes are retrieved, their full route objects and owning transit agencies are appended toreferences.Routesandreferences.Agencies(satisfying the OneBusAway spec contract).uniqueRouteIDstracking to prevent duplicate route entries inreferences.Routeswhen a route serves both the child stop and its parent station.stop_handler_test.go): UpdatedTestStopHandler_ParentStationwith a route assigned exclusively to a parent station to assert that it correctly appears inreferences.routesandreferences.agencies.Testing
40_1108.json).make testto confirm all test suites pass without regression.Summary by CodeRabbit