diff --git a/src/sentry/features/temporary.py b/src/sentry/features/temporary.py index 779545f655b9a4..420e43435ff653 100644 --- a/src/sentry/features/temporary.py +++ b/src/sentry/features/temporary.py @@ -154,8 +154,6 @@ def register_temporary_features(manager: FeatureManager): manager.add("organizations:issue-search-group-attributes-side-query", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False) # Enable custom views features in the issue stream manager.add("organizations:issue-stream-custom-views", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True) - # Control if Java dry run is enabled - manager.add("organizations:auto-source-code-config-java-enabled", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False) # Enable left nav issue views manager.add("organizations:left-nav-issue-views", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True) # Enable the updated empty state for issues diff --git a/src/sentry/issues/auto_source_code_config/constants.py b/src/sentry/issues/auto_source_code_config/constants.py index c394c8fa175ddd..443d982f6b6560 100644 --- a/src/sentry/issues/auto_source_code_config/constants.py +++ b/src/sentry/issues/auto_source_code_config/constants.py @@ -21,7 +21,6 @@ # e.g. com.foo.bar.Baz$handle$1, Baz.kt -> com/foo/bar/Baz.kt "extract_filename_from_module": True, "create_in_app_stack_trace_rules": True, - "dry_run": True, "extensions": ["kt", "kts", "java", "jsp"], }, "javascript": {"extensions": ["js", "jsx", "mjs", "tsx", "ts"]}, diff --git a/src/sentry/issues/auto_source_code_config/utils/platform.py b/src/sentry/issues/auto_source_code_config/utils/platform.py index 31260e719caeb8..82936827206301 100644 --- a/src/sentry/issues/auto_source_code_config/utils/platform.py +++ b/src/sentry/issues/auto_source_code_config/utils/platform.py @@ -1,6 +1,5 @@ from typing import Any -from sentry import features from sentry.models.organization import Organization from ..constants import PLATFORMS_CONFIG @@ -39,11 +38,7 @@ def is_supported(self) -> bool: return self.config is not None def is_dry_run_platform(self, org: Organization) -> bool: - return ( - not features.has("organizations:auto-source-code-config-java-enabled", org, actor=None) - if self.platform == "java" - else self.config.get("dry_run", False) - ) + return self.config.get("dry_run", False) def extracts_filename_from_module(self) -> bool: return self.config.get("extract_filename_from_module", False) diff --git a/tests/sentry/issues/auto_source_code_config/test_process_event.py b/tests/sentry/issues/auto_source_code_config/test_process_event.py index e2b708f2971738..182cef2533dd76 100644 --- a/tests/sentry/issues/auto_source_code_config/test_process_event.py +++ b/tests/sentry/issues/auto_source_code_config/test_process_event.py @@ -18,7 +18,6 @@ from sentry.shared_integrations.exceptions import ApiError from sentry.testutils.asserts import assert_failure_metric, assert_halt_metric from sentry.testutils.cases import TestCase -from sentry.testutils.helpers import with_feature from sentry.testutils.silo import assume_test_silo_mode_of from sentry.testutils.skips import requires_snuba from sentry.utils.locking import UnableToAcquireLock @@ -606,7 +605,6 @@ class TestJavaDeriveCodeMappings(LanguageSpecificDeriveCodeMappings): platform = "java" def test_short_packages(self) -> None: - # No code mapping will be stored, however, we get what would have been created self._process_and_assert_configuration_changes( repo_trees={ REPO1: [ @@ -634,7 +632,6 @@ def test_short_packages(self) -> None: ) def test_handles_dollar_sign_in_module(self) -> None: - # No code mapping will be stored, however, we get what would have been created self._process_and_assert_configuration_changes( repo_trees={REPO1: ["src/com/example/foo/Bar.kt"]}, frames=[ @@ -671,7 +668,6 @@ def test_multiple_configuration_changes(self) -> None: ], ) - @with_feature({"organizations:auto-source-code-config-java-enabled": True}) def test_country_code_tld(self) -> None: # We have two packages for the same domain repo_trees = {REPO1: ["src/uk/co/example/foo/Bar.kt", "src/uk/co/example/bar/Baz.kt"]} @@ -722,7 +718,6 @@ def test_country_code_tld(self) -> None: assert event.data["stacktrace"]["frames"][1]["module"] == "uk.co.not-example.baz.qux" assert event.data["stacktrace"]["frames"][1]["in_app"] is False - @with_feature({"organizations:auto-source-code-config-java-enabled": True}) def test_country_code_tld_with_old_granularity(self) -> None: # We have two packages for the same domain repo_trees = {REPO1: ["src/uk/co/example/foo/Bar.kt", "src/uk/co/example/bar/Baz.kt"]} @@ -763,7 +758,6 @@ def test_country_code_tld_with_old_granularity(self) -> None: "stack.module:uk.co.example.** +app", ] - @with_feature({"organizations:auto-source-code-config-java-enabled": True}) def test_do_not_clobber_rules(self) -> None: self._process_and_assert_configuration_changes( repo_trees={REPO1: ["src/a/Bar.java", "src/x/y/Baz.java"]}, @@ -781,8 +775,7 @@ def test_do_not_clobber_rules(self) -> None: expected_new_in_app_stack_trace_rules=["stack.module:x.y.** +app"], ) - @with_feature({"organizations:auto-source-code-config-java-enabled": True}) - def test_run_without_dry_run(self) -> None: + def test_basic_case(self) -> None: repo_trees = {REPO1: ["src/com/example/foo/Bar.kt"]} frames = [ self.frame(module="com.example.foo.Bar", abs_path="Bar.kt", in_app=False), @@ -839,31 +832,22 @@ def test_categorized_frames_are_not_processed(self) -> None: # Even though the file is in the repo, it's not processed because it's categorized as internals repo_trees = {REPO1: ["src/android/app/Activity.java"]} frame = self.frame(module="android.app.Activity", abs_path="Activity.java", in_app=False) - with ( - patch(f"{CLIENT}.get_tree", side_effect=create_mock_get_tree(repo_trees)), - patch(f"{CLIENT}.get_remaining_api_requests", return_value=500), - patch( - f"{REPO_TREES_INTEGRATION}._populate_repositories", - return_value=mock_populate_repositories(), - ), - ): - event = self.create_event([frame], self.platform) - dry_run_code_mappings, in_app_stack_trace_rules = process_event( - self.project.id, event.group_id, event.event_id + self._process_and_assert_configuration_changes( + repo_trees=repo_trees, + frames=[frame], + platform=self.platform, + ) + + # If we remove the category, it will be processed + with patch(f"{CODE_ROOT}.stacktraces._check_not_categorized", return_value=True): + self._process_and_assert_configuration_changes( + repo_trees=repo_trees, + frames=[frame], + platform=self.platform, + expected_new_code_mappings=[self.code_mapping("android/app/", "src/android/app/")], + expected_new_in_app_stack_trace_rules=["stack.module:android.app.** +app"], ) - assert dry_run_code_mappings == [] - assert in_app_stack_trace_rules == [] - - # If we remove the category, it will be processed - with patch(f"{CODE_ROOT}.stacktraces._check_not_categorized", return_value=True): - event = self.create_event([frame], self.platform) - dry_run_code_mappings, in_app_stack_trace_rules = process_event( - self.project.id, event.group_id, event.event_id - ) - assert dry_run_code_mappings != [] - assert in_app_stack_trace_rules != [] - @with_feature({"organizations:auto-source-code-config-java-enabled": True}) def test_unintended_rules_are_removed(self) -> None: """Test that unintended rules will be removed without affecting other rules""" key = "sentry:automatic_grouping_enhancements"