trails/openspec/changes/wahoo-route-push
Ullrich Schäfer a9c0093877
Add Wahoo push action route + OAuth callback resume
Adds /api/sync/push/:provider/:routeId as the user-triggered entry
point for pushing a route. The route action delegates to a new
pushes.server.ts pipeline that:

- resolves the latest route_versions row and uses that GPX (not
  routes.gpx) so the bytes Wahoo gets match the snapshot the user
  sees
- short-circuits on (user, route, version, provider) idempotency:
  a successful prior push returns the existing remote_id without
  re-calling Wahoo
- detects scope_missing before hitting Wahoo and redirects through
  getAuthUrl with a base64url-encoded state carrying pushAfter +
  returnTo
- refreshes tokens once on PushError({ code: "token_expired" }) and
  retries the push, then updates sync_connections in place
- records every outcome in sync_pushes (insert on first attempt,
  update on retry) so the UI can show success/failure state

The OAuth callback handler now decodes the state, resumes a
pushAfter pipeline server-side after exchangeCode, and handles the
?error=access_denied path with a needs_permission notice.

Also flips packages/fit/src/fitsdk.d.ts to a regular .ts side-effect
shim so journal's tsc picks up the @garmin/fitsdk module declaration
when consuming the workspace package via source.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 22:41:24 +02:00
..
specs Fix wahoo-route-push spec: correct schema path and id types 2026-04-30 22:03:28 +02:00
.openspec.yaml Propose wahoo-route-push: send planned routes to a user's Wahoo account 2026-04-29 08:38:14 +02:00
design.md Add @trails-cool/fit package with GPX→FIT Course encoder 2026-04-30 22:31:37 +02:00
proposal.md Add @trails-cool/fit package with GPX→FIT Course encoder 2026-04-30 22:31:37 +02:00
tasks.md Add Wahoo push action route + OAuth callback resume 2026-04-30 22:41:24 +02:00