v0.13.0: the merge report says who, what, and where
The merge window kept reporting "Order kept from this machine (most recently
edited)" for playlists edited on the other machine. Three defects, confirmed
against the real snapshots in .resolved/:
* "this machine" was inferred from which copy held the plain filename. That is
Syncthing's call, not a statement about authorship — it sets the local copy
aside as readily as a remote one. In the 9:34 PM `* a fresh master` merge the
copy labelled "the other machine" was this machine's own 3:15 PM merge output,
so the label was exactly backwards. The 7-char device ID in the conflict
filename — the only real evidence — was matched by a bare \w+ and deleted with
the file. New sync_identity.py decodes it against Syncthing's config.xml and
works out which device is us from cert.pem.
* The decision leaned local. date_modified was only consulted when *both* copies
had one, and an iTunes playlist never reordered here has none — so the honest
comparison was skipped exactly when one machine had edited and the other
hadn't. A stamped copy now beats an unstamped one; mtime is the fallback only
when neither side has ever been edited. And every merge used to rewrite the
file it kept whether or not anything changed, freshening its mtime while the
conflict file kept its origin's: a ratchet. No-op merges write nothing, and a
merge whose result is a union neither copy had stamps date_modified, so the
other machine adopts it instead of trading the same 19 tracks back and forth.
* Nothing was actionable. Re-inserted tracks are now named with their position
("Pola — Abeille -> position 24, after ..."), six in the window and all of
them in what-changed.txt at the top of the backup snapshot, alongside the real
conflict filename and its device. Tracks only this copy has are reported too
rather than resurrected in silence.
Also fixed while in here: a rename or folder move made elsewhere was discarded
by every merge (only track_ids and settings were adopted); _reconcile_playlist
asserted the local edit was newer and never checked, so a reorder synced in from
the other machine was undone and flushed back to disk, and the branch reaching
it was gated on a dirty flag that a column drag sets; and _merge_metadata
decided the music folder from whichever copy an mtime coin flip had kept.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9ZEFi4qNJ39FMiBtiAxy2
This commit is contained in:
@@ -117,7 +117,9 @@ class TestHonestDateModified:
|
||||
summaries = conflict_resolver.resolve_conflicts(tmp_path)
|
||||
|
||||
assert json.loads(pfile.read_text())["track_ids"] == [3, 1, 2]
|
||||
assert "this machine" in summaries[0].lines[0]
|
||||
# Round 43: the report names the copy by which file Syncthing left the
|
||||
# plain name on, not by a guess about which machine typed it.
|
||||
assert "the copy that was already here" in summaries[0].lines[0]
|
||||
|
||||
def test_the_genuinely_newer_edit_still_wins(self, tmp_path):
|
||||
pfile, _ = self._setup(
|
||||
@@ -128,7 +130,7 @@ class TestHonestDateModified:
|
||||
summaries = conflict_resolver.resolve_conflicts(tmp_path)
|
||||
|
||||
assert json.loads(pfile.read_text())["track_ids"] == [3, 2, 1]
|
||||
assert "the other machine" in summaries[0].lines[0]
|
||||
assert "the copy Syncthing set aside" in summaries[0].lines[0]
|
||||
|
||||
def test_their_insert_lands_in_position_not_at_the_tail(self, tmp_path):
|
||||
pfile, _ = self._setup(
|
||||
@@ -139,7 +141,8 @@ class TestHonestDateModified:
|
||||
summaries = conflict_resolver.resolve_conflicts(tmp_path)
|
||||
|
||||
assert json.loads(pfile.read_text())["track_ids"] == [1, 2, 99, 3]
|
||||
assert "back in position" in summaries[0].lines[1]
|
||||
assert any("put back where it had been" in line
|
||||
for line in summaries[0].lines)
|
||||
|
||||
def test_falls_back_to_mtime_before_the_field_existed(self, tmp_path):
|
||||
"""Playlists written by an older version carry no stamp."""
|
||||
|
||||
Reference in New Issue
Block a user