Skip to content

syncengine: count any edit after the last sync as a change - #72

Merged
Omar-VF merged 1 commit into
Liquid-co:dev-publicfrom
ChakraFusion:pr/skew-tolerance
Oct 16, 2026
Merged

Omar-VF merged 1 commit into
Liquid-co:dev-publicfrom
ChakraFusion:pr/skew-tolerance

Conversation

@ChakraFusion

Copy link
Copy Markdown

As agreed on #57: the narrow version of option 1.

Without a recorded merge base, DetectConflict compares each side's latest mtime with the last-synced time. A 2 s clock-skew allowance was added to that time. Edits made on both devices within 2 s after a sync therefore read as neither side having changed, and one replaced the other with no conflict raised.

Now any edit after the last sync counts as a change:

  • Both sides changed: conflict, now including edits inside the old 2 s window. They are asked about instead of one silently replacing the other.
  • One side changed: no conflict, and that side wins as it does now.
  • Base recorded: unaffected. The content check runs first and doesn't look at clocks.

Why the allowance is dropped rather than moved before the sync. I tried that first, so that the 2 s before the stamp would count as a change too. It broke TestUntrackPropagatesAndRecovers and TestSwitch_TheSameGameUnderDifferentIDsSyncs (7 of 8 runs; 8 of 8 pass without it). A pulled file keeps the sender's mtime, which in a quick exchange is just before the stamp. The receiving device's untouched copy then counted as changed, so the sender's next edit became a conflict and nothing synced.

Tests:

  • TestDetectConflict: the old "within tolerance does not count" case becomes three cases:
    • both sides edited within 2 s after the sync → conflict;
    • one side edited within 2 s after it → no conflict;
    • a copy written just before the sync → no change.
  • TestMultiRootScenario_EditsRightAfterASyncStillConflict (e2e): stamps the two devices as synced, clears the location's base (as a lost report leaves it), and edits both sides at once.
    • Without the change: fails 3/3 with A="B-version" B="B-version".
    • With it: passes 4/4.

Trade-off: clocks are no longer given 2 s of slack. Suppose a device's clock is ahead and it holds an untouched file the other device wrote just before a sync. If the other device then edits before a base is recorded, that can be asked about as a conflict. This only applies while no base is recorded, and it is the "occasional extra prompt right after a sync" you said is the better failure.

Checks:

🤖 Generated with Claude Code

Without a merge base, DetectConflict compares each side's latest mtime
with the last-synced time. A 2 s clock-skew allowance was added to that
time, so edits made on both devices within 2 s after a sync read as
neither side having changed, and one replaced the other with no
conflict raised.

Any edit after the last sync now counts as a change. A conflict still
needs both sides changed; one side alone wins as before. With a base
recorded nothing changes.

The allowance is dropped rather than moved before the sync: a pulled
file keeps the sender's mtime, just before the stamp in a quick
exchange, and counting that copy as a change made the other device's
next edit a conflict (TestUntrackPropagatesAndRecovers and
TestSwitch_TheSameGameUnderDifferentIDsSyncs fail that way).

TestMultiRootScenario_EditsRightAfterASyncStillConflict stamps the two
devices as synced, clears the location's base and edits both sides at
once; it fails 3/3 without this (A="B-version" B="B-version").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@ChakraFusion is attempting to deploy a commit to the sivadaboi's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Omar-VF
Omar-VF merged commit bb8aedd into Liquid-co:dev-public Oct 16, 2026
10 of 11 checks passed
ChakraFusion pushed a commit to ChakraFusion/OpenSave that referenced this pull request Oct 16, 2026
Entries for Liquid-co#49, Liquid-co#70, Liquid-co#69, Liquid-co#72, Liquid-co#68 and Liquid-co#47, added at the end of the
Fixed list so they do not touch Liquid-co#75's own entry. Liquid-co#57 is test-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants