trails/openspec/changes/archive/2026-03-26-planner-features/proposal.md
Ullrich Schäfer ba044610b7
Add route interactions: click-to-split, drag-to-reshape, colored route rendering
- Enrich BRouter response with per-point 3D coordinates and segment boundary
  tracking (EnrichedRoute interface)
- ColoredRoute component: plain, elevation gradient (green→yellow→red), and
  surface color modes with invisible wide polyline for click targeting
- Click-to-split: click on route polyline inserts waypoint at nearest point,
  mapped to correct segment via boundary indices
- MidpointHandles: draggable CircleMarkers at route segment midpoints for
  reshaping, hidden below zoom 12, opaque on hover
- Color mode toggle (select) synced via Yjs routeData
- i18n keys for color mode labels (en + de)
- Unit tests for segment boundary tracking (13 tests)
- E2E tests for enriched route response and color mode toggle

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:36:42 +01:00

40 lines
1.8 KiB
Markdown

## Why
The Planner's core editing works but is missing features from the architecture
doc: no-go areas for route avoidance, session notes for collaborative planning
communication, localStorage crash recovery for unsaved work, and rate limiting
to protect the BRouter API from abuse on the public instance.
## What Changes
- **No-go areas**: Draw polygons on the map that BRouter avoids when computing
routes. Stored as Y.Array in the Yjs doc, synced across participants.
- **Session notes**: Shared text area (Y.Text) for participants to leave notes,
discuss the route, or plan logistics. Visible in the sidebar.
- **Crash recovery**: Periodically save Yjs state to localStorage. On
reconnect, merge local state with server state to recover unsaved changes.
- **Rate limiting**: Limit session creation per IP and BRouter API calls per
session to prevent abuse on the public instance.
## Capabilities
### New Capabilities
- `no-go-areas`: Draw avoidance polygons on the Planner map, passed to BRouter as routing constraints
- `session-notes`: Shared collaborative text in Planner sessions via Yjs Y.Text
- `crash-recovery`: localStorage backup of Yjs state for reconnection after browser crash
- `rate-limiting`: IP-based limits on session creation and route computation
### Modified Capabilities
- `planner-session`: Session data model gains noGoAreas and notes fields
- `brouter-integration`: Routing requests include no-go area polygons
- `map-display`: Map gains polygon drawing tools for no-go areas
## Impact
- **Planner Yjs doc**: New fields (noGoAreas: Y.Array, notes: Y.Text)
- **BRouter API**: No-go areas passed as `nogo` parameter
- **Map**: Leaflet.draw or custom polygon tool for no-go areas
- **Dependencies**: May need `leaflet-draw` for polygon editing
- **Server**: Rate limiting middleware (in-memory store)