diff --git a/src/components/admin/ApprovalTransactionToggle.tsx b/src/components/admin/ApprovalTransactionToggle.tsx index 5c8c2e02..acbd8dac 100644 --- a/src/components/admin/ApprovalTransactionToggle.tsx +++ b/src/components/admin/ApprovalTransactionToggle.tsx @@ -11,11 +11,12 @@ import { Alert, AlertDescription } from '@/components/ui/alert'; * - NEW: Atomic PostgreSQL transaction (true ACID guarantees) */ export function ApprovalTransactionToggle() { - const [useRpcApproval, setUseRpcApproval] = useState(false); + const [useRpcApproval, setUseRpcApproval] = useState(true); useEffect(() => { - // Read feature flag from localStorage - const enabled = localStorage.getItem('use_rpc_approval') === 'true'; + // NEW flow is default (100% rollout) + // Only disabled if explicitly set to 'false' + const enabled = localStorage.getItem('use_rpc_approval') !== 'false'; setUseRpcApproval(enabled); }, []); @@ -35,7 +36,7 @@ export function ApprovalTransactionToggle() { Approval Transaction Mode - Control which approval flow is used for moderation + Atomic Transaction RPC is now the default. Toggle OFF only for emergency rollback. @@ -56,10 +57,10 @@ export function ApprovalTransactionToggle() { {useRpcApproval ? ( - - + + - Atomic Transaction Mode Enabled + Production Mode (100% Rollout) ✓
  • ✅ True ACID transactions
  • ✅ Automatic rollback on errors
  • @@ -69,17 +70,17 @@ export function ApprovalTransactionToggle() { ) : ( - - + + - Legacy Mode Active + Emergency Rollback Mode Active ⚠️
      -
    • ⚠️ Manual rollback logic (error-prone)
    • +
    • ⚠️ Using legacy manual rollback logic
    • ⚠️ Risk of orphaned entities if edge function crashes
    • ⚠️ No true atomicity guarantee
    -

    - Consider enabling Atomic Transaction Mode for improved reliability. +

    + This mode should only be used temporarily if issues are detected with the atomic transaction flow.

    diff --git a/src/lib/moderation/actions.ts b/src/lib/moderation/actions.ts index fee9dcb4..a2574fad 100644 --- a/src/lib/moderation/actions.ts +++ b/src/lib/moderation/actions.ts @@ -178,9 +178,9 @@ export async function approvePhotoSubmission( * @returns Action result */ /** - * Feature flag to enable atomic transaction RPC approval flow. - * Set to true to use the new process-selective-approval-v2 edge function - * that wraps the entire approval in a single PostgreSQL transaction. + * Feature flag: Use new atomic transaction RPC for approvals (v2) + * + * ✅ DEFAULT: NEW atomic transaction flow (100% ROLLOUT) * * Benefits of v2: * - True atomic transactions (all-or-nothing) @@ -188,11 +188,11 @@ export async function approvePhotoSubmission( * - Network-resilient (edge function crash = auto rollback) * - Eliminates orphaned entities * - * To enable: localStorage.setItem('use_rpc_approval', 'true') - * To disable: localStorage.setItem('use_rpc_approval', 'false') + * To disable NEW flow (emergency rollback): localStorage.setItem('use_rpc_approval', 'false') + * To re-enable NEW flow: localStorage.removeItem('use_rpc_approval') */ const USE_RPC_APPROVAL = typeof window !== 'undefined' && - localStorage.getItem('use_rpc_approval') === 'true'; + localStorage.getItem('use_rpc_approval') !== 'false'; export async function approveSubmissionItems( supabase: SupabaseClient,