@ -619,6 +619,11 @@ GET {apiServer}/api/v2/report/offersToPlansOwnedByMe?afterId={jwtId}&beforeId={j
- **Coordinate** existing notification scheduling with TimeSafari PlatformServiceMixin
- **Extend** existing app lifecycle handling with activeDid change detection
- **Enhance** existing state synchronization with identity management
- **Critical: Enhance retry policies** for activeDid changes:
- **Android** : Modify `DailyNotificationFetchWorker.java` retry logic to detect activeDid changes during retry sequence
- **Web** : Enhance `callback-registry.ts` to refresh authentication before retry attempts
- **Unify** : Standardize retry delays across platforms (Android 1min→1hour vs Web 1sec→1min)
- **Integrate activeDid change detection** into existing circuit breaker and error handling systems
### Phase 4: TimeSafari Integration & Advanced Features
@ -627,18 +632,44 @@ GET {apiServer}/api/v2/report/offersToPlansOwnedByMe?afterId={jwtId}&beforeId={j
- **Implement** DID-based authentication alongside existing callback system
- **Enhance** existing testing with TimeSafari-specific scenarios
## Current Scheduled Event Update Policies
### ✅ **Existing Consistent Policies**
- **Retry Logic** : Exponential backoff with platform-specific limits (Android: 5 retries, Web: 5 retries)
- **Circuit Breaker** : Opens after 5 consecutive failures
- **Fallback Content** : Uses cached/emergency content when all retries fail
- **ETag Updates** : Conditional requests with 304 Not Modified handling
- **Error Classification** : Network/Storage errors retryable, Permission/Config errors not retryable
### ⚠️ **Enhancement Required for TimeSafari Integration**
- **ActiveDid Change Detection** : Handle identity switches during scheduled events
- **Authentication Refresh** : Update JWT tokens for ongoing retry attempts
- **Cache Invalidation** : Clear cached content when activeDid changes
- **Platform Policy Unification** : Standardize retry delays and fallback mechanisms
### **TimeSafari-Aware Update Policy**
```typescript
interface TimeSafariUpdatePolicy extends ContentFetchConfig {
activeDidAwareRetry?: {
maxRetriesDuringActiveDidChange: number; // More retries during identity change
authenticationRefreshDelay: number; // Time to refresh auth before retry
cacheInvalidationOnChange: boolean; // Clear cache when activeDid changes
};
}
```
## Success Criteria
- [ ] **Functional Requirements** : API data fetching works reliably in background
- [ ] **Performance Requirements** : Requests complete within 30 seconds
- [ ] **Security Requirements** : Secure credential storage and token management
- [ ] **Reliability Requirements** : Handles network failures and offline scenarios
- [ ] **Integration Requirements** : Seamless integration with existing plugin APIs
- [ ] **Testing Requirements** : Comprehensive test coverage for all platforms
- [ ] **Authentication Requirements** : Support both DID-based JWT and Passkey JWANT tokens
- [ ] **Optimization Requirements** : Implement batch processing with sub-100ms delays
- [ ] **Logging Requirements** : Structured logging with database persistence for debugging
- [ ] **Cross-Platform Requirements** : Unified SQLite/IndexedDB storage across platforms
- [ ] **Functional Requirements** : API data fetching works reliably in background with activeDid awareness
- [ ] **Performance Requirements** : Requests complete within 30 seconds, including authentication refresh
- [ ] **Security Requirements** : ActiveDid-based authentication with token refresh during retries
- [ ] **Reliability Requirements** : Enhanced retry policies that handle activeDid changes gracefully
- [ ] **Integration Requirements** : Seamless integration with existing plugin APIs + TimeSafari patterns
- [ ] **Testing Requirements** : Comprehensive test coverage including activeDid change scenario s
- [ ] **Authentication Requirements** : DID-based JWT with automatic refresh during scheduled event s
- [ ] **Optimization Requirements** : Intelligent retry policies based on error type and activeDid state
- [ ] **Logging Requirements** : Structured logging with activeDid context and retry state track ing
- [ ] **Cross-Platform Requirements** : Unified activeDid-aware retry and fallback mechanis ms
## Risks & Mitigation