mirror of
https://github.com/supabase/supabase.git
synced 2026-05-17 00:01:24 +08:00
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 -->
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { initLogger } from 'braintrust'
|
|
|
|
const BRAINTRUST_API_KEY = process.env.BRAINTRUST_API_KEY
|
|
const BRAINTRUST_PROJECT_ID = process.env.BRAINTRUST_PROJECT_ID
|
|
|
|
export const IS_TRACING_ENABLED =
|
|
BRAINTRUST_API_KEY !== undefined && BRAINTRUST_PROJECT_ID !== undefined
|
|
|
|
if (IS_TRACING_ENABLED) {
|
|
initLogger({
|
|
apiKey: BRAINTRUST_API_KEY,
|
|
projectId: BRAINTRUST_PROJECT_ID,
|
|
})
|
|
}
|
|
|
|
// Checks compliance flags for tracing and returns true only when all checks pass.
|
|
// Defaults to disabling tracing when states are unknown.
|
|
export function isTracingAllowed({
|
|
orgHasHipaaAddon,
|
|
projectIsSensitive,
|
|
projectRegion,
|
|
}: {
|
|
orgHasHipaaAddon: boolean | undefined
|
|
projectIsSensitive: boolean | null | undefined
|
|
projectRegion: string | undefined
|
|
}) {
|
|
// Disable tracing for EU (or unknown) regions
|
|
if (projectRegion === undefined || projectRegion.startsWith('eu-')) return false
|
|
|
|
// Disable tracing for orgs with an unknown HIPAA addon state
|
|
if (orgHasHipaaAddon === undefined) return false
|
|
|
|
// Disable tracing for projects within a HIPAA-enabled org that are sensitive (or unknown sensitivity)
|
|
if (orgHasHipaaAddon && projectIsSensitive !== false) return false
|
|
|
|
return true
|
|
}
|