Offline sync with conflicts
You're building an offline-first sync feature with an AI agent: a TypeScript client (IndexedDB) queues edits while offline and syncs to a server API on reconnect, for a notes app where the same note can be edited on two devices. Lay out the build plan: how you model edits and detect conflicts, the conflict-resolution strategy, the sync protocol, and acceptance criteria. What does a careless 'sync the local changes to the server' prompt fundamentally miss?
apply_sync_ops(server_version: int, ops: list[str]) → list[str][7,["a1:7:edit","a2:8:edit"]]out["applied","applied"][7,["a1:7:edit","a1:7:edit"]]out["applied","duplicate"][5,["b1:3:edit"]]out["conflict"]Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.