Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/sentry/issues/auto_source_code_config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any

from sentry import features
from sentry.models.organization import Organization

from ..constants import PLATFORMS_CONFIG
Expand Down Expand Up @@ -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)
Expand Down
46 changes: 15 additions & 31 deletions tests/sentry/issues/auto_source_code_config/test_process_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -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=[
Expand Down Expand Up @@ -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"]}
Expand Down Expand Up @@ -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"]}
Expand Down Expand Up @@ -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"]},
Expand All @@ -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),
Expand Down Expand Up @@ -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(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should have been written using _process_and_assert_configuration_changes from the get go.

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"
Expand Down
Loading