fix(navi): vehicle skips off-network gate; boundary chips show for non-Drive

Vehicle is pure Valhalla road routing — Valhalla snaps endpoints to the nearest
road automatically, so the off-network classifier (OFF_NETWORK_THRESHOLD_M) is
irrelevant for it. Add an early branch in route() that sends vehicle straight to
_route_D_network_only, instead of bandaiding the threshold. Foot/MTB/ATV keep the
gate so users can intentionally pin backcountry points; Auto inherits the skip via
its recursive mode=vehicle probe. Threshold stays at 10.

Frontend: boundary-mode chips now show for all modes except Drive (vehicle).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt 2026-05-24 16:34:03 +00:00
commit 10960ca886
2 changed files with 14 additions and 2 deletions

View file

@ -543,6 +543,17 @@ class OffrouteRouter:
if mode not in MODE_TO_COSTING: if mode not in MODE_TO_COSTING:
return {"status": "error", "message": f"Unknown mode: {mode}"} return {"status": "error", "message": f"Unknown mode: {mode}"}
# Vehicle is pure Valhalla road routing: Valhalla snaps endpoints to the
# nearest road automatically, so the off-network classifier is irrelevant
# (and a tight threshold would wrongly push normal road routes into
# wilderness pathfinding). Foot/MTB/ATV still use the threshold gate so
# users can intentionally pin backcountry points. Auto inherits this via
# its recursive self.route(..., mode="vehicle", ...) probe.
if mode == "vehicle":
return self._route_D_network_only(
start_lat, start_lon, end_lat, end_lon, mode
)
# Detect network status for both endpoints # Detect network status for both endpoints
start_status = self._locate_on_network(start_lat, start_lon, mode) start_status = self._locate_on_network(start_lat, start_lon, mode)
end_status = self._locate_on_network(end_lat, end_lon, mode) end_status = self._locate_on_network(end_lat, end_lon, mode)

View file

@ -325,8 +325,9 @@ export default function DirectionsPanel({ onClose }) {
</div> </div>
)} )}
{/* Boundary mode selector (only for non-auto modes) */} {/* Boundary mode selector hidden only for Drive (vehicle), which is pure
{routeMode !== "auto" && ( Valhalla road routing; Auto/Foot/MTB/ATV may traverse wilderness. */}
{routeMode !== "vehicle" && (
<div className="flex gap-1"> <div className="flex gap-1">
{BOUNDARY_MODES.map((m) => { {BOUNDARY_MODES.map((m) => {
const active = boundaryMode === m.id const active = boundaryMode === m.id