Last-write-wins sync or manual JSON reconciliation for Hoppscotch offline edits
0 reputation · 05 Jan 2021, 05:02 UTC
0 reputation · 05 Jan 2021, 05:02 UTC
Synchronize Hoppscotch collections and environments when offline edits on one client meet concurrent remote changes, without silently discarding one side's updates.
Current behavior resolves conflicts with last-write-wins based on updatedAt and overwrites the entire document. The CLI offers pull --force but no merge flag, and the UI has no merge button. A Yjs or Automerge field-level merge has been proposed but not accepted for v2024.x.
Teams must decide whether to accept whole-document overwrites for non-overlapping edits or require manual export/import reconciliation before sync. Version parity between client and self-hosted server may also affect which strategy is safe.
In v2024.x, Hoppscotch resolves sync conflicts with last-write-wins based on the updatedAt field, overwriting the entire collection or environment document. This is a whole-document replacement, not a field-level merge.
When two clients modify different fields in the same collection or environment, the client with the newer updatedAt timestamp wins. The losing client's changes are discarded entirely, even if those changes affect unrelated fields. This is a known limitation of the current sync design.
No, if your team requires preservation of all edits across different fields. Even non-overlapping changes will be lost when sync occurs. If any field-level change must survive, last-write-wins is not safe.
updatedAt value if visible.Enforcing client-server parity is only relevant if the sync endpoint validates schema versions and rejects mismatched payloads. Check your self-hosted server's API responses for version headers or error codes. Parity alone does not prevent last-write-wins overwrites; it only guards against potential field drops during deserialization.
Field-level merging via Yjs or Automerge has been proposed but not accepted for v2024.x. Until a merge flag or CRDT milestone is released, treat field-level merging as unsupported. Do not rely on unverified CRDT integration in production workflows.
updatedAt is unreliable if client clocks are unsynchronized.Use comments to ask for clarification. Post a solution as an answer.
6,640 reputation · 05 Jan 2021, 05:30 UTC
One clarification for manual reconciliation: updatedAt is generally client-generated, so clock skew between offline clients can already decide the winner before any field-level merge. After you push --force a reconciled document, the server stamps a new updatedAt, which can silently overwrite edits made by other clients while you were merging. On self-hosted instances, confirm client and server are pinned to the same minor release before syncing; schema drift—for example, added auth.type enum values or a required protocolVersion between 2024.2.x and 2024.3.x—may cause the UI to reject or mangle an otherwise valid JSON import. Verify available flags with hoppscotch pull --help on your exact CLI build, since merge options may not exist in v2024.x.