Skip to content

Commit f77cc48

Browse files
committed
Cleanup comments
1 parent 04f221c commit f77cc48

2 files changed

Lines changed: 5 additions & 34 deletions

File tree

server/mergin/sync/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ def _compare_changes(
11911191
PushChangeType.DELETE,
11921192
PushChangeType.CREATE,
11931193
): ChangeComparisonAction.FORCE_UPDATE,
1194-
# delete + update = invalid sequence
1194+
# delete + update = replace it (used for multicheckpoint ranges when we want to keep file in history even if it was deleted in the middle, so we keep delete but update metadata and diffs)
11951195
(
11961196
PushChangeType.DELETE,
11971197
PushChangeType.UPDATE,

server/mergin/tests/test_public_api_v2.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -496,16 +496,6 @@ def test_delta_merge_changes():
496496

497497
def test_delta_cross_checkpoint_create_delete_recreate(client):
498498
"""
499-
Regression test for cross-checkpoint pre-merge bug: scenario 1.
500-
501-
A file that is created within the queried range and then deleted+re-created
502-
across a rank-1 chunk boundary is silently excluded from the delta result.
503-
504-
Root cause: create_checkpoint calls merge_changes before storing, collapsing
505-
DELETE+CREATE into CREATE and losing the DELETE. When two chunks both store
506-
CREATE for the same file, the outer merge_changes in get_delta_changes sees
507-
CREATE+CREATE which maps to EXCLUDE — and the file disappears from the result.
508-
509499
Setup (rank-1 chunks cover 4 versions each, 4^1=4):
510500
v1–v4: tracked.gpkg does NOT exist (client at v4 has never seen it)
511501
v5–v8: tracked.gpkg is CREATED at v5 → rank-1 stores [CREATE(v5)]
@@ -549,29 +539,15 @@ def test_delta_cross_checkpoint_create_delete_recreate(client):
549539

550540
assert delta is not None
551541
tracked = next((d for d in delta if d.path == "tracked.gpkg"), None)
552-
assert tracked is not None, (
553-
"tracked.gpkg missing from delta — cross-checkpoint pre-merge bug: "
554-
"DELETE(v9)+CREATE(v10) was collapsed to CREATE inside checkpoint(v9-v12), "
555-
"then CREATE(v5)+CREATE(v10) hit CREATE+CREATE→EXCLUDE in the outer merge"
556-
)
542+
# DELETE(v9)+CREATE(v10) was collapsed to CREATE inside checkpoint(v9-v12)
543+
# then CREATE(v5)+CREATE(v10) hit CREATE+CREATE→EXCLUDE in the outer merge
544+
assert tracked is not None
557545
assert tracked.change == PushChangeType.CREATE
558546
assert tracked.version == 10
559547

560548

561549
def test_delta_cross_checkpoint_recreate_then_delete(client):
562550
"""
563-
Regression test for cross-checkpoint pre-merge bug: scenario 2.
564-
565-
A file that existed before the queried range, is deleted+re-created within
566-
chunk A, and then permanently deleted in chunk B is silently excluded from
567-
the delta result instead of appearing as DELETE.
568-
569-
Root cause: create_checkpoint pre-merges DELETE+CREATE to CREATE in chunk A,
570-
losing the DELETE. The outer merge then sees CREATE (chunk A) + DELETE (chunk B).
571-
Because the stored CREATE did not populate updating_files, exclude_delete=True,
572-
so CREATE+DELETE maps to EXCLUDE rather than DELETE — the file is never
573-
removed from the client even though it no longer exists on the server.
574-
575551
Setup:
576552
v1–v4: base.gpkg exists (client at v4 has the file, exclude_delete should be False)
577553
v5–v8: base.gpkg DELETED at v5, RE-CREATED at v6
@@ -614,12 +590,7 @@ def test_delta_cross_checkpoint_recreate_then_delete(client):
614590

615591
assert delta is not None
616592
base_gpkg = next((d for d in delta if d.path == "base.gpkg"), None)
617-
assert base_gpkg is not None, (
618-
"base.gpkg missing from delta — cross-checkpoint pre-merge bug: "
619-
"DELETE(v5)+CREATE(v6) was collapsed to CREATE inside checkpoint(v5-v8), "
620-
"then CREATE(v6)+DELETE(v9) hit CREATE+DELETE with exclude_delete=True→EXCLUDE "
621-
"in the outer merge, so client is never told to remove the file"
622-
)
593+
assert base_gpkg is not None
623594
assert base_gpkg.change == PushChangeType.DELETE
624595

625596

0 commit comments

Comments
 (0)