Fix arrival/return transfer legs + plan restore + router guards

Transfers (airport<->hotel) were the app's weakest surface; this fixes the
long-standing cluster of bugs in one pass:

- saneRoute(): reject OSRM results implausible for the straight-line distance
  (extract coverage holes once produced a 9h 'route' for a 5km taxi hop);
  applied at every routePts call site
- healTransfers() on load: re-sync transfer endpoints against current hotel +
  AIRPORTS table, re-sync stays[] against the day-base hotel objects (the
  saved stays[] carried pre-coord-fix locations, and dayBase() resolves the
  hotel FROM stays — every return leg was routed to the stale hotel), drop
  implausible or endpoint-drifted stored routes so they re-route cleanly,
  default a missing mode to car, and recover arrLandingMin from the booked
  flight time
- the last-stop->hotel ride is now a first-class editable leg (retLeg): the
  rail row opens the route card with drag + walk/taxi toggle, exactly like
  stop-to-stop legs; previously auto-routed returns seed it
- startMin now actually tracks landing + drop-off (syncArrivalStart had a
  null arrLandingMin guard that silently froze the day's start)
- applySavedPlan re-points day: days becomes a new object tree on restore,
  and the current-day reference stayed on the stale base-plan day — the rail
  rendered the base plan instead of the saved one until a day-tab click
- setDay enriches the opened day (idempotent), so a day opened from a saved
  plan gets its legs (incl. the return leg) routed instead of sitting on
  straight-line estimates

Also in this change set: correct LLM model name, keyword-router removal (chat
goes to the LLM), screenshot_map + relocate_stop tools for the UI LLM,
server-side plan store with localStorage migration, thinking toggle +
keep-alive warm-up, three-state LLM guard with proactive model load,
spatial /near /nearest /corridor SQL fixes, and the full data.js
coordinate correction for the Colombia demo.
This commit is contained in:
gmp
2026-09-10 22:46:07 -04:00
parent df5fed691b
commit 1ba39f7333
6 changed files with 533 additions and 120 deletions
+4 -1
View File
@@ -353,8 +353,11 @@ func filters(q map[string][]string) (string, []any) {
if n := first(q, "name"); n != "" {
conds = append(conds, "poi.name ILIKE "+param("%"+n+"%"))
}
// "WHERE 1=1" (not "") — the callers unconditionally append "AND …" to
// the where clause, so an empty string produced a SQL syntax error on
// /near, /nearest and /corridor with no kind/name/extract filters.
if len(conds) == 0 {
return "", args
return " WHERE 1=1", args
}
return " WHERE " + strings.Join(conds, " AND "), args
}