Skip to content

Implement two-way task sync in SupabaseSyncManager #205

Description

@MessiasLima

Description

Premium subscribers can keep tasks in sync across devices. This ticket implements the actual two-way synchronization logic inside SupabaseSyncManager, using the local Room database as one source and Supabase realtime as the other.

Scope

  • In scope: observing local task changes, subscribing to Supabase realtime changes, fetching the latest version from both sources, resolving conflicts by lastUpdatedAt, writing the winning version back to both platforms, and creating missing tasks.
  • Out of scope: UI for sync status, cleanup of old soft-deleted tasks, handling subscription gating (DI handles which implementation is provided).

Acceptance criteria

  • GIVEN SupabaseSyncManager.start() is called
    WHEN the local task table changes
    THEN the updated task is pushed to Supabase
  • GIVEN SupabaseSyncManager.start() is called
    WHEN a Supabase realtime change is received
    THEN the remote task is fetched and merged into the local database
  • GIVEN a task exists on both platforms
    WHEN a change is detected on either side
    THEN the version with the later lastUpdatedAt is written to both the local database and Supabase
  • GIVEN a task exists locally but not in Supabase
    WHEN sync runs
    THEN the task is created in Supabase
  • GIVEN a task exists in Supabase but not locally
    WHEN sync runs
    THEN the task is created in the local database
  • GIVEN a task is marked as deleted (isDeleted = true)
    WHEN sync runs
    THEN the deleted state is propagated to the other platform

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions