Code RoomOffline sync with conflicts
HardPrep Room Coding #4273

Offline sync with conflicts

Vibe & agenticAlgorithms & data structuresSenior–Staff~30 min

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?

Implement
apply_sync_ops(server_version: int, ops: list[str]) → list[str]
Examples
in[7,["a1:7:edit","a2:8:edit"]]out["applied","applied"]
in[7,["a1:7:edit","a1:7:edit"]]out["applied","duplicate"]
in[5,["b1:3:edit"]]out["conflict"]
What a strong answer looks like

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.

0:00 of about 30 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.