File tree Expand file tree Collapse file tree
app/api/organizations/[id]/data-retention Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,10 +77,7 @@ export const GET = withRouteHandler(
7777 }
7878
7979 const isEnterprise = ! isBillingEnabled || ( await isOrganizationOnEnterprisePlan ( organizationId ) )
80- const piiRedactionEnabled = await isFeatureEnabled ( 'pii-redaction' , {
81- userId : session . user . id ,
82- orgId : organizationId ,
83- } )
80+ const piiRedactionEnabled = await isFeatureEnabled ( 'pii-redaction' )
8481 const configured = normalizeConfigured ( org . dataRetentionSettings )
8582 const defaults = enterpriseDefaults ( )
8683
@@ -160,10 +157,7 @@ export const PUT = withRouteHandler(
160157 return NextResponse . json ( { error : 'Organization not found' } , { status : 404 } )
161158 }
162159
163- const piiRedactionEnabled = await isFeatureEnabled ( 'pii-redaction' , {
164- userId : session . user . id ,
165- orgId : organizationId ,
166- } )
160+ const piiRedactionEnabled = await isFeatureEnabled ( 'pii-redaction' )
167161
168162 const current = normalizeConfigured ( currentOrg . dataRetentionSettings )
169163 const merged : DataRetentionSettings = { ...current }
Original file line number Diff line number Diff line change @@ -85,8 +85,9 @@ const FEATURE_FLAGS = {
8585 'pii-redaction' : {
8686 description :
8787 'Redact PII from workflow logs via configurable Data Retention rules (Presidio at the ' +
88- 'logger persist choke point) and expose the Data Retention config surfaces. Gate by org ' +
89- 'for staged rollout.' ,
88+ 'logger persist choke point) and expose the Data Retention config surfaces. Global on/off ' +
89+ 'only — evaluated without user/org context so the persist path and config routes always ' +
90+ 'agree.' ,
9091 fallback : 'PII_REDACTION' ,
9192 } ,
9293} satisfies Record < string , FeatureFlagDefinition >
Original file line number Diff line number Diff line change @@ -602,16 +602,16 @@ export class ExecutionLogger implements IExecutionLoggerService {
602602 ) : Promise < RedactablePayload > {
603603 if ( ! workspaceId ) return payload
604604
605+ if ( ! ( await isFeatureEnabled ( 'pii-redaction' ) ) ) return payload
606+
605607 const [ row ] = await db
606- . select ( { orgId : organization . id , orgSettings : organization . dataRetentionSettings } )
608+ . select ( { orgSettings : organization . dataRetentionSettings } )
607609 . from ( workspace )
608610 . leftJoin ( organization , eq ( organization . id , workspace . organizationId ) )
609611 . where ( eq ( workspace . id , workspaceId ) )
610612 . limit ( 1 )
611613 if ( ! row ) return payload
612614
613- if ( ! ( await isFeatureEnabled ( 'pii-redaction' , { orgId : row . orgId } ) ) ) return payload
614-
615615 // Rules are only writable by enterprise orgs (route-gated), so an enabled
616616 // rule already implies entitlement. We deliberately do NOT re-check
617617 // `isWorkspaceOnEnterprisePlan` here: it returns false on transient lookup
You can’t perform that action at this time.
0 commit comments