WAGERBABE DOCS
All Stories
2-2-5-graceful-degradationDoneEpic 2.2

Story 2.2.5: Graceful Degradation Strategy

Status: done

Tasks

  • Task 1: Implement DegradationService (AC: #1, #2, #3, #4)
    • 1.1: Create `DegradationService` class with subsystem health checks
    • 1.2: Implement degradation rules mapping (SSE down, Redis down, API slow)
    • 1.3: Add `get_available_features()` method returning feature availability dict
    • 1.4: Integrate with existing health check endpoints (circuit breaker, stale cache)
  • Task 2: Create health dashboard endpoint (AC: #1)
    • 2.1: Create `/health/degradation` endpoint returning subsystem statuses
    • 2.2: Check Redis connectivity with timeout (500ms)
    • 2.3: Check SSE service health via connection manager
    • 2.4: Check Optic Odds API via circuit breaker state
    • 2.5: Check database connection health (1s timeout)
  • Task 3: Implement feature toggle logic (AC: #2, #3, #4)
    • 3.1: Add feature availability checks via DegradationService
    • 3.2: Implement degradation rules for Redis down → database fallback
    • 3.3: Integrate with circuit breaker state for Optic Odds slow detection
    • 3.4: Add "Refreshing..." indicator message for slow API responses
  • Task 4: Create user notification banner endpoint (AC: #5)
    • 4.1: Add `/api/v1/health/status` endpoint for frontend polling
    • 4.2: Return current degraded features and user-friendly messages
    • 4.3: Create frontend `DegradationBanner` component - DEFERRED (frontend)
    • 4.4: Display banner with appropriate styling - DEFERRED (frontend)
  • Task 5: Add monitoring and metrics (Testing)
    • 5.1: Add statistics tracking for degradation events
    • 5.2: Add logging for feature toggles (info/warning level)
    • 5.3: Write unit tests for `DegradationService` logic (36 tests)
    • 5.4: Write E2E tests for health endpoint (23 tests, 2 skipped for server)
    • 5.5: Singleton pattern with global health accessor

Progress

Tasks5/5
Acceptance Criteria0
Total Tasks5