Browse Source

enhance: Add specific scheduled event retry policy enhancements to Phase 3

- Added explicit coverage for activeDid-aware retry policy enhancements
- Specified Android DailyNotificationFetchWorker.java modifications for activeDid change detection
- Specified web callback-registry.ts enhancements for authentication refresh
- Added platform policy unification (android 1min→1hour vs web 1sec→1min standardization)
- Added integration with existing circuit breaker and error handling systems

This addresses the gap where scheduled event retry enhancements were only
mentioned at high level but lacked specific implementation steps.
research/notification-plugin-enhancement
Matthew Raymer 19 hours ago
parent
commit
c69640cbb2
  1. 51
      doc/BACKGROUND_DATA_FETCHING_PLAN.md

51
doc/BACKGROUND_DATA_FETCHING_PLAN.md

@ -619,6 +619,11 @@ GET {apiServer}/api/v2/report/offersToPlansOwnedByMe?afterId={jwtId}&beforeId={j
- **Coordinate** existing notification scheduling with TimeSafari PlatformServiceMixin - **Coordinate** existing notification scheduling with TimeSafari PlatformServiceMixin
- **Extend** existing app lifecycle handling with activeDid change detection - **Extend** existing app lifecycle handling with activeDid change detection
- **Enhance** existing state synchronization with identity management - **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 ### 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 - **Implement** DID-based authentication alongside existing callback system
- **Enhance** existing testing with TimeSafari-specific scenarios - **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 ## Success Criteria
- [ ] **Functional Requirements**: API data fetching works reliably in background - [ ] **Functional Requirements**: API data fetching works reliably in background with activeDid awareness
- [ ] **Performance Requirements**: Requests complete within 30 seconds - [ ] **Performance Requirements**: Requests complete within 30 seconds, including authentication refresh
- [ ] **Security Requirements**: Secure credential storage and token management - [ ] **Security Requirements**: ActiveDid-based authentication with token refresh during retries
- [ ] **Reliability Requirements**: Handles network failures and offline scenarios - [ ] **Reliability Requirements**: Enhanced retry policies that handle activeDid changes gracefully
- [ ] **Integration Requirements**: Seamless integration with existing plugin APIs - [ ] **Integration Requirements**: Seamless integration with existing plugin APIs + TimeSafari patterns
- [ ] **Testing Requirements**: Comprehensive test coverage for all platforms - [ ] **Testing Requirements**: Comprehensive test coverage including activeDid change scenarios
- [ ] **Authentication Requirements**: Support both DID-based JWT and Passkey JWANT tokens - [ ] **Authentication Requirements**: DID-based JWT with automatic refresh during scheduled events
- [ ] **Optimization Requirements**: Implement batch processing with sub-100ms delays - [ ] **Optimization Requirements**: Intelligent retry policies based on error type and activeDid state
- [ ] **Logging Requirements**: Structured logging with database persistence for debugging - [ ] **Logging Requirements**: Structured logging with activeDid context and retry state tracking
- [ ] **Cross-Platform Requirements**: Unified SQLite/IndexedDB storage across platforms - [ ] **Cross-Platform Requirements**: Unified activeDid-aware retry and fallback mechanisms
## Risks & Mitigation ## Risks & Mitigation

Loading…
Cancel
Save