Repository: getsentry/sentry

Issue:
Hard code 3 combinations for EA
Hard code the 3 winning combinations from the internal testing for an [A/B/C test](https://develop.sentry.dev/ab-testing/) in EA. 


Discussion:
This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it `Status: Backlog` or `Status: In Progress`, I will leave it alone ... forever!

----

"A weed is but an unloved flower." ― _Ella Wheeler Wilcox_ 🥀

Resolving patch:
diff --git a/src/sentry/api/endpoints/organization_group_index.py b/src/sentry/api/endpoints/organization_group_index.py
--- a/src/sentry/api/endpoints/organization_group_index.py
+++ b/src/sentry/api/endpoints/organization_group_index.py
@@ -27,6 +27,7 @@
 from sentry.api.utils import InvalidParams, get_date_range_from_stats_period
 from sentry.constants import ALLOWED_FUTURE_DELTA
 from sentry.exceptions import InvalidSearchQuery
+from sentry.experiments import manager as expt_manager
 from sentry.models import (
     QUERY_STATUS_LOOKUP,
     Environment,
@@ -165,7 +166,9 @@ class OrganizationGroupIndexEndpoint(OrganizationEventsEndpointBase):
     }
 
     @staticmethod
-    def build_better_priority_sort_kwargs(request: Request) -> Mapping[str, PrioritySortWeights]:
+    def build_better_priority_sort_kwargs(
+        request: Request, choice: str
+    ) -> Mapping[str, PrioritySortWeights]:
         """
         Temporary function to be used while developing the new priority sort. Parses the query params in the request.
 
@@ -184,7 +187,8 @@ def _coerce(val: Optional[str], func: Type[R], default: R) -> R:
 
             return func(val) if val is not None else default
 
-        return {
+        # XXX(CEO): these default values are based on the current sort C and are subject to change
+        aggregate_kwargs = {
             "better_priority": {
                 "log_level": _coerce(
                     request.GET.get("logLevel"), int, DEFAULT_PRIORITY_WEIGHTS["log_level"]
@@ -214,6 +218,14 @@ def _coerce(val: Optional[str], func: Type[R], default: R) -> R:
             }
         }
 
+        # XXX(CEO): these are based on the current sort D and E and are subject to change
+        if choice:
+            aggregate_kwargs["better_priority"]["issue_halflife_hours"] = 12
+        if choice == "variant1":
+            aggregate_kwargs["better_priority"]["relative_volume"] = 0
+
+        return aggregate_kwargs
+
     def _search(
         self, request: Request, organization, projects, environments, extra_query_kwargs=None
     ):
@@ -226,7 +238,29 @@ def _search(
                 query_kwargs.update(extra_query_kwargs)
 
             if query_kwargs["sort_by"] == "betterPriority":
-                query_kwargs["aggregate_kwargs"] = self.build_better_priority_sort_kwargs(request)
+                choice = None
+                if features.has(
+                    "organizations:better-priority-sort-experiment",
+                    organization,
+                    actor=request.user,
+                ):
+                    choice = expt_manager.get(
+                        "PrioritySortExperiment", org=organization, actor=request.user
+                    )
+                # force into variant1 for internal testing
+                if features.has(
+                    "organizations:issue-list-better-priority-sort",
+                    organization,
+                    actor=request.user,
+                ):
+                    choice = "variant1"
+
+                if choice == "baseline":
+                    query_kwargs["sort_by"] = "date"
+                else:
+                    query_kwargs["aggregate_kwargs"] = self.build_better_priority_sort_kwargs(
+                        request, choice
+                    )
 
             query_kwargs["environments"] = environments if environments else None
 


Test patch:
diff --git a/tests/snuba/api/endpoints/test_organization_group_index.py b/tests/snuba/api/endpoints/test_organization_group_index.py
--- a/tests/snuba/api/endpoints/test_organization_group_index.py
+++ b/tests/snuba/api/endpoints/test_organization_group_index.py
@@ -114,6 +114,7 @@ def test_query_for_archived(self):
         assert response.data[0]["id"] == str(group.id)
 
     @with_feature("organizations:issue-list-better-priority-sort")
+    @with_feature("organizations:better-priority-sort-experiment")
     def test_sort_by_better_priority(self):
         group = self.store_event(
             data={