fix: Uber the first mile when no station is walkable from the origin #6

Merged
madeddie merged 2 commits from fix-first-mile into main 2026-11-07 15:06:13 -05:00
Owner

Found while probing query times: several genuinely long trips returned zero itineraries instead of a slow one.

Cause

The planner could Uber the last mile - ride to the station nearest a destination with no service and drive from there - but the scan only ever started from stations within WALK.maxAccessM (1.5km) of the origin. If nothing was in range at the start, no station was ever ready to board and the search returned nothing at all. Affected: Breezy Point, much of Staten Island, most of Westchester off a Bee-Line route.

Fix

The scan now takes an access profile alongside the existing egress one: walk where a station is in range, otherwise Uber to one of the nearest stations per system (same per-system candidate rule as the last mile, so a subway station is not crowded out by closer bus stops), capped by MAX_FIRST_MILE_M = 20km so it does not offer a 40km ride to the nearest train. New firstMileUber option, on by default.

An itinerary can now have an Uber leg at each end, so:

  • cost sums every Uber leg rather than only the last one (server and client)
  • the summary card shows a leading Uber badge and names the station it takes you to
  • mid-trip "get off here and Uber" options keep the cost of the Uber that got you to the first station

Results

trip before after
Breezy Point -> Times Sq no result 94 min, ~$56
Breezy Point -> Co-op City no result 138 min
Ossining -> Wall St no result 101 min via Hudson Line

The benchmark cases, all of which start within walking distance of a stop, return identical itineraries.

Found while probing query times: several genuinely long trips returned **zero itineraries** instead of a slow one. ## Cause The planner could Uber the *last* mile - ride to the station nearest a destination with no service and drive from there - but the scan only ever started from stations within `WALK.maxAccessM` (1.5km) of the origin. If nothing was in range at the start, no station was ever ready to board and the search returned nothing at all. Affected: Breezy Point, much of Staten Island, most of Westchester off a Bee-Line route. ## Fix The scan now takes an **access** profile alongside the existing egress one: walk where a station is in range, otherwise Uber to one of the nearest stations per system (same per-system candidate rule as the last mile, so a subway station is not crowded out by closer bus stops), capped by `MAX_FIRST_MILE_M` = 20km so it does not offer a 40km ride to the nearest train. New `firstMileUber` option, on by default. An itinerary can now have an Uber leg at **each** end, so: - cost sums every Uber leg rather than only the last one (server and client) - the summary card shows a leading Uber badge and names the station it takes you to - mid-trip "get off here and Uber" options keep the cost of the Uber that got you to the first station ## Results | trip | before | after | |---|---|---| | Breezy Point -> Times Sq | no result | 94 min, ~$56 | | Breezy Point -> Co-op City | no result | 138 min | | Ossining -> Wall St | no result | 101 min via Hudson Line | The benchmark cases, all of which start within walking distance of a stop, return **identical itineraries**.
A trip starting more than WALK.maxAccessM (1.5km) from every stop
returned no itineraries at all: the planner could Uber the last mile to
a destination with no nearby service, but the scan only ever started
from stations within walking distance of the origin. Breezy Point,
much of Staten Island and most of Westchester off a Bee-Line route hit
this, and the user just saw an empty list.

The scan now takes an access profile alongside the egress one: walking
where a station is in range, otherwise an Uber to one of the nearest
stations per system (same candidate rule as the last mile, capped at
MAX_FIRST_MILE_M so it doesn't offer a 40km ride to a train). It is a
new 'firstMileUber' option, on by default.

An itinerary can now have an Uber leg at each end, so cost sums every
Uber leg rather than the last one, and the summary card shows a leading
Uber badge and names the station it takes you to.

Breezy Point -> Times Sq: no result -> 3 options from 94 min.
Ossining -> Wall St: no result -> 101 min via Hudson Line.
Trips that were already walkable return identical itineraries.
madeddie deleted branch fix-first-mile 2026-11-07 15:06:13 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
madeddie/ptt!6
No description provided.