@@ -294,6 +294,8 @@ def _create_code_mapping(self, project, repo_name: str):
294294 def test_skips_project_without_repository_mapping (
295295 self , mock_apply_async : mock .MagicMock
296296 ) -> None :
297+ self .project .platform = "python"
298+ self .project .save ()
297299 run_missing_sdk_integration_detector_for_organization (self .organization )
298300 # No task should be spawned for projects without code mappings
299301 assert not mock_apply_async .called
@@ -303,6 +305,8 @@ def test_skips_project_without_repository_mapping(
303305 "sentry.autopilot.tasks.run_missing_sdk_integration_detector_for_project_task.apply_async"
304306 )
305307 def test_skips_inactive_repositories (self , mock_apply_async : mock .MagicMock ) -> None :
308+ self .project .platform = "python"
309+ self .project .save ()
306310 # Create a code mapping with an inactive repository
307311 code_mapping = self ._create_code_mapping (self .project , "inactive-repo" )
308312 code_mapping .repository .status = ObjectStatus .PENDING_DELETION
@@ -318,6 +322,8 @@ def test_skips_inactive_repositories(self, mock_apply_async: mock.MagicMock) ->
318322 "sentry.autopilot.tasks.run_missing_sdk_integration_detector_for_project_task.apply_async"
319323 )
320324 def test_spawns_task_for_project_with_mapping (self , mock_apply_async : mock .MagicMock ) -> None :
325+ self .project .platform = "python"
326+ self .project .save ()
321327 self ._create_code_mapping (self .project , "test-repo" )
322328
323329 run_missing_sdk_integration_detector_for_organization (self .organization )
@@ -328,6 +334,62 @@ def test_spawns_task_for_project_with_mapping(self, mock_apply_async: mock.Magic
328334 headers = {"sentry-propagate-traces" : False },
329335 )
330336
337+ @pytest .mark .django_db
338+ @mock .patch (
339+ "sentry.autopilot.tasks.run_missing_sdk_integration_detector_for_project_task.apply_async"
340+ )
341+ def test_only_processes_supported_platforms (self , mock_apply_async : mock .MagicMock ) -> None :
342+ # Create projects with supported platforms
343+ python_project = self .create_project (organization = self .organization , platform = "python" )
344+ node_project = self .create_project (organization = self .organization , platform = "node" )
345+ js_project = self .create_project (organization = self .organization , platform = "javascript" )
346+ js_react_project = self .create_project (
347+ organization = self .organization , platform = "javascript-react"
348+ )
349+ python_django_project = self .create_project (
350+ organization = self .organization , platform = "python-django"
351+ )
352+ node_express_project = self .create_project (
353+ organization = self .organization , platform = "node-express"
354+ )
355+
356+ # Create projects with unsupported platforms
357+ go_project = self .create_project (organization = self .organization , platform = "go" )
358+ ruby_project = self .create_project (organization = self .organization , platform = "ruby" )
359+ java_project = self .create_project (organization = self .organization , platform = "java" )
360+
361+ # Create code mappings for all projects
362+ self ._create_code_mapping (python_project , "python-repo" )
363+ self ._create_code_mapping (node_project , "node-repo" )
364+ self ._create_code_mapping (js_project , "js-repo" )
365+ self ._create_code_mapping (js_react_project , "js-react-repo" )
366+ self ._create_code_mapping (python_django_project , "python-django-repo" )
367+ self ._create_code_mapping (node_express_project , "node-express-repo" )
368+ self ._create_code_mapping (go_project , "go-repo" )
369+ self ._create_code_mapping (ruby_project , "ruby-repo" )
370+ self ._create_code_mapping (java_project , "java-repo" )
371+
372+ run_missing_sdk_integration_detector_for_organization (self .organization )
373+
374+ # Only supported platforms should have tasks spawned
375+ assert mock_apply_async .call_count == 6
376+
377+ # Collect all project IDs that had tasks spawned
378+ spawned_project_ids = {call [1 ]["args" ][1 ] for call in mock_apply_async .call_args_list }
379+
380+ # Supported platforms should be included
381+ assert python_project .id in spawned_project_ids
382+ assert node_project .id in spawned_project_ids
383+ assert js_project .id in spawned_project_ids
384+ assert js_react_project .id in spawned_project_ids
385+ assert python_django_project .id in spawned_project_ids
386+ assert node_express_project .id in spawned_project_ids
387+
388+ # Unsupported platforms should NOT be included
389+ assert go_project .id not in spawned_project_ids
390+ assert ruby_project .id not in spawned_project_ids
391+ assert java_project .id not in spawned_project_ids
392+
331393
332394class TestRunMissingSdkIntegrationDetectorForProject (TestCase ):
333395 @pytest .mark .django_db
0 commit comments