Skip to main content

Chaos Store

Source: stores/useChaosStore.ts (1.8KB) The useChaosStore is a development-only Zustand store used by the ChaosFab floating action button to inject controlled failures and test system resilience across all layers.

Capabilities


State Shape


Safety Guards

  • The store is only accessible via the (dev)/chaos route
  • The ChaosFab button only renders when DEV is true
  • The (dev) route group is excluded from production builds via app.config.js
  • All chaos actions are logged with [CHAOS] prefix for easy log filtering

Testing Strategy

The Chaos Store enables systematic resilience testing:
  1. Corrupt Database → Verify Nuke and Pave triggers and HealOverlay appears
  2. Kill WebSocket → Verify ConnectionWatchdog (now HydrationSync) triggers resurrection
  3. Clear Sync Token → Verify Amnesia Mode performs full re-sync without data loss
  4. Trigger Resurrection → Verify ConvexClientWrapper correctly destroys old client and creates new one