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
3 changes: 3 additions & 0 deletions src/sentry/api/endpoints/group_autofix_setup_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,8 @@ def get(self, request: Request, group: Group) -> Response:
"codebaseIndexing": {
"ok": codebase_indexing_ok,
},
"autofixEnabled": {
"ok": org.get_option("sentry:autofix_enabled", False),
},
}
)
12 changes: 12 additions & 0 deletions src/sentry/api/endpoints/organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
AI_SUGGESTED_SOLUTION,
ALERTS_MEMBER_WRITE_DEFAULT,
ATTACHMENTS_ROLE_DEFAULT,
AUTOFIX_ENABLED_DEFAULT,
DEBUG_FILES_ROLE_DEFAULT,
EVENTS_MEMBER_ADMIN_DEFAULT,
GITHUB_COMMENT_BOT_DEFAULT,
Expand Down Expand Up @@ -192,6 +193,12 @@
bool,
HIDE_AI_FEATURES_DEFAULT,
),
(
"autofixEnabled",
"sentry:autofix_enabled",
bool,
AUTOFIX_ENABLED_DEFAULT,
),
(
"githubPRBot",
"sentry:github_pr_bot",
Expand Down Expand Up @@ -284,6 +291,7 @@ class OrganizationSerializer(BaseOrganizationSerializer):
isEarlyAdopter = serializers.BooleanField(required=False)
aiSuggestedSolution = serializers.BooleanField(required=False)
hideAiFeatures = serializers.BooleanField(required=False)
autofixEnabled = serializers.BooleanField(required=False)
codecovAccess = serializers.BooleanField(required=False)
githubOpenPRBot = serializers.BooleanField(required=False)
githubNudgeInvite = serializers.BooleanField(required=False)
Expand Down Expand Up @@ -673,6 +681,10 @@ class OrganizationDetailsPutSerializer(serializers.Serializer):
help_text="Specify `true` to hide AI features from the organization.",
required=False,
)
autofixEnabled = serializers.BooleanField(
help_text="Specify `true` to enable Autofix for the organization.",
required=False,
)
codecovAccess = serializers.BooleanField(
help_text="Specify `true` to enable Code Coverage Insights. This feature is only available for organizations on the Team plan and above. Learn more about Codecov [here](/product/codecov/).",
required=False,
Expand Down
5 changes: 5 additions & 0 deletions src/sentry/api/serializers/models/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
AI_SUGGESTED_SOLUTION,
ALERTS_MEMBER_WRITE_DEFAULT,
ATTACHMENTS_ROLE_DEFAULT,
AUTOFIX_ENABLED_DEFAULT,
DATA_CONSENT_DEFAULT,
DEBUG_FILES_ROLE_DEFAULT,
EVENTS_MEMBER_ADMIN_DEFAULT,
Expand Down Expand Up @@ -496,6 +497,7 @@ class DetailedOrganizationSerializerResponse(_DetailedOrganizationSerializerResp
metricsActivateLastForGauges: bool
requiresSso: bool
rollbackEnabled: bool
autofixEnabled: bool


class DetailedOrganizationSerializer(OrganizationSerializer):
Expand Down Expand Up @@ -605,6 +607,9 @@ def serialize( # type: ignore[explicit-override, override]
"hideAiFeatures": bool(
obj.get_option("sentry:hide_ai_features", HIDE_AI_FEATURES_DEFAULT)
),
"autofixEnabled": bool(
obj.get_option("sentry:autofix_enabled", AUTOFIX_ENABLED_DEFAULT)
),
"githubPRBot": bool(
obj.get_option("sentry:github_pr_bot", GITHUB_COMMENT_BOT_DEFAULT)
),
Expand Down
1 change: 1 addition & 0 deletions src/sentry/apidocs/examples/organization_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class OrganizationExamples:
"codecovAccess": False,
"aiSuggestedSolution": True,
"hideAiFeatures": False,
"autofixEnabled": False,
"githubPRBot": True,
"githubOpenPRBot": True,
"githubNudgeInvite": True,
Expand Down
1 change: 1 addition & 0 deletions src/sentry/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ class InsightModules(Enum):
JOIN_REQUESTS_DEFAULT = True
AI_SUGGESTED_SOLUTION = True
HIDE_AI_FEATURES_DEFAULT = False
AUTOFIX_ENABLED_DEFAULT = False
GITHUB_COMMENT_BOT_DEFAULT = True
ISSUE_ALERTS_THREAD_DEFAULT = True
METRIC_ALERTS_THREAD_DEFAULT = True
Expand Down
7 changes: 7 additions & 0 deletions tests/sentry/api/endpoints/test_group_autofix_setup_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def setUp(self):
source_root="sentry/",
)
self.organization.update_option("sentry:gen_ai_consent_v2024_11_14", True)
self.organization.update_option("sentry:autofix_enabled", True)

@patch(
"sentry.api.endpoints.group_autofix_setup_check.get_repos_and_access",
Expand Down Expand Up @@ -82,6 +83,9 @@ def test_successful_setup(self, mock_update_codebase_index, mock_get_repos_and_a
"codebaseIndexing": {
"ok": True,
},
"autofixEnabled": {
"ok": True,
},
}

@with_feature("organizations:autofix-disable-codebase-indexing")
Expand Down Expand Up @@ -137,6 +141,9 @@ def test_successful_with_codebase_indexing_disabled_flag(
"codebaseIndexing": {
"ok": True,
},
"autofixEnabled": {
"ok": True,
},
}


Expand Down
3 changes: 3 additions & 0 deletions tests/sentry/api/endpoints/test_organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ def test_various_options(self, mock_get_repositories):
"allowMemberInvite": False,
"aiSuggestedSolution": False,
"hideAiFeatures": True,
"autofixEnabled": True,
"githubOpenPRBot": False,
"githubNudgeInvite": False,
"githubPRBot": False,
Expand Down Expand Up @@ -772,6 +773,7 @@ def test_various_options(self, mock_get_repositories):
assert options.get("sentry:sampling_mode") == "organization"
assert options.get("sentry:rollback_enabled") is True
assert options.get("sentry:hide_ai_features") is True
assert options.get("sentry:autofix_enabled") is True

# log created
with assume_test_silo_mode_of(AuditLogEntry):
Expand Down Expand Up @@ -802,6 +804,7 @@ def test_various_options(self, mock_get_repositories):
assert "to {}".format(data["alertsMemberWrite"]) in log.data["alertsMemberWrite"]
assert "to {}".format(data["aiSuggestedSolution"]) in log.data["aiSuggestedSolution"]
assert "to {}".format(data["hideAiFeatures"]) in log.data["hideAiFeatures"]
assert "to {}".format(data["autofixEnabled"]) in log.data["autofixEnabled"]
assert "to {}".format(data["githubPRBot"]) in log.data["githubPRBot"]
assert "to {}".format(data["githubOpenPRBot"]) in log.data["githubOpenPRBot"]
assert "to {}".format(data["githubNudgeInvite"]) in log.data["githubNudgeInvite"]
Expand Down
Loading