mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 13:11:12 -05:00
Implement 100% atomic transaction rollout
Update actions.ts and ApprovalTransactionToggle.tsx to default to the new atomic transaction RPC flow. The feature flag can now be used to disable the new flow for emergency rollback.
This commit is contained in:
@@ -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
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Control which approval flow is used for moderation
|
||||
Atomic Transaction RPC is now the default. Toggle OFF only for emergency rollback.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
@@ -56,10 +57,10 @@ export function ApprovalTransactionToggle() {
|
||||
</div>
|
||||
|
||||
{useRpcApproval ? (
|
||||
<Alert>
|
||||
<CheckCircle2 className="h-4 w-4" />
|
||||
<Alert className="border-green-500 bg-green-50 dark:bg-green-950">
|
||||
<CheckCircle2 className="h-4 w-4 text-green-600" />
|
||||
<AlertDescription>
|
||||
<strong>Atomic Transaction Mode Enabled</strong>
|
||||
<strong className="text-green-600">Production Mode (100% Rollout) ✓</strong>
|
||||
<ul className="mt-2 space-y-1 text-sm">
|
||||
<li>✅ True ACID transactions</li>
|
||||
<li>✅ Automatic rollback on errors</li>
|
||||
@@ -69,17 +70,17 @@ export function ApprovalTransactionToggle() {
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
) : (
|
||||
<Alert>
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<Alert className="border-orange-500 bg-orange-50 dark:bg-orange-950">
|
||||
<AlertCircle className="h-4 w-4 text-orange-600" />
|
||||
<AlertDescription>
|
||||
<strong>Legacy Mode Active</strong>
|
||||
<strong className="text-orange-600">Emergency Rollback Mode Active ⚠️</strong>
|
||||
<ul className="mt-2 space-y-1 text-sm">
|
||||
<li>⚠️ Manual rollback logic (error-prone)</li>
|
||||
<li>⚠️ Using legacy manual rollback logic</li>
|
||||
<li>⚠️ Risk of orphaned entities if edge function crashes</li>
|
||||
<li>⚠️ No true atomicity guarantee</li>
|
||||
</ul>
|
||||
<p className="mt-2 font-medium">
|
||||
Consider enabling Atomic Transaction Mode for improved reliability.
|
||||
<p className="mt-2 font-medium text-orange-600">
|
||||
This mode should only be used temporarily if issues are detected with the atomic transaction flow.
|
||||
</p>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
Reference in New Issue
Block a user