trails/openspec/specs/route-splitting/spec.md
Ullrich Schäfer 47eb2615ec
Fix high-severity spec drift across 10 specs
- rate-limiting: correct BRouter limit to 300/hour (was 60); add Overpass
  rate-limit requirement (120/min per IP)
- security-hardening: BROUTER_AUTH_TOKEN lives in secrets.app.env, not infra.env
- account-management: email-change verification does not re-auth; existing
  session stays valid
- planner-journal-handoff: full rewrite — documents the actual JWT callback
  architecture (edit-in-planner → POST /api/sessions → callback endpoint),
  token claims, notes round-trip via GPX <metadata><desc>, session lifecycle
- route-drag-reshape: rewrite to describe permanent segment midpoint handles
  (not proximity hover ghost marker); click-to-insert + waypoint drag model
- route-splitting: rewrite to match midpoint handle model; notes geometric
  midpoint placement (not cursor-snapped)
- road-type-coloring: redirect to route-coloring (all requirements already
  covered there)
- osm-tile-overlays: mark profile-aware auto-enable as not yet implemented
  (profileOverlayDefaults exported but not wired)
- osm-poi-overlays: zoom threshold is 10 not 12; user override persistence
  marked as not yet implemented
- shared-packages: add all 7 missing packages (map-core, fit, api, db, jobs,
  sentry-config, correct map description); document map vs map-core boundary

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 11:07:03 +02:00

27 lines
1.6 KiB
Markdown

## Purpose
Splitting a route segment into two by inserting a waypoint at the segment midpoint via the midpoint handle. This is the same mechanism as route-drag-reshape — the distinction is user intent: reshape moves the new waypoint to reroute, while split leaves it in place as a named stop or day-break marker.
See `route-drag-reshape` for the midpoint handle interaction model.
## Requirements
### Requirement: Insert waypoint at segment midpoint
The Planner SHALL allow users to split a segment by clicking its midpoint handle, inserting a new waypoint at the geometric midpoint of the segment.
#### Scenario: Click midpoint handle to split
- **WHEN** a user clicks a midpoint handle on the route
- **THEN** a new waypoint is inserted at the geometric midpoint of that segment between the appropriate adjacent waypoints
- **AND** the route recomputes through the new waypoint
#### Scenario: Split syncs to other participants
- **WHEN** a user splits a segment
- **THEN** all other participants see the new waypoint appear in the waypoint list and on the map via Yjs sync
#### Scenario: Split waypoint can be named
- **WHEN** a waypoint is inserted by splitting
- **THEN** the user can click the waypoint to open its editor and assign a name, type (e.g. overnight), or note
## Note on ghost marker position
The inserted waypoint is placed at the **geometric midpoint** of the segment (midpoint index = `Math.floor((startIdx + endIdx) / 2)` of the BRouter coordinate array), not at the cursor position or the closest point on the polyline to the cursor. This is a deliberate simplification of the midpoint-handle model.