feat: implement analytics privacy preservation with differential privacy (#407)#1
Open
sheyman546 wants to merge 19 commits into
Open
feat: implement analytics privacy preservation with differential privacy (#407)#1sheyman546 wants to merge 19 commits into
sheyman546 wants to merge 19 commits into
Conversation
Automatically switch light/dark mode from Android lux readings with hysteresis and debounced consecutive readings, plus a Settings toggle and manual override when the user picks a theme. Co-authored-by: Cursor <cursoragent@cursor.com>
…ormance (rinafcode#403) Replace generic ActivityIndicator spinners with content-aware skeleton screens that match each screen's final UI layout: - CourseViewerSkeleton, QuizSkeleton, SettingsSkeleton, SubscriptionSkeleton, DataGridSkeleton - Updated Suspense fallbacks and component-level loaders in course-viewer, quiz, settings, profile, MobileCourseViewer, SubscriptionManager, AdvancedDataGrid - Fixed duplicate MobileQuizManager declaration bug in app/quiz.tsx - Cleaned up unused imports and orphaned styles - Added 8 new tests in SkeletonScreens.test.tsx Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…nafcode#411) Add sessionRestorationService that detects crashes and restores users to their last active screen on next launch. - New service persists a "session-active" flag to AsyncStorage on launch and clears it on clean shutdown. If the flag survives, the previous session crashed. - Route changes are saved to a snapshot on every navigation so the user can be returned to the exact screen they were on. - crashReportingService calls captureOnCrash() on fatal errors to ensure the snapshot is preserved. - Root layout detects crash on mount and shows an Alert offering to restore the previous session or start fresh. Snapshots older than 1 hour are discarded. - 14 unit tests cover the full lifecycle: begin, save, crash detect, restore, and clean shutdown paths. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…fcode#402) - Add parseSemver to parse semver strings into major/minor/patch - Add shouldInvalidateCache: major/minor bumps invalidate, patch preserves - Add getStoredCacheVersion/setStoredCacheVersion for AsyncStorage persistence - Add handleCacheVersionUpdate: clears AsyncStorage + image cache on breaking change - 20 tests covering all scenarios
…rotocol-for-websocket feat(socket): add protobuf-style binary websocket protocol
…#410) - Add Trie data structure with O(k) insert/search and O(k+n) autocomplete - Replace linear suggestion filter in MobileSearch with module-level Trie - Add 25 unit tests including 10k-item <10ms performance assertion
Add adaptive theme based on ambient light sensor
…eton-loading-states feat: implement contextual skeleton loading states for perceived performance (rinafcode#403)
…h-recovery feat: implement automatic crash recovery with session restoration (rinafcode#411)
…oning-402 feat: implement app content cache versioning with smart updates
Binary protocol
…-autocomplete feat: Trie-based instant autocomplete for search (rinafcode#410)
feat(analytics): implement event sampling and stabilize secure storag…
Add automated performance budget enforcement
…acy (rinafcode#407) - Add differentialPrivacy utility with Laplace and Gaussian noise mechanisms, randomized response for booleans, and sanitizeEventProperties helper - Add PrivacyBudgetManager to track and enforce cumulative epsilon budget per session; events are suppressed when the budget is exhausted - Update MobileAnalyticsService to sanitize numeric/boolean event properties with DP noise before forwarding to the analytics backend - Update AnalyticsProvider to accept privacyConfig and noiseType props - Add 23 unit tests covering all mechanisms and edge cases (23/23 passing)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes rinafcode#407
Implements differential privacy for the mobile analytics pipeline so that numeric and boolean event properties are noise-sanitized before leaving the device.
Changes
New files
src/utils/differentialPrivacy.ts— Laplace and Gaussian noise mechanisms, randomized response for booleans, andsanitizeEventPropertieshelper.src/utils/privacyBudgetManager.ts—PrivacyBudgetManagertracks cumulative ε consumption per session and suppresses events once the budget is exhausted.tests/utils/differentialPrivacy.test.ts— 23 unit tests (23/23 passing).Modified files
src/services/mobileAnalytics.ts—trackEventsanitizes properties with DP noise and checks the budget before forwarding events.src/components/mobile/AnalyticsProvider.tsx— AcceptsprivacyConfigandnoiseTypeprops and forwards them to the service on mount.Privacy guarantees
Testing