Skip to content

Organised tours with pick-up points, and no more lost MCP edits - #11

Merged
Torgh merged 3 commits into
mainfrom
tours-and-safe-sync
Oct 18, 2026
Merged

Torgh merged 3 commits into
mainfrom
tours-and-safe-sync

Conversation

@Torgh

@Torgh Torgh commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two changes that came out of planning a real trip (Mexico, 22 days) with Claude through MCP.

1. Organised tours: pick-up point + places visited

  • An Activity / tour card's place is now labelled Place or pick-up point: where the tour picks you up or where you meet the guide. Travel times go there, like a rental's pick-up place.
  • New Places visited on the tour list in the editor (search to add, reorder, remove).
  • The map shows the stops as smaller pins in the day colour (3.1, 3.2, …), joined to the pick-up point by a dashed line. They don't affect the day's timing.
  • The card shows 🗺️ A → B → C; the printout shows Visits: … and labels the address Pick-up.
  • MCP: tour_stops on add_item / update_item (name + place_query or lat/lng, [] clears); get_trip prints tour visits: ….
  • Phone app: tour cards read Pick-up: and list the stops; 🧭 already navigates to the pick-up point.

2. The browser no longer overwrites changes made through MCP

Bug: sync uploaded the whole trip and the newer updatedAt won. When the board recomputed a route on a copy older than Claude's latest MCP edit, its upload silently dropped that edit. In practice cards, day start times and durations kept disappearing a few seconds after Claude added them.

Fix:

  • PUT /api/trips/:id?base=<updatedAt>: the server refuses with 409 (returning the stored trip) if the trip changed since the version the browser edited.
  • The browser keeps the last version both sides agreed on (bases in the store) and does a three-way merge (lib/merge.ts): each card, leg and day setting takes whichever side changed it; deletions apply unless the other side edited the card; moves and reorders from both sides combine; every card ends up in exactly one place. The browser wins only when both sides changed the same field.
  • The MCP server re-reads the trip before writing and starts over if it changed meanwhile.

Known limit: the version check and the write aren't one atomic operation in the store, so a very small window remains (about the latency of one Google Drive call).

Test plan

  • bun run build:mobile
  • bun run typecheck, eslint . --max-warnings 0, bun run test:coverage (192 tests, coverage gate passes), bun run build
  • New tests: lib/merge.test.ts (including the exact lost-update scenario), the conflict path in lib/sync.test.ts, tour_stops in mcp/server.test.ts
  • Live: a PUT with a stale base returns 409 and writes nothing
  • Live: tour stops written while the board was open survived the next browser syncs; tours show on the map and cards

🤖 Generated with Claude Code

Torgh and others added 3 commits October 18, 2026 19:09
An activity card's place is now where the tour picks you up or where you meet
the guide, so travel times go there. A new list holds the places the tour
visits: they show on the map as smaller pins joined by a dashed line, on the
card and in the printout, without changing the day's timing. MCP gets
tour_stops on add_item / update_item, and get_trip lists them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sync uploaded the whole trip and the newer updatedAt won. When the board
recomputed a route on a copy older than Claude's latest MCP edit, its upload
silently dropped that edit (cards, day start times, durations).

The browser now says which version it edited; the server refuses the upload
with 409 if the trip changed since and returns the stored copy. The browser
keeps the last version both sides agreed on and does a three-way merge: each
card, leg and day setting takes whichever side changed it, the browser wins
only when both changed the same field. The MCP server also re-reads the trip
before writing and starts over if it changed meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Activity cards with tour stops now read "Pick-up: <address>" and list the
places visited (🗺️ A → B → C). The 🧭 button already navigates to the card's
location, which is the pick-up point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Torgh
Torgh merged commit 8e84d12 into main Oct 18, 2026
2 checks passed
@Torgh
Torgh deleted the tours-and-safe-sync branch October 20, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant