Skip to content

Desktop: Fixes #16167: Fix conflict created when syncing a just-published note - #16182

Open
personalizedrefrigerator wants to merge 11 commits into
laurent22:devfrom
personalizedrefrigerator:pr/desktop/fix-conflict-on-publish-only
Open

Desktop: Fixes #16167: Fix conflict created when syncing a just-published note#16182
personalizedrefrigerator wants to merge 11 commits into
laurent22:devfrom
personalizedrefrigerator:pr/desktop/fix-conflict-on-publish-only

Conversation

@personalizedrefrigerator

Copy link
Copy Markdown
Collaborator

Problem

Currently, downloading a newly-published note (with remote changes to the title or body) creates a conflict. This happens even if the note has no local changes.

Currently, when an existing note has been changed and published remotely:

  1. Folder::updateAllShareIds is called at the beginning of sync, with the new share state from the server.
  2. The new share state indicates that an existing note has been published.
  3. Folder::updateAllShareIds sets is_shared = 1 on the note.
  • This marks the note as changed.
  1. Sync continues, downloading the remote changes to the item.
  2. Both the local and remote have changes (the local change is from step 3). As such, a conflict is created.

This seems to be a regression from #15276.

Solution

Change what happens in updateAllShareIds:

  • Continue to set is_shared for folders and sub-folders.
  • Delay changing is_shared for notes until after the sync upload/delta+download steps have completed. The "resync if there are changes" logic should handle uploading new is_shared changes (if any).

Fixes #16167.

Testing

Sync fuzzer

  1. Set sample-fuzzer-setup.json to:
    {
        "clientCount": 1,
        "description": "Changes a note, then publishes it",
        "actions": [
    	    "// Setup: Start with two clients on the same account",
    	    ["switchClient", { "id": 0 }],
    	    ["newNote", { "id": "11111111111111111111111111111110" }],
    	    ["newClientOnSameAccount", { "welcomeNoteCount": 0 }],
    	    "syncAndCheckState",
    
    	    "// Change a note, then publish it",
    	    ["updateNoteBody", { "id": "11111111111111111111111111111110"}],
    	    ["publishNote", { "id": "11111111111111111111111111111110" }],
    	    "syncAndCheckState"
        ]
    }
  2. Run the sync fuzzer with yarn syncFuzzer start --setup packages/tools/fuzzer/sample-fuzzer-setup.json.
  3. Verify that the sync fuzzer runs the setup steps from the JSON file successfully.
    • Previously, the fuzzer failed with unexpected conflicts in the last syncAndCheckState step.

Manual

Publishing and changing a single note no longer creates a conflict (compare with #16167):

Screen.Recording.2026-08-10.at.12.54.08.PM.mov

Publishing a notebook is still possible:

Screen.Recording.2026-08-10.at.12.51.53.PM.mov

@github-actions

Copy link
Copy Markdown
Contributor

@personalizedrefrigerator the pull request title does not match the required format.

Please prefix the title with the area you are targeting, then add the issue you are addressing. If the change targets several areas, separate them with commas. For example:

  • Desktop: Resolves #123: Added new setting to change font
  • Mobile, Desktop: Fixes #456: Fixed config screen error
  • Mobile, Desktop, Cli: Resolves #777: Improved note search performance

See the pull request template for the list of valid prefixes and the full specification.

This PR has been left open — please update the title when you have a moment.

@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Fixes #16167: Fix conflict created when syncing a just-published note Desktop: Fixes #16167: Fix conflict created when syncing a just-published note Aug 10, 2026
@coderabbitai coderabbitai Bot added bug It's a bug Sharing sync sync related issue labels Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Comment thread packages/lib/models/Note.ts
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Aug 10, 2026
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Aug 10, 2026
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug It's a bug Sharing sync sync related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Syncing a newly-published note with changes creates a conflict

1 participant