@@ -200,14 +200,14 @@ def setUp(self):
200200 def test_maybe_continue_pipeline_no_metadata (self , mock_trigger ):
201201 """Does not continue when metadata is missing."""
202202 state = run_state (blocks = [root_cause_memory_block ()])
203- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
203+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
204204 mock_trigger .assert_not_called ()
205205
206206 @patch ("sentry.seer.autofix.on_completion_hook.trigger_autofix_explorer" )
207207 def test_maybe_continue_pipeline_no_stopping_point_in_metadata (self , mock_trigger ):
208208 """Does not continue when stopping_point is missing from metadata."""
209209 state = run_state (blocks = [root_cause_memory_block ()], metadata = {"group_id" : self .group .id })
210- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
210+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
211211 mock_trigger .assert_not_called ()
212212
213213 @patch ("sentry.seer.autofix.on_completion_hook.trigger_autofix_explorer" )
@@ -220,7 +220,7 @@ def test_maybe_continue_pipeline_at_stopping_point(self, mock_trigger):
220220 "stopping_point" : AutofixStoppingPoint .ROOT_CAUSE .value ,
221221 },
222222 )
223- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
223+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
224224 mock_trigger .assert_not_called ()
225225
226226 @patch ("sentry.seer.autofix.on_completion_hook.get_project_seer_preferences" )
@@ -237,7 +237,7 @@ def test_maybe_continue_pipeline_continues_to_next_step(self, mock_trigger, mock
237237 "stopping_point" : AutofixStoppingPoint .CODE_CHANGES .value ,
238238 },
239239 )
240- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
240+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
241241 mock_trigger .assert_called_once ()
242242 call_kwargs = mock_trigger .call_args .kwargs
243243 assert call_kwargs ["group" ].id == self .group .id
@@ -258,7 +258,7 @@ def test_maybe_continue_pipeline_pushes_changes_for_open_pr(self, mock_push_chan
258258 "stopping_point" : AutofixStoppingPoint .OPEN_PR .value ,
259259 },
260260 )
261- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
261+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
262262 mock_push_changes .assert_called_once_with (
263263 self .group ,
264264 123 ,
@@ -290,6 +290,8 @@ class TestAutofixOnCompletionHookWebhooks(TestCase):
290290 def setUp (self ):
291291 super ().setUp ()
292292 self .organization = self .create_organization ()
293+ self .project = self .create_project (organization = self .organization )
294+ self .group = self .create_group (project = self .project )
293295
294296 @patch ("sentry.seer.autofix.on_completion_hook.broadcast_webhooks_for_organization.delay" )
295297 def test_send_step_webhook_artifact_types (self , mock_broadcast ):
@@ -328,7 +330,7 @@ class TestCaseDict(TypedDict):
328330 for i , test_case in enumerate (test_cases ):
329331 mock_broadcast .reset_mock ()
330332 state = run_state (blocks = [test_case ["block" ]])
331- AutofixOnCompletionHook ._send_step_webhook (self .organization , run_id , state )
333+ AutofixOnCompletionHook ._send_step_webhook (self .organization , run_id , state , self . group )
332334
333335 mock_broadcast .assert_called_once ()
334336 call_kwargs = mock_broadcast .call_args .kwargs
@@ -352,7 +354,7 @@ def test_send_step_webhook_coding(self, mock_broadcast):
352354 code_changes_memory_block (),
353355 ]
354356 )
355- AutofixOnCompletionHook ._send_step_webhook (self .organization , 123 , state )
357+ AutofixOnCompletionHook ._send_step_webhook (self .organization , 123 , state , self . group )
356358
357359 mock_broadcast .assert_called_once ()
358360 call_kwargs = mock_broadcast .call_args .kwargs
@@ -371,7 +373,7 @@ def test_send_step_webhook_no_artifacts_no_webhook(self, mock_broadcast):
371373 artifacts = [],
372374 )
373375 state = run_state (blocks = [block ])
374- AutofixOnCompletionHook ._send_step_webhook (self .organization , 123 , state )
376+ AutofixOnCompletionHook ._send_step_webhook (self .organization , 123 , state , self . group )
375377
376378 mock_broadcast .assert_not_called ()
377379
@@ -391,7 +393,9 @@ def test_triggers_embedding_on_root_cause(self, mock_trigger_sg):
391393 """Triggers supergroups embedding when root cause completes with feature flag enabled."""
392394 block = root_cause_memory_block ()
393395 state = run_state (blocks = [block ], metadata = {"group_id" : self .group .id })
394- AutofixOnCompletionHook ._maybe_trigger_supergroups_embedding (self .organization , 123 , state )
396+ AutofixOnCompletionHook ._maybe_trigger_supergroups_embedding (
397+ self .organization , 123 , state , self .group
398+ )
395399
396400 mock_trigger_sg .assert_called_once_with (
397401 organization_id = self .organization .id ,
@@ -407,15 +411,9 @@ def test_skips_embedding_when_flag_disabled(self, mock_trigger_sg):
407411 blocks = [root_cause_memory_block ()],
408412 metadata = {"group_id" : self .group .id },
409413 )
410- AutofixOnCompletionHook ._maybe_trigger_supergroups_embedding (self .organization , 123 , state )
411-
412- mock_trigger_sg .assert_not_called ()
413-
414- @patch ("sentry.seer.autofix.on_completion_hook.trigger_supergroups_embedding" )
415- def test_skips_embedding_when_no_group_id (self , mock_trigger_sg ):
416- """Does not trigger supergroups embedding when group_id is missing from metadata."""
417- state = run_state (blocks = [root_cause_memory_block ()])
418- AutofixOnCompletionHook ._maybe_trigger_supergroups_embedding (self .organization , 123 , state )
414+ AutofixOnCompletionHook ._maybe_trigger_supergroups_embedding (
415+ self .organization , 123 , state , self .group
416+ )
419417
420418 mock_trigger_sg .assert_not_called ()
421419
@@ -559,7 +557,7 @@ def test_maybe_continue_pipeline_triggers_handoff_when_configured(
559557 },
560558 )
561559
562- AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state )
560+ AutofixOnCompletionHook ._maybe_continue_pipeline (self .organization , 123 , state , self . group )
563561
564562 mock_trigger_handoff .assert_called_once ()
565563
0 commit comments