fix: send an arrival time in trip updates and leave out delays over 90 minutes #550
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.42) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 335 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #550"
general
weight: 0.35
aaronbrethorst
The trip updates feed from #540 gave its one stop_time_update a delay and nothing else. At a stop whose times stop_times.txt leaves blank, as many feeds do between timepoints, that is validator error E046, and a consumer has no scheduled time to add the delay to. A phone that kept an old start_date also got a delay measured in days, which a OneBusAway server would show riders as a vehicle days late.
The stop_time_update now carries arrival.time too: the stop's scheduled arrival plus the delay. I chose this over moving the update to the next timed stop because the server can't tell which stops were blank. go-gtfs fills blank times in while it parses and keeps only the timepoint column, which many feeds leave out, so every stop would look timed and E046 would stay.
The validator checks the GTFS time only for an update that has no time of its own. Java OneBusAway 2.7.2 prefers time over delay for that stop and still takes the vehicle's deviation from TripUpdate.delay, so its lateness and its predictions for the other stops don't change. The update stays on the stop the positions feed names.
When no timed stop follows the vehicle at all (even the last stop is blank), go-gtfs leaves those times at 0, so we were measuring against midnight. scheduleDeviation now treats a stop timed before the trip's first departure as having no time, and the vehicle is left out.
scheduleDeviation also returns nothing beyond 90 minutes early or late. 90 minutes is how late the rest of the server lets a run be (RIDER_SCHEDULE_LATE's default, runningLateGrace, passingLateGrace); past that the vehicle is on another run. The bound is there rather than only in the feed so the admin live card's lateness from #497 agrees with the feed. It also catches a stale start_date or a trip left running for days without changing how runDayStart picks the run.
The combined validator snapshot now gives the trip updates ids of their own (trip-update:bus-101). Its bus-101 drove T3, which runs at 01:00, so its delay was hours and the bound would drop it. TestWriteFeedSnapshots now adds a trip timed around when it runs, with ST2 left blank, and writes that GTFS as gtfs.zip for the validator. The workflow and development.md use it.
deployment.md section 11, ARCHITECTURE.md, openapi.yaml and the README describe the arrival time and the 90 minute limit.
Tested on main at 2bb258d1: go test ./... with Postgres 17, 3496 passed and 1 skipped (the snapshot test); the feed tests under -race; 25 of 25 mutants killed. The validator on fresh snapshots reports no errors, and with arrival.time removed the same run gives E046 at TB stop_sequence 2. The new tests fail on main.
Fixes #545