Documentation

Resilience & Error Handling

Reliability Architecture • Offline Queuing, Network Partitions & Circuit Breakers


1. Zero Telemetry Loss Philosophy

XTND Vantage was designed under the assumption that networks are unreliable, browser tabs close abruptly, and edge services occasionally degrade. The platform guarantees resilience through five redundant layers:

[Layer 1: Non-blocking In-Memory / IndexedDB Buffer]
                    │
[Layer 2: Browser Keepalive Flags (Survival on Tab Close)]
                    │
[Layer 3: Exponential Backoff & Automatic Retry (1s, 2s, 4s)]
                    │
[Layer 4: Fallback from IndexedDB to In-Memory Adapter]
                    │
[Layer 5: Sentinel Circuit Breakers & P0 Kill-Switches]

2. Handling Network Partitions & Offline Browsers

When a client loses internet connectivity:

  1. writeEvent() continues to succeed with 0ms delay, storing records in the local storage adapter with synced: false.
  2. The periodic sync loop attempts flush(). When fetch() throws a network error, the failure is caught silently, and all events remain securely buffered.
  3. Once the network is restored, the next sync cycle flushes the accumulated backlog in chronological order.
  4. Synced IDs are verified before deletion, preventing double-counting or premature data removal.

3. Tab Closure Survival (keepalive: true)

A frequent failure point in web analytics is the loss of exit events (e.g. page:unload, checkout completions).

  • Vantage HTTP transports configure keepalive: true on all fetch() calls.
  • The browser HTTP stack guarantees delivery in the background even after the window or tab is destroyed.

4. Circuit Breakers Against Cascading Outages

When upstream model providers (OpenAI, Anthropic, Gemini) return 429 Too Many Requests or 503 Service Unavailable:

  • VantageCircuitBreaker tracks consecutive errors.
  • At 5 consecutive failures, the breaker shifts to OPEN.
  • Future requests fail-fast immediately on the client without sending doomed network traffic, saving compute and avoiding rate-limit escalation.
  • Once operational conditions stabilize, a single test probe verifies recovery in HALF_OPEN state before restoring normal operations (CLOSED).