@@ -383,7 +383,8 @@ def select_rows(
383383 def tenant_ids (self ) -> dict [str , str ]:
384384 return {"referrer" : self .referrer , "organization_id" : self .organization .id }
385385
386- def test_simple_issue_platform (self ) -> None :
386+ @mock .patch ("sentry.deletions.tasks.nodestore.bulk_snuba_queries" )
387+ def test_simple_issue_platform (self , mock_bulk_snuba_queries : mock .Mock ) -> None :
387388 # Adding this query here to make sure that the cache is not being used
388389 assert self .select_error_events (self .project .id ) is None
389390 assert self .select_issue_platform_events (self .project .id ) is None
@@ -433,10 +434,36 @@ def test_simple_issue_platform(self) -> None:
433434 assert nodestore .backend .get (event_node_id )
434435 assert self .select_error_events (self .project .id ) == expected_error
435436
436- # The Issue Platform group and occurrence have been deleted
437+ # The Issue Platform group and occurrence have been deleted from Postgres
437438 assert not Group .objects .filter (id = issue_platform_group .id ).exists ()
438439 # assert not nodestore.backend.get(occurrence_node_id)
439- assert self .select_issue_platform_events (self .project .id ) is None
440+
441+ # Verify that deletion was sent to Snuba
442+ # We mock bulk_snuba_queries to avoid eventual consistency issues with ClickHouse light deletes
443+ assert mock_bulk_snuba_queries .called
444+ delete_calls = [
445+ call for call in mock_bulk_snuba_queries .call_args_list if call [0 ]
446+ ] # Get calls with args
447+ assert (
448+ len (delete_calls ) > 0
449+ ), "Expected at least one call to bulk_snuba_queries for deletion"
450+
451+ # Verify a DeleteQuery was sent for the issue platform group
452+ from snuba_sdk import DeleteQuery
453+
454+ found_delete = False
455+ for call in delete_calls :
456+ requests = call [0 ][0 ] # First positional arg is the list of requests
457+ for req in requests :
458+ if isinstance (req .query , DeleteQuery ):
459+ # Verify it's deleting the correct group
460+ if issue_platform_group .id in req .query .column_conditions .get ("group_id" , []):
461+ found_delete = True
462+ break
463+ if found_delete :
464+ break
465+
466+ assert found_delete , f"No DeleteQuery found for group { issue_platform_group .id } "
440467
441468 @mock .patch ("sentry.deletions.tasks.nodestore.bulk_snuba_queries" )
442469 def test_issue_platform_batching (self , mock_bulk_snuba_queries : mock .Mock ) -> None :
0 commit comments