Skip to content

Commit b8ac95e

Browse files
armenzgbillyvg
authored andcommitted
chore(auto_source): Remove feature flag (#89389)
Since we have made this generally available, we can remove the feature flag. This also refactors one of the tests.
1 parent 9f6aefe commit b8ac95e

File tree

4 files changed

+16
-40
lines changed

4 files changed

+16
-40
lines changed

src/sentry/features/temporary.py

-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ def register_temporary_features(manager: FeatureManager):
154154
manager.add("organizations:issue-search-group-attributes-side-query", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
155155
# Enable custom views features in the issue stream
156156
manager.add("organizations:issue-stream-custom-views", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
157-
# Control if Java dry run is enabled
158-
manager.add("organizations:auto-source-code-config-java-enabled", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
159157
# Enable left nav issue views
160158
manager.add("organizations:left-nav-issue-views", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
161159
# Enable the updated empty state for issues

src/sentry/issues/auto_source_code_config/constants.py

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# e.g. com.foo.bar.Baz$handle$1, Baz.kt -> com/foo/bar/Baz.kt
2222
"extract_filename_from_module": True,
2323
"create_in_app_stack_trace_rules": True,
24-
"dry_run": True,
2524
"extensions": ["kt", "kts", "java", "jsp"],
2625
},
2726
"javascript": {"extensions": ["js", "jsx", "mjs", "tsx", "ts"]},

src/sentry/issues/auto_source_code_config/utils/platform.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Any
22

3-
from sentry import features
43
from sentry.models.organization import Organization
54

65
from ..constants import PLATFORMS_CONFIG
@@ -39,11 +38,7 @@ def is_supported(self) -> bool:
3938
return self.config is not None
4039

4140
def is_dry_run_platform(self, org: Organization) -> bool:
42-
return (
43-
not features.has("organizations:auto-source-code-config-java-enabled", org, actor=None)
44-
if self.platform == "java"
45-
else self.config.get("dry_run", False)
46-
)
41+
return self.config.get("dry_run", False)
4742

4843
def extracts_filename_from_module(self) -> bool:
4944
return self.config.get("extract_filename_from_module", False)

tests/sentry/issues/auto_source_code_config/test_process_event.py

+15-31
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from sentry.shared_integrations.exceptions import ApiError
1919
from sentry.testutils.asserts import assert_failure_metric, assert_halt_metric
2020
from sentry.testutils.cases import TestCase
21-
from sentry.testutils.helpers import with_feature
2221
from sentry.testutils.silo import assume_test_silo_mode_of
2322
from sentry.testutils.skips import requires_snuba
2423
from sentry.utils.locking import UnableToAcquireLock
@@ -606,7 +605,6 @@ class TestJavaDeriveCodeMappings(LanguageSpecificDeriveCodeMappings):
606605
platform = "java"
607606

608607
def test_short_packages(self) -> None:
609-
# No code mapping will be stored, however, we get what would have been created
610608
self._process_and_assert_configuration_changes(
611609
repo_trees={
612610
REPO1: [
@@ -634,7 +632,6 @@ def test_short_packages(self) -> None:
634632
)
635633

636634
def test_handles_dollar_sign_in_module(self) -> None:
637-
# No code mapping will be stored, however, we get what would have been created
638635
self._process_and_assert_configuration_changes(
639636
repo_trees={REPO1: ["src/com/example/foo/Bar.kt"]},
640637
frames=[
@@ -671,7 +668,6 @@ def test_multiple_configuration_changes(self) -> None:
671668
],
672669
)
673670

674-
@with_feature({"organizations:auto-source-code-config-java-enabled": True})
675671
def test_country_code_tld(self) -> None:
676672
# We have two packages for the same domain
677673
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:
722718
assert event.data["stacktrace"]["frames"][1]["module"] == "uk.co.not-example.baz.qux"
723719
assert event.data["stacktrace"]["frames"][1]["in_app"] is False
724720

725-
@with_feature({"organizations:auto-source-code-config-java-enabled": True})
726721
def test_country_code_tld_with_old_granularity(self) -> None:
727722
# We have two packages for the same domain
728723
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:
763758
"stack.module:uk.co.example.** +app",
764759
]
765760

766-
@with_feature({"organizations:auto-source-code-config-java-enabled": True})
767761
def test_do_not_clobber_rules(self) -> None:
768762
self._process_and_assert_configuration_changes(
769763
repo_trees={REPO1: ["src/a/Bar.java", "src/x/y/Baz.java"]},
@@ -781,8 +775,7 @@ def test_do_not_clobber_rules(self) -> None:
781775
expected_new_in_app_stack_trace_rules=["stack.module:x.y.** +app"],
782776
)
783777

784-
@with_feature({"organizations:auto-source-code-config-java-enabled": True})
785-
def test_run_without_dry_run(self) -> None:
778+
def test_basic_case(self) -> None:
786779
repo_trees = {REPO1: ["src/com/example/foo/Bar.kt"]}
787780
frames = [
788781
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:
839832
# Even though the file is in the repo, it's not processed because it's categorized as internals
840833
repo_trees = {REPO1: ["src/android/app/Activity.java"]}
841834
frame = self.frame(module="android.app.Activity", abs_path="Activity.java", in_app=False)
842-
with (
843-
patch(f"{CLIENT}.get_tree", side_effect=create_mock_get_tree(repo_trees)),
844-
patch(f"{CLIENT}.get_remaining_api_requests", return_value=500),
845-
patch(
846-
f"{REPO_TREES_INTEGRATION}._populate_repositories",
847-
return_value=mock_populate_repositories(),
848-
),
849-
):
850-
event = self.create_event([frame], self.platform)
851-
dry_run_code_mappings, in_app_stack_trace_rules = process_event(
852-
self.project.id, event.group_id, event.event_id
835+
self._process_and_assert_configuration_changes(
836+
repo_trees=repo_trees,
837+
frames=[frame],
838+
platform=self.platform,
839+
)
840+
841+
# If we remove the category, it will be processed
842+
with patch(f"{CODE_ROOT}.stacktraces._check_not_categorized", return_value=True):
843+
self._process_and_assert_configuration_changes(
844+
repo_trees=repo_trees,
845+
frames=[frame],
846+
platform=self.platform,
847+
expected_new_code_mappings=[self.code_mapping("android/app/", "src/android/app/")],
848+
expected_new_in_app_stack_trace_rules=["stack.module:android.app.** +app"],
853849
)
854-
assert dry_run_code_mappings == []
855-
assert in_app_stack_trace_rules == []
856-
857-
# If we remove the category, it will be processed
858-
with patch(f"{CODE_ROOT}.stacktraces._check_not_categorized", return_value=True):
859-
event = self.create_event([frame], self.platform)
860-
dry_run_code_mappings, in_app_stack_trace_rules = process_event(
861-
self.project.id, event.group_id, event.event_id
862-
)
863-
assert dry_run_code_mappings != []
864-
assert in_app_stack_trace_rules != []
865850

866-
@with_feature({"organizations:auto-source-code-config-java-enabled": True})
867851
def test_unintended_rules_are_removed(self) -> None:
868852
"""Test that unintended rules will be removed without affecting other rules"""
869853
key = "sentry:automatic_grouping_enhancements"

0 commit comments

Comments
 (0)