skip to content

In a household app, when one partner deletes a shopping item while the other edits it offline, what should happen once the edit syncs?

level: seniorimportance: should knowfreq 44%

answer

  1. no record left to merge into
  2. the server must remember the delete
  3. decide by what the edit carries
  4. a stale delete is a stale write too
  5. tell the loser, never just vanish

basics

~20 s

Decide by what the edit carries: a small change to a deleted item, such as a tick, is dropped and the editor told; a substantive one restores the record or asks. A server tombstone makes the case recognisable.

solid answer

~50 s

Edit-versus-delete is the conflict per-field merge cannot settle, because one side removed the record the other side changed. The server first has to recognise it: if the delete left a **tombstone** carrying the record's id and last revision, an edit arriving with an older base is answered 'deleted', not 'not found'. Then the policy is per data type. For a shopping item, the delete usually wins: a tick or a quantity on something the household removed is not worth reviving, but the editor's phone should say so. For a note, an edit often holds work the user wants, so restore it with the edit, or keep it as a recoverable copy, and tell the partner who deleted it. The reverse order needs the same care: a delete queued offline against a revision a partner has since edited is a stale write, not an automatic winner.

go deeper

for a junior

Remember that a delete on one phone and an edit on the other contradict each other, and the server must remember the delete to notice.

for a middle

Explain the tombstone, the 'deleted' answer to a stale edit, and why a delete carries a base revision like any write.

for a senior

Set the policy per data type, delete wins, edit wins or recoverable, and design what each partner sees so nothing vanishes unexplained.

for a principal

Weigh recoverable deletes across the app: retention cost, privacy expectations of a real delete, and one consistent restore experience.

## Why per-field merge has nothing to say In a **shared household app**, two partners keep shopping lists, chore checklists and notes on their own phones and often work offline. Most clashes between their edits are about values: a quantity, a title, a tick, and a policy such as last-write-wins or per-field merge picks a result. **Edit-versus-delete** is different. Sam deletes "oat milk" from the list at home; Alex, offline, changes its quantity to 2. When Alex's edit arrives there is no record left to merge into. The two intents contradict each other: one says "this should not exist", the other says "this should exist, with a change". Whatever the app decides, one partner's action is undone, so the decision and the message about it are both part of the design. ## The server must remember the delete If the server removes the row outright, Alex's edit arrives for an id it has never heard of. Depending on the endpoint, the edit either fails as "not found", which the phone may misread as a bug, or, worse, an upsert recreates the item from a partial record. Neither is a decision. - A **tombstone** is a small marker kept after a delete: the record's id, the revision at which it was deleted, and who deleted it. - With it, the server can answer an edit with a stale base precisely: this record was deleted at revision 44, after the revision you edited. - How long tombstones are kept, and what a phone that has been away longer than that does, belongs to the incremental-pull design. For the conflict policy, the point is only that the delete is still known when the edit arrives. ## The options | Policy | Result | Fits | Risk | |---|---|---|---| | Delete wins | Edit discarded, item stays gone | Ticks and small changes to low-value items | The editor's work vanishes; tell them | | Edit wins | Item restored with the edit | Records where the edit is substantial | The deleter sees it come back; tell them | | Ask the user | Both intents shown, a person decides | Rare, high-value records | One more prompt to answer | | Recoverable delete | Delete wins, the record and the edit stay restorable for a while | Most user content | Storage and a cleanup rule | ## Choosing per data type in the household app - **Shopping item:** delete wins. A quantity on milk nobody wants any more is not worth a prompt. Alex's phone shows "Sam removed oat milk" with a restore action for a short time. - **Note:** an offline rewrite is often an hour of typing. Restore the note with the edit, or keep the edited version as a recoverable copy, and tell Sam why it is back. - **List title:** if the whole list is gone, a renamed title is not worth reviving the list for. ## The other order: a stale delete The same clash arrives the other way round when the delete is the queued, offline action: 1. Alex, offline, deletes "oat milk" from the copy at revision 4. 2. Sam, online, edits it; the item moves to revision 5. 3. Alex's delete arrives with base revision 4. 4. The server sees a stale base: Alex deleted a version Sam has since changed. 5. The server applies the same per-type rule: for a shopping item, the delete usually still wins, and Sam is told; for a note with a substantial edit, the delete waits for a decision or becomes recoverable. A delete without a base revision cannot be judged at all, which is why deletes carry one like any other write. ## What each phone shows - The phone whose action lost gets a short, specific message naming the item and the partner, not a generic sync error. - A restore action is offered while the record is still recoverable. - The losing row should not linger on screen as if it still existed; unwinding that optimistic copy is the optimistic-state design's job, while the message and the restore choice belong to the conflict policy. - If the record is restored, both phones show who brought it back and why, so the partner who deleted it does not simply delete it again without reading. - Nothing disappears or reappears without a reason the user can read.

  • How long must the server keep the tombstone?
    At least as long as a phone may stay away and still sync incrementally, so an edit that arrives within that window is answered 'deleted' rather than 'unknown'. Choosing that window, and what a phone does when it has been away longer, belongs to the incremental-pull design; the conflict policy only relies on the delete still being known when the edit arrives.
  • What should the editing partner's phone show when its edit loses to a delete?
    A specific message, such as 'Sam removed oat milk', with a restore action for a while, and the row gone from the list rather than lingering. A generic sync error or a silent disappearance makes users think the app lost their data, and they re-enter it, which recreates the item the partner deliberately removed.

  • Deleting the row outright is fine, because a later edit for it will simply fail.
  • A delete is the user's final word, so it should win every conflict.
  • Per-field merge settles edit-versus-delete like any other conflict.
  • A delete does not need to carry a base revision.
  • Restoring a deleted record needs no message to the partner who deleted it.