ARCHITECTURE.md.
Error Tracking
Sentry Error Noise Filtering
The Sentry SDK initialization includes abeforeSend hook and ignoreErrors list that suppress known unactionable error sources — Three.js WebGL traversal crashes occurring entirely in minified code with no source-mapped frames, cross-origin Web Worker construction failures from browser extensions, iOS media element crashes, and jQuery $ injection by extensions. The Three.js filter specifically avoids blanket suppression: it only drops events where all stack frames are anonymous or from the minified bundle. If even one frame has a source-mapped .ts filename, the event is kept for investigation.
Error Tracking & Production Hardening
Sentry captures unhandled exceptions and promise rejections in production, with environment-aware routing (production onworldmonitor.app, preview on *.vercel.app, disabled on localhost and Tauri desktop).
The configuration includes 30+ ignoreErrors patterns that suppress noise from:
- Third-party WebView injections — Twitter, Facebook, and Instagram in-app browsers inject scripts that reference undefined variables (
CONFIG,currentInset) - Browser extensions — Chrome/Firefox extensions that fail
importScriptsor violate CSP policies - WebGL context loss — transient GPU crashes in MapLibre/deck.gl that self-recover
- iOS Safari quirks — IndexedDB connection drops on background tab kills,
NotAllowedErrorfrom autoplay policies - Network transients —
TypeError: Failed to fetch,TypeError: Load failed,TypeError: cancelled - MapLibre internal crashes — null-access in style layers, light, and placement that originate from the map chunk
beforeSend hook provides second-stage filtering: it suppresses single-character error messages (minification artifacts), Importing a module script failed errors from browser extensions (identified by chrome-extension: or moz-extension: in the stack trace), and MapLibre internal null-access crashes when the stack trace originates from map chunk files.
Chunk reload guard — after deployments, users with stale browser tabs may encounter vite:preloadError events when dynamically imported chunks have new content-hash filenames. The guard listens for this event and reloads the page at most once per build, recording the spent reload in sessionStorage (or localStorage where sessionStorage is unavailable). The record is not cleared after a successful boot, so a chunk that fails on every load, such as one blocked by an ad blocker, costs one reload instead of a reload loop. When no storage can keep the record, the guard does not reload at all. The deferred Sentry loader claims failures of its own chunk with preventDefault(), so a blocked Sentry chunk never reloads the page. Long-lived tabs that outlast a later deploy are handled by the stale-bundle check.
Storage quota management — when a device’s localStorage or IndexedDB quota is exhausted (common on mobile Safari with its 5MB limit), a global _storageQuotaExceeded flag disables all further write attempts across both the persistent cache (IndexedDB + localStorage fallback) and the utility saveToStorage() function. The flag is set on the first DOMException with name === 'QuotaExceededError' or code === 22, and prevents cascading errors from repeated failed writes. Read operations continue normally — cached data remains accessible, only new writes are suppressed.
Transactions are sampled at 10% to balance observability with cost. Release tracking (worldmonitor@{version}) enables regression detection across deployments.
Fault Tolerance
External APIs are unreliable. Rate limits, outages, and network errors are inevitable. The system implements circuit breaker patterns to maintain availability.Circuit Breaker Pattern
Each external service is wrapped in a circuit breaker that tracks failures:- New requests return cached data (if available)
- UI shows “temporarily unavailable” status
- No API calls are made (prevents hammering)
Protected Services
RSS feeds use per-feed circuit breakers—one failing feed doesn’t affect others.
Graceful Degradation
When a service enters cooldown:- Cached data continues to display (stale but available)
- Status panel shows service health
- Automatic recovery when cooldown expires
- No user intervention required
System Health Monitoring
The status panel (accessed via the health indicator in the header) provides real-time visibility into data source status and system health.Health Indicator
The header displays a system health badge:
Click the indicator to expand the full status panel.
Data Source Status
The status panel lists all data feeds with their current state:Per-Feed Information
Each feed entry shows:- Source name - The data provider
- Last update - Time since last successful fetch
- Next refresh - Countdown to next scheduled fetch
- Cooldown remaining - Time until circuit breaker resets (if in cooldown)
Why This Matters
External APIs are unreliable. The status panel helps you understand:- Data freshness - Is the news feed current or stale?
- Coverage gaps - Which sources are currently unavailable?
- Recovery timeline - When will failed sources retry?
Data Freshness Tracking
Beyond simple “online/offline” status, the system tracks fine-grained freshness for each data source to indicate data reliability and staleness.Freshness Levels
Source-Specific Thresholds
Each data source has calibrated freshness expectations:Visual Indicators
The status panel displays freshness for each source:- Colored dot indicates freshness level
- Time since update shows exact staleness
- Next refresh countdown shows when data will update
Why This Matters
Understanding data freshness is critical for decision-making:- A “fresh” earthquake feed means recent events are displayed
- A “stale” news feed means you may be missing breaking stories
- A “critical” AIS stream means vessel positions are unreliable
Core vs. Optional Sources
Data sources are classified by their importance to risk assessment:
The Strategic Risk Overview panel adapts its display based on core source availability:
Freshness-Aware Risk Assessment
The composite risk score is adjusted based on data freshness:Service Status Monitoring
The Service Status panel tracks the operational health of external services that WorldMonitor users may depend on.Monitored Services
Status Levels
Why This Matters
External service outages can affect:- AI summarization (OpenRouter outages)
- Deployment pipelines (Vercel, GitHub outages)
- API availability (Cloudflare, AWS outages)
