Files
supabase/apps/studio/lib/ai/ai-details.ts
Matt Rossman 36ae9beb0c chore(ai): remove DPA signer killswitch for assistant tracing (#45134)
Removes the temporary killswitch added when Braintrust was onboarded as
a subprocessor, to satisfy the 30-day DPA notice obligation. The window
has elapsed and legal has cleared removal.

Drops the `orgIsDpaSigned` check from `isTracingAllowed`, removes the
extra `/platform/organizations/{slug}/documents/dpa-signed` network hop
from `getOrgAIDetails`, and cleans up all call sites and tests.

Closes AI-596

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Simplified AI tracing eligibility logic by removing DPA signing status
checks. Tracing authorization decisions now depend solely on region,
HIPAA addon status, and project sensitivity settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-27 13:53:24 -04:00

60 lines
1.9 KiB
TypeScript

import { subscriptionHasHipaaAddon } from '@/components/interfaces/Billing/Subscription/Subscription.utils'
import { getProjectSettings } from '@/data/config/project-settings-v2-query'
import { checkEntitlement } from '@/data/entitlements/entitlements-query'
import { getOrganizations } from '@/data/organizations/organizations-query'
import { getProjectDetail } from '@/data/projects/project-detail-query'
import { getOrgSubscription } from '@/data/subscriptions/org-subscription-query'
import { getAiOptInLevel } from '@/hooks/misc/useOrgOptedIntoAi'
export const getOrgAIDetails = async ({
orgSlug,
authorization,
}: {
orgSlug: string
authorization: string
}) => {
const headers = {
'Content-Type': 'application/json',
...(authorization && { Authorization: authorization }),
}
const [organizations, subscription, advanceModelAccess] = await Promise.all([
getOrganizations({ headers }),
getOrgSubscription({ orgSlug }, undefined, headers),
checkEntitlement(orgSlug, 'assistant.advance_model', undefined, headers),
])
const selectedOrg = organizations.find((org) => org.slug === orgSlug)
return {
aiOptInLevel: getAiOptInLevel(selectedOrg?.opt_in_tags),
hasAccessToAdvanceModel: advanceModelAccess.hasAccess,
hasHipaaAddon: subscriptionHasHipaaAddon(subscription),
orgId: selectedOrg?.id,
planId: selectedOrg?.plan.id,
}
}
export const getProjectAIDetails = async ({
projectRef,
authorization,
}: {
projectRef: string
authorization: string
}) => {
const headers = {
'Content-Type': 'application/json',
...(authorization && { Authorization: authorization }),
}
const [selectedProject, projectSettings] = await Promise.all([
getProjectDetail({ ref: projectRef }, undefined, headers),
getProjectSettings({ projectRef }, undefined, headers),
])
return {
region: selectedProject?.region,
isSensitive: projectSettings?.is_sensitive,
}
}