Automatic conflict resolution
Implement a mechanism to automatically resolve note conflicts where possible, and provide semi-autonomous or assisted conflict resolution when automatic resolution is not feasible. Note conflicts occur when a note is edited while the local version is not synchronized with the latest version stored on the server. At present, resolving these conflicts requires manual intervention, which can be time-consuming and particularly challenging for longer notes, especially on mobile devices. The project may optionally explore the use of AI to assist with the conflict resolution process, though this is not a required component.
Expected Outcome: The project will deliver an automatic note conflict resolution system that works consistently across both desktop and mobile versions of the app. The algorithm should automatically merge changes whenever possible while preserving all information. When this cannot be guaranteed, the application should provide semi-autonomous or assisted conflict resolution with a clear summary of the proposed changes and any potential information loss. Assisted conflict resolution must not interrupt synchronization and should be managed through a separate user interface.
how i solve:-
- Detect Conflicts
When syncing, compare:
Local Version
Server Version
Base Version (last synced version)
If both local and server versions changed → conflict detected. - Automatic Merge (3-Way Merge)
Use a 3-way merge algorithm similar to Git.
Steps:
Split note into lines or blocks
Compare changes from:
Base → Local
Base → Server
If edits are in different sections, merge automatically.
Example:
Base
Buy milk
Buy bread
Local
Buy milk
Buy bread
Buy eggs
Server
Buy milk
Buy bread
Buy butter
Auto-merge result
Buy milk
Buy bread
Buy eggs
Buy butter - Conflict Marking (When Auto Merge Fails)
If the same text section was modified, mark conflict blocks:
<<<<<<< Local
Updated text A
=======
Updated text B
Server
Save both versions to avoid data loss.
- Assisted Conflict Resolution UI
Create a Conflict Resolution Screen:
Features:
Side-by-side comparison
Highlighted changes
Buttons:
Keep Local
Keep Server
Merge Both
Short summary of differences
Important:
This UI runs after sync, so sync is not blocked. - Optional AI Assistance
AI can help suggest merges:
Functions:
Summarize differences
Suggest merged version
Highlight potential information loss
Example output:
AI suggestion: combine both edits while preserving added paragraphs.
User still confirms final result. - Cross-Platform Implementation
Implement merge logic in the shared core sync engine, so it works on:
Android
Windows
Linux
macOS
iOS
UI layer handles assisted resolution.