Skip to content

Commit c1b669c

Browse files
[fix] Fix get_organization_seer_consent_by_org_name to only obey UI toggles (#96725)
<!-- Describe your PR here. --> The `get_organization_seer_consent_by_org_name` controls the consent flow for Prevent AI features via the seer-by-sentry GitHub app. We want the consent gated by 2 toggles only. The `Show Generative AI Features` toggle, and the `Enable PR review and test generation` toggle. We were using the `get_seer_org_acknowledgement` function before, but that is not required for this flow. <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent 3dc316e commit c1b669c

File tree

2 files changed

+82
-192
lines changed

2 files changed

+82
-192
lines changed

src/sentry/seer/endpoints/seer_rpc.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
from sentry.api.authentication import AuthenticationSiloLimit, StandardAuthentication
4242
from sentry.api.base import Endpoint, region_silo_endpoint
4343
from sentry.api.endpoints.organization_trace_item_attributes import as_attribute_key
44-
from sentry.constants import ENABLE_PR_REVIEW_TEST_GENERATION_DEFAULT, ObjectStatus
44+
from sentry.constants import (
45+
ENABLE_PR_REVIEW_TEST_GENERATION_DEFAULT,
46+
HIDE_AI_FEATURES_DEFAULT,
47+
ObjectStatus,
48+
)
4549
from sentry.exceptions import InvalidSearchQuery
4650
from sentry.hybridcloud.rpc.service import RpcAuthenticationSetupException, RpcResolutionException
4751
from sentry.hybridcloud.rpc.sig import SerializableFunctionValueException
@@ -229,18 +233,16 @@ def get_organization_seer_consent_by_org_name(
229233
for org_integration in org_integrations:
230234
try:
231235
org = Organization.objects.get(id=org_integration.organization_id)
232-
seer_org_acknowledgement = get_seer_org_acknowledgement(org_id=org.id)
233-
github_extension_enabled = org.id in options.get("github-extension.enabled-orgs")
236+
237+
hide_ai_features = org.get_option("sentry:hide_ai_features", HIDE_AI_FEATURES_DEFAULT)
234238
pr_review_test_generation_enabled = bool(
235239
org.get_option(
236240
"sentry:enable_pr_review_test_generation",
237241
ENABLE_PR_REVIEW_TEST_GENERATION_DEFAULT,
238242
)
239243
)
240244

241-
if (
242-
seer_org_acknowledgement or github_extension_enabled
243-
) and pr_review_test_generation_enabled:
245+
if not hide_ai_features and pr_review_test_generation_enabled:
244246
return {"consent": True}
245247
except Organization.DoesNotExist:
246248
continue

0 commit comments

Comments
 (0)