trails/apps/planner/app/lib
Ullrich Schäfer e34a06ff5a
fix(planner): raise WS frame cap above doc cap (fixes sync reconnect loop)
The Yjs sync WebSocket had MAX_MESSAGE_BYTES = 256 KB (per frame) but
MAX_DOC_BYTES = 5 MB (per session doc). A full-state sync frame carries
the entire doc, so any session doc between 256 KB and 5 MB was allowed to
exist yet could never sync: the client's sync frame tripped the 256 KB
per-frame cap, the server closed it (1008), the client reconnected, resent
the same oversized frame, and looped forever — the UI froze, the connection
flapped Verbunden/Verbinde, and the network tab filled with 101 reconnects.

Real routes hit this fast because the BRouter geometry is stored in the doc:
a 4-waypoint, 77 km cycling route was already 305 KB.

Fix: the per-frame cap must be >= the doc cap (a full-doc sync must fit in
one frame). Set MAX_MESSAGE_BYTES = MAX_DOC_BYTES + 256 KB overhead; the
5 MB doc cap stays the real size/abuse guard. Updated the test that had
codified the inverted ordering.

Verified: planner typecheck + lint clean, yjs-server 9/9, planner suite
183/183.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 08:58:24 +02:00
..
__screenshots__/elevation-chart-draw.browser.test.tsx chore: update visual snapshots [skip ci] 2026-05-10 17:15:46 +00:00
brouter.test.ts fix(planner/brouter): cap upstream response size to 10MB 2026-05-26 00:48:45 +02:00
brouter.ts fix: extensionless server-side imports + lint rule to catch them 2026-05-26 08:08:19 +02:00
crash-recovery.test.ts Add transactional emails (SMTP) and planner features (no-go areas, notes, crash recovery) 2026-03-26 01:00:42 +01:00
db.ts Add Drizzle ORM with shared db package (#10) 2026-03-22 22:35:50 +00:00
elevation-chart-draw.browser.test.tsx Fix Vitest browser provider setup and test cleanup 2026-05-10 19:01:24 +02:00
elevation-chart-draw.ts Split ElevationChart + PlannerMap into deep modules; add visual regression testing 2026-05-10 16:41:23 +02:00
gpx-export.test.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
gpx-export.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
host-election.test.ts Fix planner production server + use .ts extensions everywhere 2026-03-25 01:41:33 +01:00
host-election.ts Fix waypoint drag, host election, segment routing, debug panel 2026-03-23 08:52:52 +01:00
http.server.test.ts fix(planner/brouter): add 30s timeout to outbound fetch 2026-05-25 23:53:19 +02:00
http.server.ts fix(planner/brouter): add 30s timeout to outbound fetch 2026-05-25 23:53:19 +02:00
logger.server.test.ts feat(planner): per-request requestId propagated through logs 2026-05-25 22:43:58 +02:00
logger.server.ts feat(planner): per-request requestId propagated through logs 2026-05-25 22:43:58 +02:00
metrics.server.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
overnight.test.ts Add per-day map coloring and remaining unit tests 2026-04-11 00:12:27 +02:00
overnight.ts Add multi-day data model, computeDays, and GPX roundtrip 2026-04-10 23:51:31 +02:00
poi-cache.test.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
poi-cache.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
poi-categories.test.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
poi-snap.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
pois.test.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
pois.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
rate-limit.test.ts Fix planner production server + use .ts extensions everywhere 2026-03-25 01:41:33 +01:00
rate-limit.ts Increase route rate limit from 60 to 300 requests/hour 2026-04-11 02:05:41 +02:00
require-session.test.ts Session-bind /api/route and /api/overpass 2026-04-21 22:18:45 +02:00
require-session.ts Session-bind /api/route and /api/overpass 2026-04-21 22:18:45 +02:00
route-data.test.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
route-data.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
route-merge.test.ts Cache BRouter segments client-side, fetch only the diff 2026-04-24 17:57:54 +02:00
route-merge.ts Cache BRouter segments client-side, fetch only the diff 2026-04-24 17:57:54 +02:00
segment-cache.test.ts Cache BRouter segments client-side, fetch only the diff 2026-04-24 17:57:54 +02:00
segment-cache.ts Cache BRouter segments client-side, fetch only the diff 2026-04-24 17:57:54 +02:00
sessions.ts fix(planner): bound /api/sessions listing (default 50, max 200) 2026-05-26 00:46:38 +02:00
snap-to-poi.test.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
url-validation.server.test.ts security: validate Planner callback URL to close an SSRF sink 2026-06-10 22:18:18 +02:00
url-validation.server.ts security: validate Planner callback URL to close an SSRF sink 2026-06-10 22:18:18 +02:00
use-days.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-elevation-data.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-gpx-drop.ts Centralize waypoint Yjs serialization in waypointFromYMap/waypointToYMap 2026-05-18 21:02:27 +02:00
use-host-election.ts Deepen three architectural seams: FIT consolidation, host election extraction, injectable db 2026-05-10 15:52:31 +02:00
use-nearby-pois.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
use-pois.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
use-profile-defaults.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-routing.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-undo.test.ts Add undo/redo to planner 2026-04-04 10:04:01 +01:00
use-undo.ts Add undo/redo to planner 2026-04-04 10:04:01 +01:00
use-waypoint-manager.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-yjs-poi-sync.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
use-yjs.ts chore(ts): drop two more redundant casts 2026-05-26 01:02:49 +02:00
vite-yjs-plugin.ts Fix waypoint drag, host election, segment routing, debug panel 2026-03-23 08:52:52 +01:00
waypoint-ymap.test.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
waypoint-ymap.ts planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
yjs-server.test.ts fix(planner): raise WS frame cap above doc cap (fixes sync reconnect loop) 2026-07-14 08:58:24 +02:00
yjs-server.ts fix(planner): raise WS frame cap above doc cap (fixes sync reconnect loop) 2026-07-14 08:58:24 +02:00