refactor(appview): decompose FirehoseService into focused classes (#10)
Extract three focused classes to separate concerns in FirehoseService:
- CursorManager: manages firehose cursor persistence in database
- Handles loading/saving cursor state
- Provides rewind utility for safety margin
- CircuitBreaker: implements circuit breaker pattern
- Tracks consecutive operation failures
- Triggers callback when failure threshold exceeded
- Prevents cascading failures
- ReconnectionManager: handles reconnection with exponential backoff
- Implements backoff strategy: baseDelay * 2^(attempt - 1)
- Enforces max attempt limit
- Provides attempt count for monitoring
Benefits:
- Single Responsibility Principle: each class has one well-defined purpose
- Testability: classes can be tested in isolation with unit tests
- Reusability: helper classes can be reused in other services
- Maintainability: easier to understand, modify, and debug
- Monitoring: exposes failure/attempt counts for health checks
FirehoseService now delegates cursor, circuit breaker, and reconnection
concerns to these helper classes while focusing on WebSocket management
and event routing.