Route editor: clicking the next point while a leg is still routing appends legs out of order (straight jumps, inflated distance) #68

Closed
opened 2026-11-05 19:19:00 +00:00 by maximus · 1 comment
Member

Found in the live acceptance test of deploy-676a7c62 (2026-11-05), user claude_test. This is probably not new in this deploy: the append path (appendAnchor → calculateRouteBetween → insertIntoRoute(…, undefined, …)) is unchanged by the batch. It does make #45 "Optimise order" report wrong before/after numbers when it happens.

Problem: if you click the next route point while the previous leg is still being routed (Valhalla /route + /height), the legs are appended in the order the responses arrive, not in the order you clicked. The track then contains straight "jump" lines between unrelated legs. Distance, D+/D− and the profile include those jumps.

Repro (append mode, Valhalla, Sospel at zoom 13):

  1. Open /trail/edit/new and switch the toggle to "Appending to end of route".
  2. Click 8 points in a ring about 1.2 km around Sospel, about 120 ms apart, ending next to the start.
  3. Expected: about 19.6 km. Each Valhalla leg was captured; they add up to 19.57 km and every leg starts exactly where the previous one ends (gap 0 m).
  4. Actual: 29.57 km, D+ 1508 m instead of 1048 m. Long straight coloured lines cross the map, and the profile shows multi-km linear ramps. "Route Point #2" shows 4.88 km for a leg Valhalla returned as 2.37 km.

With a full wait after each click (routing done), the same 8 clicks give 19.57 km every time. This also happened once with about 1.2 s between clicks while the cluster was loaded (24.52 km), so a normal click pace can hit it when routing is slow.

Evidence: /root/tools/wanderer-shots/acceptance/out/bug-race-fast-clicks-loop.png (29.57 km, straight jumps) and /root/tools/wanderer-shots/acceptance/out/t2d-loop-before-optimise.png (the 24.52 km case). Legs: /root/tools/wanderer-shots/acceptance/out/debug_loop_legs.json. Script: FAST=1 GAP=120 node /root/tools/wanderer-shots/acceptance/debug_loop.mjs.

Fix idea: serialise route edits. Queue each click's routing behind the previous one, or insert each leg at its anchor's index (not "append at the end") once its response arrives. Add a test with two calculateRouteBetween promises that resolve out of order.

🤖 Generated with Claude Code

Found in the live acceptance test of `deploy-676a7c62` (2026-11-05), user `claude_test`. This is probably not new in this deploy: the append path (`appendAnchor` → `calculateRouteBetween` → `insertIntoRoute(…, undefined, …)`) is unchanged by the batch. It does make #45 "Optimise order" report wrong before/after numbers when it happens. **Problem:** if you click the next route point while the previous leg is still being routed (Valhalla `/route` + `/height`), the legs are appended **in the order the responses arrive**, not in the order you clicked. The track then contains straight "jump" lines between unrelated legs. Distance, D+/D− and the profile include those jumps. **Repro (append mode, Valhalla, Sospel at zoom 13):** 1. Open `/trail/edit/new` and switch the toggle to "Appending to end of route". 2. Click 8 points in a ring about 1.2 km around Sospel, about 120 ms apart, ending next to the start. 3. **Expected:** about 19.6 km. Each Valhalla leg was captured; they add up to 19.57 km and every leg starts exactly where the previous one ends (gap 0 m). 4. **Actual:** **29.57 km**, D+ 1508 m instead of 1048 m. Long straight coloured lines cross the map, and the profile shows multi-km linear ramps. "Route Point #2" shows 4.88 km for a leg Valhalla returned as 2.37 km. With a full wait after each click (routing done), the same 8 clicks give 19.57 km every time. This also happened once with about 1.2 s between clicks while the cluster was loaded (24.52 km), so a normal click pace can hit it when routing is slow. **Evidence:** `/root/tools/wanderer-shots/acceptance/out/bug-race-fast-clicks-loop.png` (29.57 km, straight jumps) and `/root/tools/wanderer-shots/acceptance/out/t2d-loop-before-optimise.png` (the 24.52 km case). Legs: `/root/tools/wanderer-shots/acceptance/out/debug_loop_legs.json`. Script: `FAST=1 GAP=120 node /root/tools/wanderer-shots/acceptance/debug_loop.mjs`. **Fix idea:** serialise route edits. Queue each click's routing behind the previous one, or insert each leg at its anchor's index (not "append at the end") once its response arrives. Add a test with two `calculateRouteBetween` promises that resolve out of order. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Member

Fixed in batch PR #72 (deploy 5577c715), live since 2026-11-05 ~22:10 CET in wanderer-web:deploy-5577c715 (homelab-flux #857). Verified with the live e2e suite and acceptance re-runs as claude_test.

🤖 Generated with Claude Code

Fixed in batch PR #72 (`deploy` 5577c715), live since 2026-11-05 ~22:10 CET in `wanderer-web:deploy-5577c715` (homelab-flux #857). Verified with the live e2e suite and acceptance re-runs as `claude_test`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
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
public/wanderer#68
No description provided.