diff --git a/packages/syft/src/syft/service/sync/diff_state.py b/packages/syft/src/syft/service/sync/diff_state.py index 9465f6f10f9..69efef0dd07 100644 --- a/packages/syft/src/syft/service/sync/diff_state.py +++ b/packages/syft/src/syft/service/sync/diff_state.py @@ -1215,6 +1215,12 @@ def from_sync_state( low_status = "NEW" high_status = "NEW" + # We don't support deletion of objects yet. + # So, skip if the object is not present on the *source* side + source_obj = low_obj if direction == SyncDirection.LOW_TO_HIGH else high_obj + if source_obj is None: + continue + diff = ObjectDiff.from_objects( low_obj=low_obj, high_obj=high_obj, diff --git a/packages/syft/tests/syft/service/sync/sync_resolve_single_test.py b/packages/syft/tests/syft/service/sync/sync_resolve_single_test.py index c83eac1a66e..85764a94805 100644 --- a/packages/syft/tests/syft/service/sync/sync_resolve_single_test.py +++ b/packages/syft/tests/syft/service/sync/sync_resolve_single_test.py @@ -136,6 +136,20 @@ def compute() -> int: assert res == compute(syft_no_server=True) +def test_skip_deletion(low_worker, high_worker): + low_client: DatasiteClient = low_worker.root_client + high_client: DatasiteClient = high_worker.root_client + + @sy.syft_function_single_use() + def compute() -> int: + return 42 + + _ = low_client.code.request_code_execution(compute) + + w = sy.sync(high_client, low_client) + assert isinstance(w, SyftSuccess), f"Expected empty diff, got {w}" + + def test_diff_state_with_dataset(low_worker: Worker, high_worker: Worker): low_client: DatasiteClient = low_worker.root_client client_low_ds = get_ds_client(low_client)