File tree 2 files changed +19
-1
lines changed
src/sentry/issues/auto_source_code_config
tests/sentry/issues/auto_source_code_config
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ def save_in_app_stack_trace_rules(
25
25
current_enhancements = project .get_option (DERIVED_ENHANCEMENTS_OPTION_KEY )
26
26
current_rules = set (current_enhancements .split ("\n " )) if current_enhancements else set ()
27
27
28
- united_rules = rules_from_code_mappings .union (current_rules )
28
+ developer_enhancements = project .get_option ("sentry:grouping_enhancements" )
29
+ developer_rules = set (developer_enhancements .split ("\n " )) if developer_enhancements else set ()
30
+
31
+ # We do not want to duplicate rules from the developer enhancements
32
+ united_rules = rules_from_code_mappings .union (current_rules ).difference (developer_rules )
33
+
29
34
dry_run = platform_config .is_dry_run_platform (project .organization )
30
35
if not dry_run and united_rules != current_rules :
31
36
project .update_option (DERIVED_ENHANCEMENTS_OPTION_KEY , "\n " .join (sorted (united_rules )))
Original file line number Diff line number Diff line change @@ -833,6 +833,19 @@ def test_do_not_clobber_rules(self) -> None:
833
833
expected_new_in_app_stack_trace_rules = ["stack.module:x.y.** +app" ],
834
834
)
835
835
836
+ def test_prevent_creating_duplicate_rules (self ) -> None :
837
+ # Rules set by the customer prevent configuration changes
838
+ self .project .update_option ("sentry:grouping_enhancements" , "stack.module:foo.bar.** +app" )
839
+ # Manually created code mapping
840
+ self .create_repo_and_code_mapping (REPO1 , "foo/bar/" , "src/foo/" )
841
+ # We do not expect code mappings or in-app rules to be created since
842
+ # the developer already created the code mapping and in-app rule
843
+ self ._process_and_assert_configuration_changes (
844
+ repo_trees = {REPO1 : ["src/foo/bar/Baz.java" ]},
845
+ frames = [self .frame_from_module ("foo.bar.Baz" , "Baz.java" )],
846
+ platform = self .platform ,
847
+ )
848
+
836
849
def test_basic_case (self ) -> None :
837
850
repo_trees = {REPO1 : ["src/com/example/foo/Bar.kt" ]}
838
851
frames = [
You can’t perform that action at this time.
0 commit comments