Sync: a remote-win field patch re-sends the loser's older fields at the winner's time, beating a third device's newer edit

Author: johannesjoCreated Oct 1, 2026Updated Oct 1, 2026

Follow-up to #10415 (second review, finding 1) and #10393. It depends on #10421. Related: #10260.

Problem

#10415 resolves an update-vs-update conflict as one 'patch' built from both sides.

  • The winner is chosen per side: synthesizeMergedChanges returns {...loser, ...winner}.
  • The patch is stamped with the max timestamp over all ops.

So when a device resolves a remote win, it re-sends its own older loser-only fields inside an opaque row that carries the winner's newer time. Those fields then beat a third device's newer edit of the same field.

Reproduction

This is pinned as current behavior in src/app/op-log/testing/integration/sync-fuzz/field-patch-timestamp.integration.spec.ts.

  1. A writes notes, then renames, offline.
  2. C writes newer notes, offline.
  3. B renames last and syncs.
  4. A syncs, then C syncs.
title notes
#10415 (all devices) B title A notes (older)
correct LWW B title C notes (newest)
master B title C notes, but A's notes edit is lost entirely (#10260)

Not a fix on its own: stamping with the loser's time

I tried stamping the patch with A's own time (the reviewer's suggestion, also restricted to loser-only fields). It breaks convergence:

  1. C's newer edit beats the opaque patch row.
  2. C then wins whole-entity with a pre-batch replace snapshot (#10421).
  3. A and B end with title 'task', both renames lost, and C keeps 'B title'.

Do not change the timestamp until #10421 lands.

Proposed direction (not decided)

  1. After #10421, a remote win re-sends the loser's fields readably, at the loser's own time. Options:
    • an existing action such as TaskSharedActions.updateTask;
    • a 'patch' with per-field timestamps derived on the reader. No new wire key, action type or schema bump is needed for the op itself.
  2. A readable op alone is not enough. When C resolves, its remote side would be {B title t4, A notes t2}, and the side-level merge would still let A's notes win at t4. So the merge also needs a per-field winner from each op's own timestamp (client-only logic).

Open risks:

  • Released clients still merge side-level.
  • On file-based providers, two resolvers both emit readable ops.
  • A resolver writing a user-action op strains "one user intent = one op".

Needs an E2E reproduction (three devices) first.

Source: super-productivity/super-productivity