@@ -160,29 +160,23 @@ def test_function_with_multiple_arguments(self, mock_compare_distributions) -> N
160160 assert "rankedAttributes" in response .data
161161
162162 @patch ("sentry.api.endpoints.organization_trace_item_attributes_ranked.compare_distributions" )
163- @patch ("sentry.api.endpoints.organization_trace_item_attributes_ranked.keyed_rrf_score" )
164163 def test_baseline_distribution_includes_baseline_only_buckets (
165- self , mock_keyed_rrf_score , mock_compare_distributions
164+ self , mock_compare_distributions
166165 ) -> None :
167166 """Test that buckets existing only in baseline (not in suspect) are included in scoring.
168167
169168 This specifically tests the fix for the bug where attribute values that exist
170169 in all spans but NOT in the suspect cohort were missing from the baseline
171170 distribution passed to scoring algorithms.
172171 """
173- # Capture what's passed to the scoring functions
172+ # Capture what's passed to compare_distributions
174173 captured_baseline = None
175174
176- def capture_baseline (* args , ** kwargs ):
175+ def capture_compare (* args , ** kwargs ):
177176 nonlocal captured_baseline
178177 captured_baseline = kwargs .get ("baseline" )
179- # Return results matching the actual internal attribute names
180- return [("sentry.browser" , 1.0 ), ("sentry.device" , 0.8 )]
181-
182- def capture_compare (* args , ** kwargs ):
183178 return {"results" : [("sentry.browser" , 0.9 ), ("sentry.device" , 0.7 )]}
184179
185- mock_keyed_rrf_score .side_effect = capture_baseline
186180 mock_compare_distributions .side_effect = capture_compare
187181
188182 tags = [
@@ -292,12 +286,11 @@ def test_filters_out_internal_and_private_attributes(self, mock_compare_distribu
292286 ), f"Attribute '{ attr_name } ' should be filtered (meta attribute)"
293287
294288 @patch ("sentry.api.endpoints.organization_trace_item_attributes_ranked.compare_distributions" )
295- @patch ("sentry.api.endpoints.organization_trace_item_attributes_ranked.keyed_rrf_score" )
296289 @patch (
297290 "sentry.api.endpoints.organization_trace_item_attributes_ranked.translate_internal_to_public_alias"
298291 )
299292 def test_includes_user_defined_attributes_when_translate_returns_none (
300- self , mock_translate , mock_keyed_rrf_score , mock_compare_distributions
293+ self , mock_translate , mock_compare_distributions
301294 ) -> None :
302295 """Test that user-defined attributes are included when translate_internal_to_public_alias returns None.
303296
@@ -316,14 +309,7 @@ def mock_translate_func(attr, *_):
316309
317310 mock_translate .side_effect = mock_translate_func
318311
319- # Mock primary scoring (keyed_rrf_score) to include our test attributes
320- mock_keyed_rrf_score .return_value = [
321- ("custom_user_attr" , 0.9 ),
322- ("tags[filtered_tag]" , 0.8 ),
323- ("regular_attr" , 0.7 ),
324- ]
325-
326- # Mock secondary scoring for RRR ordering
312+ # Mock compare_distributions to return our test attributes (now the primary scoring)
327313 mock_compare_distributions .return_value = {
328314 "results" : [
329315 ("custom_user_attr" , 0.9 ),
0 commit comments