feat: implementation of offline-first sync engine poc (#13)#16
Open
rohansaini-02 wants to merge 1 commit into
Open
feat: implementation of offline-first sync engine poc (#13)#16rohansaini-02 wants to merge 1 commit into
rohansaini-02 wants to merge 1 commit into
Conversation
Author
|
When you have a moment, could you please take a look at this PR? I've implemented it as a standalone module so you can verify the logic quickly with: I’d appreciate any feedback or suggestions. |
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
Implementation of a standalone Offline-First Sync Engine Proof of Concept (PoC). This module provides a validated architectural pattern for handling data synchronization in low-connectivity environments without polluting the root repository during the initial project scaffolding phase.
Related Issue
Closes #13
Problem Statement
TAP Buddy users (students in government schools) often operate in areas with intermittent 2G/3G connectivity. Direct API calls frequently fail mid-request, leading to data loss in chat interactions and learning progress tracking. A robust mechanism is needed to persist student data locally and sync it reliably when the connection stabilizes.
Changes Made
poc-sync-engineas a standalone TypeScript package to ensure core logic is independently reviewable.SyncQueueImplementation: Created a persistent-ready FIFO queue to manage local mutations in a deterministic order.SyncManagerDevelopment: Built an orchestrator that monitors network state and triggers queue drainage upon restoration of connectivity.Technical Decisions
SyncManagerto be agnostic of the underlying storage, allowing for a seamless transition from in-memory arrays (PoC) to WatermelonDB/SQLite (Production) in the next phase.poc-sync-engine) to allow reviewers to validate the logic without being blocked by the root-level environment setup.Testing Performed
SyncQueueitem addition, retrieval, and removal.SyncManagercorrectly pauses/resumes drainage based on mocked network events.README.mdmatch the final code implementation.Results
A fully functional, testable synchronization engine that ensures zero data loss. The logic is currently decoupled and ready to be ported into the main React Native application services layer.
Known Limitations
Production integration will require WatermelonDB for native SQLite persistence.
Future Work
(e.g., offline content bundles, voice recordings).
Checklist