← Back to Pull requests

fix: check a rider against a trip's vehicle only when it is the only one #832

Open
unknown opened this pull request with 267 lines diff across 3 files
View on GitHub
unknown unknown commented on Dec 01, 2026 05:19 UTC
Author

A rider's points are checked against the agency's own position for their trip, and a ride the trusted position contradicts three times is ended, which scores -3 and blocks a new rider. For this server's own drivers, trustedSources.Lookup took that position from Tracker.VehicleOnTrip, the vehicle on the trip id that reported last. On a route run from frequencies.txt several vehicles run one trip id at once, so a rider aboard one was checked against whichever had reported last. In the test, two vehicles 880 m apart run T1 and the rider is on the one ahead: after three good points the ride was ended as contradicted and the rider blocked.

Lookup now gives a position only when exactly one vehicle reports the trip (Tracker.OnlyVehicleOnTrip). With two or more, nothing is checked, which leaves the rider's score as it was. Covers says what it said before: a trip any driver here reports is covered, however many vehicles run it, so no rider estimate is published beside them.

Left alone: a trusted external feed has the same shape, as it keeps one entity per trip id and service date. Fixing that means teaching TrustedFeed that a key is ambiguous, a bigger change to rider/trusted.go, which I can follow up with if you'd like.

Tests: the ride above now ends neither contradicted nor blocked, and the trip still counts as covered; it fails on main. OnlyVehicleOnTrip with one vehicle, two, one of them gone stale, and no trip id. The suite passes without the database tests, which nothing here touches, and the rider and tracker tests pass with -race.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

<!-- coderabbit-ai-generated:v1 -->

Summary by CodeRabbit

Bug Fixes
Improved handling of trips reported by multiple vehicles. A rider’s trip can remain covered without being incorrectly marked as contradicted, while a local driver position is used only when a single active vehicle reports the trip.
* Stale vehicle reports no longer count when determining whether a trip has a single reporting vehicle.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 267 lines (+200 / -67) across 3 files Reviewer: aaronbrethorst Review duration: 560m
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.39) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 267 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
42%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.334
Real PR Conversation Timeline
1 comments
"Review active on #832"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 43.0% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.4% (MEDIUM) · Higher = larger blast radius
39.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 43.0% · Lower = rushed or shallow review
43.0%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 22.5% · Safe to merge
22.5%