diff --git a/backend/infrahub/core/diff/combiner.py b/backend/infrahub/core/diff/combiner.py index 3819f3abae..5ad691428e 100644 --- a/backend/infrahub/core/diff/combiner.py +++ b/backend/infrahub/core/diff/combiner.py @@ -210,7 +210,7 @@ def _combine_cardinality_one_relationship_elements( if combined_action is DiffAction.REMOVED: for element in ordered_elements: for prop in element.properties: - if prop.property_type is DatabaseEdgeType.IS_RELATED and prop.action is DiffAction.UPDATED: + if prop.property_type is DatabaseEdgeType.IS_RELATED and prop.action is DiffAction.UPDATED and prop.previous_value: peer_id = prop.previous_value peer_label = prop.previous_label break diff --git a/backend/tests/integration/diff/test_diff_incremental_addition.py b/backend/tests/integration/diff/test_diff_incremental_addition.py index 0a4f5cd2fd..7648a5fb95 100644 --- a/backend/tests/integration/diff/test_diff_incremental_addition.py +++ b/backend/tests/integration/diff/test_diff_incremental_addition.py @@ -62,7 +62,7 @@ async def initial_dataset( manufacturer=dmc, ) await delorean.save(db=db) - await delorean.previous_owner.update(db=db, data={"id": doc_brown.id, "_relation__is_protected": True}) + await delorean.previous_owner.update(db=db, data={"id": doc_brown.id, "_relation__is_protected": True}) # type: ignore[attr-defined] await delorean.save(db=db) bus_simulator.service.cache = RedisCache()