diff --git a/devs.md b/devs.md index d994d5e..bb74a1c 100644 --- a/devs.md +++ b/devs.md @@ -148,6 +148,20 @@ Hence, the new feature should be implemented as follows: - **Service Hub** (`src/modules/services/`): Central service registry using dependency injection - **Common Library** (`src/lib/`): Platform-independent sync logic, shared with other tools +### Conflict Merge Policy + +Markdown conflict auto-merge should behave like a conservative three-way merge. The guiding rule is to merge changes when they touch non-overlapping regions, and to keep a manual conflict when the edits overlap semantically. + +When in doubt, prefer the safer outcome: preserve data, keep the conflict visible, and ask the user rather than silently discarding content or choosing one side. + +- If one side deletes a line and the other side leaves that same line unchanged, treat it as a safe deletion. The deleted line must not be reintroduced into the merged result. +- If one side inserts new content in a different region while the other side deletes an unchanged old region, preserve the insertion and the deletion. +- If one side deletes a line and the other side modifies that same line, keep the conflict for user resolution. +- If both sides insert different content at the same position, keep both insertions in a deterministic order unless the surrounding deletion context indicates that they are competing replacements. +- Avoid resolving conflicts by simply choosing the newest revision unless the user has explicitly selected that behaviour. + +This policy is intentionally aligned with the conflict checkboxes and compatibility settings: automatic merge should remove avoidable prompts, but it must not silently choose between overlapping user intentions. + ### File Structure Conventions - **Platform-specific code**: Use `.platform.ts` suffix (replaced with `.obsidian.ts` in production builds via esbuild) diff --git a/src/lib b/src/lib index cbe333d..a0efb72 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit cbe333da24ff904a929322cb5dc267b7f05e0d1f +Subproject commit a0efb7274e15c4ae0f0e0740670a1ad2699031e9 diff --git a/updates.md b/updates.md index b675f14..959cf08 100644 --- a/updates.md +++ b/updates.md @@ -7,6 +7,13 @@ The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsid ### Fixed +- Improved Markdown conflict auto-merge so that non-overlapping edits are merged while overlapping delete-and-edit cases remain visible for manual resolution (#993). + - Behaviour change: + - When one side deletes an unchanged line and the other side edits a different region, the deleted line is no longer reintroduced into the merged result. + - When one side deletes a line and the other side modifies that same line, the conflict is preserved instead of silently choosing one side. +- Fixed an issue where applying a newer database entry to storage could incorrectly preserve an older local file as a conflict (#994). + - Behaviour change: + - Local storage is preserved as a conflict when it may contain unsynchronised changes that are not represented in the revision history. A newer incoming text entry is applied without creating a conflict only when it clearly extends the existing local text. - Fixed an issue where choosing Disable and then Overwrite in Hidden File Sync could silently skip hidden files, because the overwrite setup ran while hidden file synchronisation was still disabled (#989, PR #992). - Hidden File Sync is now re-enabled before the Fetch, Overwrite, or Merge initialisation runs, instead of after it completes. If that initialisation fails, the setting may remain enabled.