Skip to content

Commit

Permalink
feat(ai): Hide Ai features organization option (#80471)
Browse files Browse the repository at this point in the history
Introduce a new AI organization option that will disable all GenAI
features.

![CleanShot 2024-11-08 at 11 11
46@2x](https://github.com/user-attachments/assets/790a4eeb-873f-44ed-9eb8-5db804cc4b15)
  • Loading branch information
jennmueng authored Nov 11, 2024
1 parent 066c56d commit 274136a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
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 @@ -48,6 +48,7 @@
DEBUG_FILES_ROLE_DEFAULT,
EVENTS_MEMBER_ADMIN_DEFAULT,
GITHUB_COMMENT_BOT_DEFAULT,
HIDE_AI_FEATURES_DEFAULT,
ISSUE_ALERTS_THREAD_DEFAULT,
JOIN_REQUESTS_DEFAULT,
LEGACY_RATE_LIMIT_OPTIONS,
Expand Down Expand Up @@ -185,6 +186,12 @@
bool,
AI_SUGGESTED_SOLUTION,
),
(
"hideAiFeatures",
"sentry:hide_ai_features",
bool,
HIDE_AI_FEATURES_DEFAULT,
),
(
"githubPRBot",
"sentry:github_pr_bot",
Expand Down Expand Up @@ -276,6 +283,7 @@ class OrganizationSerializer(BaseOrganizationSerializer):
scrapeJavaScript = serializers.BooleanField(required=False)
isEarlyAdopter = serializers.BooleanField(required=False)
aiSuggestedSolution = serializers.BooleanField(required=False)
hideAiFeatures = serializers.BooleanField(required=False)
codecovAccess = serializers.BooleanField(required=False)
githubOpenPRBot = serializers.BooleanField(required=False)
githubNudgeInvite = serializers.BooleanField(required=False)
Expand Down Expand Up @@ -661,6 +669,10 @@ class OrganizationDetailsPutSerializer(serializers.Serializer):
help_text="Specify `true` to opt-in to [AI Suggested Solution](/product/issues/issue-details/ai-suggested-solution/) to get AI help on how to solve an issue.",
required=False,
)
hideAiFeatures = serializers.BooleanField(
help_text="Specify `true` to hide AI features from 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 @@ -37,6 +37,7 @@
DEBUG_FILES_ROLE_DEFAULT,
EVENTS_MEMBER_ADMIN_DEFAULT,
GITHUB_COMMENT_BOT_DEFAULT,
HIDE_AI_FEATURES_DEFAULT,
ISSUE_ALERTS_THREAD_DEFAULT,
JOIN_REQUESTS_DEFAULT,
METRIC_ALERTS_THREAD_DEFAULT,
Expand Down Expand Up @@ -482,6 +483,7 @@ class DetailedOrganizationSerializerResponse(_DetailedOrganizationSerializerResp
onboardingTasks: list[OnboardingTasksSerializerResponse]
codecovAccess: bool
aiSuggestedSolution: bool
hideAiFeatures: bool
githubPRBot: bool
githubOpenPRBot: bool
githubNudgeInvite: bool
Expand Down Expand Up @@ -600,6 +602,9 @@ def serialize( # type: ignore[explicit-override, override]
"aiSuggestedSolution": bool(
obj.get_option("sentry:ai_suggested_solution", AI_SUGGESTED_SOLUTION)
),
"hideAiFeatures": bool(
obj.get_option("sentry:hide_ai_features", HIDE_AI_FEATURES_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 @@ -311,6 +311,7 @@ class OrganizationExamples:
"relayPiiConfig": None,
"codecovAccess": False,
"aiSuggestedSolution": True,
"hideAiFeatures": 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 @@ -707,6 +707,7 @@ class InsightModules(Enum):
TRUSTED_RELAYS_DEFAULT = None
JOIN_REQUESTS_DEFAULT = True
AI_SUGGESTED_SOLUTION = True
HIDE_AI_FEATURES_DEFAULT = False
GITHUB_COMMENT_BOT_DEFAULT = True
ISSUE_ALERTS_THREAD_DEFAULT = True
METRIC_ALERTS_THREAD_DEFAULT = 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 @@ -704,6 +704,7 @@ def test_various_options(self, mock_get_repositories):
"allowSuperuserAccess": False,
"allowMemberInvite": False,
"aiSuggestedSolution": False,
"hideAiFeatures": True,
"githubOpenPRBot": False,
"githubNudgeInvite": False,
"githubPRBot": False,
Expand Down Expand Up @@ -770,6 +771,7 @@ def test_various_options(self, mock_get_repositories):
assert options.get("sentry:target_sample_rate") == 0.1
assert options.get("sentry:sampling_mode") == "organization"
assert options.get("sentry:rollback_enabled") is True
assert options.get("sentry:hide_ai_features") is True

# log created
with assume_test_silo_mode_of(AuditLogEntry):
Expand Down Expand Up @@ -799,6 +801,7 @@ def test_various_options(self, mock_get_repositories):
assert "to {}".format(data["eventsMemberAdmin"]) in log.data["eventsMemberAdmin"]
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["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

0 comments on commit 274136a

Please sign in to comment.