Skip to content

Commit 3e892e8

Browse files
authored
ref(seer automation): let project members set automation too (#95284)
Lets project members, not just admins, set Seer automation, as per business decision. Will follow up with removing the frontend gates
1 parent 0beb0fc commit 3e892e8

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/sentry/api/endpoints/project_details.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,33 @@ class ProjectMemberSerializer(serializers.Serializer):
9595
help_text="Enables starring the project within the projects tab. Can be updated with **`project:read`** permission.",
9696
required=False,
9797
)
98+
autofixAutomationTuning = serializers.ChoiceField(
99+
choices=[item.value for item in AutofixAutomationTuningSettings],
100+
required=False,
101+
)
102+
seerScannerAutomation = serializers.BooleanField(required=False)
103+
104+
def validate_autofixAutomationTuning(self, value):
105+
organization = self.context["project"].organization
106+
actor = self.context["request"].user
107+
if not features.has(
108+
"organizations:trigger-autofix-on-issue-summary", organization, actor=actor
109+
):
110+
raise serializers.ValidationError(
111+
"Organization does not have the trigger-autofix-on-issue-summary feature enabled."
112+
)
113+
return value
114+
115+
def validate_seerScannerAutomation(self, value):
116+
organization = self.context["project"].organization
117+
actor = self.context["request"].user
118+
if not features.has(
119+
"organizations:trigger-autofix-on-issue-summary", organization, actor=actor
120+
):
121+
raise serializers.ValidationError(
122+
"Organization does not have the trigger-autofix-on-issue-summary feature enabled."
123+
)
124+
return value
98125

99126

100127
@extend_schema_serializer(
@@ -222,10 +249,6 @@ class ProjectAdminSerializer(ProjectMemberSerializer):
222249
dynamicSamplingBiases = DynamicSamplingBiasSerializer(required=False, many=True)
223250
tempestFetchScreenshots = serializers.BooleanField(required=False)
224251
tempestFetchDumps = serializers.BooleanField(required=False)
225-
autofixAutomationTuning = serializers.ChoiceField(
226-
choices=[item.value for item in AutofixAutomationTuningSettings], required=False
227-
)
228-
seerScannerAutomation = serializers.BooleanField(required=False)
229252

230253
# DO NOT ADD MORE TO OPTIONS
231254
# Each param should be a field in the serializer like above.
@@ -446,28 +469,6 @@ def validate_tempestFetchDumps(self, value):
446469
)
447470
return value
448471

449-
def validate_autofixAutomationTuning(self, value):
450-
organization = self.context["project"].organization
451-
actor = self.context["request"].user
452-
if not features.has(
453-
"organizations:trigger-autofix-on-issue-summary", organization, actor=actor
454-
):
455-
raise serializers.ValidationError(
456-
"Organization does not have the trigger-autofix-on-issue-summary feature enabled."
457-
)
458-
return value
459-
460-
def validate_seerScannerAutomation(self, value):
461-
organization = self.context["project"].organization
462-
actor = self.context["request"].user
463-
if not features.has(
464-
"organizations:trigger-autofix-on-issue-summary", organization, actor=actor
465-
):
466-
raise serializers.ValidationError(
467-
"Organization does not have the trigger-autofix-on-issue-summary feature enabled."
468-
)
469-
return value
470-
471472

472473
class RelaxedProjectPermission(ProjectPermission):
473474
scope_map = {
@@ -566,7 +567,7 @@ def put(self, request: Request, project) -> Response:
566567
Update various attributes and configurable settings for the given project.
567568
568569
Note that solely having the **`project:read`** scope restricts updatable settings to
569-
`isBookmarked`.
570+
`isBookmarked`, `autofixAutomationTuning`, and `seerScannerAutomation`.
570571
"""
571572
if not request.user.is_authenticated:
572573
return Response(status=status.HTTP_400_BAD_REQUEST)

0 commit comments

Comments
 (0)