Skip to content

ADR 016: A per-trip points endpoint for the trip replay, for crew and public links too

  • Status: Accepted
  • Date: 2026-10-26
  • Deciders: Owner (plan docs/plans/trip_replay_skipper_menus_plan.md, agreed 2026-10-26)
  • Technical Context: apps/server (TripReplay, TripReplaysController, PublicTripsController#replay_points); behaviour in trip-replay.md; amends ADR 007 ("no map JSON endpoint now")

Context

The trip page draws the stored line of the trip: a simplified map line, the same for owner, crew and the public page. It has no time in it, so nobody but the owner (in the track editor, per track) could see where the boat was when, how fast it went and what the wind was. The owner wants a replay of the whole trip for everyone who can see it, including people with a public link, and replaced the fullscreen map button with it.

ADR 007 kept the trip page fast by storing simplified lines and decided against a separate map JSON endpoint for then. The replay needs points with time, speed and state, per trip, for viewers who may not edit.

Decision

  1. One endpoint per trip (/my/trips/:id/replay/points.json, and by token /t/<token>/replay/points.json) answers the kept points of all tracks in time order: time, position, SOG, engine, state, COG, pressure and the track's index. Allowed for every role that may view the trip (ADR 010 amendment) and for a working public link; the lookup goes through the access scope (ADR 015).
  2. A budget of 50 000 points per trip, the same as one track in the editor (one budget per map), thinned evenly from the tracks' files (ADR 017), only their kept parts. A normal week at one point every 5 s fits whole.
  3. No outside calls. The wind is the one stored with each track; the replay never asks Open-Meteo, so crew and public viewers cause no paid calls.
  4. Cached: ETag over the trip, its tracks and their wind; the public answer may be cached for 5 minutes. The public endpoint shares the public page's rate limit.
  5. Privacy: the public link already shows positions, times and the route; the replay adds speed and wind at each moment and positions to the minute. The owner decided this is what a replay is for; the privacy page says so.
  6. Considered and rejected: building the replay from the stored map lines (no time or speed in them); fetching wind for tracks without it when the replay opens (outside calls caused by visitors); a separate replay for the public page with fewer details (the owner wants the same replay).

Consequences

  • The fullscreen map (Fullscreen API with an overlay fallback) is gone; the map's corner button opens the replay.
  • The replay shares the track editor's histogram, instruments, boat and map wind (app/javascript/track_view/), so changes there show in both.
  • A trip that grows past the budget shows fewer points per hour in the replay; the map line on the trip page is unchanged.