Pass through per-trip route_id, headsign, start_date, start_time instead of gating on active trip#466
Pass through per-trip route_id, headsign, start_date, start_time instead of gating on active trip#466KTibow wants to merge 2 commits into
Conversation
…ead of gating on active trip route_id, headsign, start_date, start_time, and schedule_relationship were only set for the active trip. getScheduleForTrip() already fetched TripDetailsBean containing this data for every trip — it was just never used. This change uses the per-trip data for all trips on the block. The old comment 'we only know route if we are on activeTrip, the block may interline!' was incorrect — each trip has its own route in the static GTFS schedule, and getTripDetailsForTrip() returns it.
📝 WalkthroughWalkthroughTripUpdatesForAgencyAction’s timepoint-driven update flow now fetches full trip details per trip, uses those details to populate TripDescriptor fields, and derives the stop-time schedule from the returned trip details while keeping delay assignment limited to the active trip. ChangesTrip Updates Timepoint Detail Fetch
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 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 |
|
Once again, not signing the CLA because it needs to be updated to use a custom gist instead of the SAP default |
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
`@onebusaway-api-webapp/src/main/java/org/onebusaway/api/actions/api/gtfs_realtime/TripUpdatesForAgencyAction.java`:
- Around line 179-183: The start_date and start_time values in
TripUpdatesForAgencyAction are still derived from tripStatus.getServiceDate(),
which can cause downstream trips to inherit the active trip’s service day.
Update the TripUpdatesForAgencyAction logic around tripDesc.setStartDate,
tripDesc.setStartTime, and the tripDetails.getStatus() check to use the per-trip
service date/status when available, and skip setting a synthetic midnight
start_time when per-trip status is missing.
🪄 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: e42e41fc-ee72-469f-9405-90d2e92a973a
📒 Files selected for processing (1)
onebusaway-api-webapp/src/main/java/org/onebusaway/api/actions/api/gtfs_realtime/TripUpdatesForAgencyAction.java
… is null The start_date and start_time fields were still derived from tripStatus.getServiceDate() (the active trip's service date). This caused downstream trips on the same block to inherit the active trip's service date, which was incorrect. Now using tripDetails.getServiceDate() for per-trip accuracy. Also skips setting a synthetic midnight start_time when tripDetails.getStatus() is null, instead of emitting a potentially misleading value.
route_id, headsign, start_date, start_time, and schedule_relationship were only set for the active trip. We already fetch TripDetailsBean containing this data for every trip — we just never use it. This change uses the per-trip data for all trips on the block.
The old comment "we only know route if we are on activeTrip, the block may interline!" was incorrect — each trip has its own route in the static GTFS schedule, and getTripDetailsForTrip() returns it.
Disclosure: Generated by DeepSeek V4 Pro with CI verification
Summary by CodeRabbit