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
16 changes: 6 additions & 10 deletions src/sentry/seer/endpoints/group_autofix_setup_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from sentry.seer.autofix.utils import (
get_autofix_repos_from_project_code_mappings,
has_project_connected_repos,
is_seer_seat_based_tier_enabled,
)
from sentry.seer.constants import SEER_SUPPORTED_SCM_PROVIDERS
from sentry.seer.models import SeerApiError
Expand Down Expand Up @@ -151,11 +150,9 @@ def get(self, request: Request, group: Group) -> Response:
org_id=org.id, data_category=DataCategory.SEER_AUTOFIX
)

seer_seat_based_tier_enabled = is_seer_seat_based_tier_enabled(org)

seer_repos_linked = False
# Check if org has github integration and is on seat-based tier.
if integration_check is None and seer_seat_based_tier_enabled:
if integration_check is None:
try:
# Check if project has repos linked in Seer.
# Skip cache to ensure latest data from Seer API.
Expand All @@ -168,12 +165,11 @@ def get(self, request: Request, group: Group) -> Response:

autofix_enabled = False
autofix_automation_tuning = group.project.get_option("sentry:autofix_automation_tuning")
if seer_seat_based_tier_enabled:
if (
autofix_automation_tuning
and autofix_automation_tuning != AutofixAutomationTuningSettings.OFF
):
autofix_enabled = True
if (
autofix_automation_tuning
and autofix_automation_tuning != AutofixAutomationTuningSettings.OFF
):
autofix_enabled = True

return Response(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,18 @@ def test_seer_repos_linked_is_false_when_feature_disabled(self) -> None:
def test_autofix_automation_tuning_non_seat_based(self) -> None:
self.login_as(user=self.user)

for setting in [None] + list(AutofixAutomationTuningSettings):
for setting in [None, *list(AutofixAutomationTuningSettings)]:
self.project.update_option("sentry:autofix_automation_tuning", setting)
group = self.create_group()
url = f"/api/0/organizations/{self.organization.slug}/issues/{group.id}/autofix/setup/"
response = self.client.get(url, format="json")

assert response.status_code == 200
assert response.data["autofixEnabled"] is False
if setting is None or setting == AutofixAutomationTuningSettings.OFF:
expected = False
else:
expected = True
assert response.data["autofixEnabled"] is expected

def test_autofix_automation_tuning_off(self) -> None:
self._set_seat_based_tier_cache(True)
Expand Down
Loading