navi/frontend/src
malice 913cc46f2a
navi-offroute: tighten hybrid gates + fix hybrid render (#34)
PROBLEM 1 (latency): short in-town Auto routes (Twin Falls->Filer ~7 mi) took 60+
seconds because urban OSM-parking density exploded hybrid candidate evaluation.
Fixes in router.py:
- MIN_HYBRID_DISTANCE_KM 8.0 -> 24.0 (~15 mi): in-town trips never enter hybrid eval
  at all -- this alone eliminates the reported latency on Matt's routes.
- HYBRID_MAX_TRAILHEADS 20 -> 8: fewer candidates even on long trips.
- HYBRID_OVERALL_TIMEOUT_S = 6.0: a wall-clock check inside the candidate loop bails
  hybrid eval past 6 s (logger.warning) and keeps the single-mode / best-so-far winner.
- HYBRID_EARLY_ABORT_MIN = 30.0: once a candidate beats the single-mode winner by 30+
  min, stop probing the rest and ship it.
- Per-stage timing logs (logger.info) in _route_auto / _try_hybrid_auto:
  "single-mode probing took Xs", "hybrid candidate gathering: N candidates in Xs",
  "hybrid probing took Xs across N tested candidates".

PROBLEM 2 (hybrid render): investigated the missing network polyline. The stated
hypothesis (a hybrid drive leg using a non-"network" segment_type) is DISPROVEN --
_build_hybrid_response emits segment_type=="network" for BOTH the drive and offroad
legs (verified against the live response), the OFFROUTE_NETWORK_LAYER filter matches
it, MODE_COLORS is fully defined, and the store passes data.route correctly. The one
real fragility is the MapLibre color match: if network_mode is ever null the whole
layer can fail to paint (wilderness still draws via its static color -- matching the
exact symptom). Hardened it with ["to-string", ["get","network_mode"]] so a
missing/unknown mode falls through to the blue fallback and the layer always paints.
I could not reproduce the exact missing-leg render headlessly (all backend shapes +
frontend filters are correct), so a Chrome MCP repro is recommended to confirm #2 is
resolved; if a render issue remains it should be diagnosed in-browser.

Tests: hybrid synthetic-trip distances bumped 20 -> 30 km (past the new 24 km gate);
new test_hybrid_early_abort_stops_probing; surface-change integration savings lowered
into the 15-30 min band so both candidate sources are still probed (not early-aborted).
Full offroute suite: 84 passed. npm run build: clean.

PROBLEM 3 (off-road wilderness timeout) is out of scope -- separate follow-up; the
wilderness pathfinder is untouched here.

Co-authored-by: Matt <mj@k7zvx.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 17:29:17 -06:00
..
components navi-offroute: tighten hybrid gates + fix hybrid render (#34) 2026-05-26 17:29:17 -06:00
hooks feat(themes): consolidate UI CSS properties into theme registry 2026-05-01 16:17:26 +00:00
themes fix: apply theme overlay config to contour layers 2026-05-21 21:42:41 +00:00
utils Fix wiki/wikidata URL builders (Bugs 1-3 from 2026-05-24 handoff) (#28) 2026-05-26 00:04:57 -06:00
api.js Rename mode constants: mtb→2w, atv→4w (#20) 2026-05-25 15:33:47 -06:00
App.jsx feat: unified routing UI with wilderness + network segments 2026-05-08 19:03:44 +00:00
config.js navi: read auth login/logout URLs from /api/config (extraction #2 PR-C) 2026-05-22 09:09:24 -06:00
index.css feat: Add satellite imagery with Map/Satellite/Hybrid view modes 2026-05-02 02:01:56 +00:00
main.jsx feat(navi): config-driven tile source, defaults, and feature flags 2026-04-20 23:36:02 +00:00
store.js Rename mode constants: mtb→2w, atv→4w (#20) 2026-05-25 15:33:47 -06:00