Skip to content

feat(remote-sync): refactor remote sync process#298

Open
egalvis27 wants to merge 3 commits intofeat/unify-project-system-pathsfrom
refactor/remote-sync-process
Open

feat(remote-sync): refactor remote sync process#298
egalvis27 wants to merge 3 commits intofeat/unify-project-system-pathsfrom
refactor/remote-sync-process

Conversation

@egalvis27
Copy link
Copy Markdown

What is Changed / Added


This PR refactors the remote-sync module to make the flow more explicit, more functional, and easier to maintain.

The previous implementation was centered around a large stateful manager-like structure with multiple responsibilities mixed together. This change breaks that logic into smaller focused modules, clarifies the runtime orchestration layer, and reduces cross-layer coupling between context and apps/main.

What Changed

Remote sync controller refactor

  • Reworked the remote sync orchestration into a dedicated remote-sync-controller module.
  • Split controller responsibilities into smaller units such as:
    • controller state creation
    • status updates
    • aggregated sync status checks
    • reset logic
    • file sync orchestration
    • folder sync orchestration
    • start flow orchestration
  • Simplified the controller API by removing unused surface such as localIsSynced.
  • Updated the controller so runtime dependencies are passed only when startRemoteSync is executed, instead of being stored unnecessarily in the controller factory.

Error handling cleanup

  • Replaced the previous class-based remote sync error handler with a functional implementation.
  • Extracted error classification into a dedicated pure helper.
  • Kept issue creation and logging behavior explicit while reducing branching and duplication.

Contract and boundary cleanup

  • Introduced an explicit remote sync contract for the data returned to the context layer.
  • Added DTO mapping at the application boundary instead of leaking database/entity shapes outside the main process runtime layer.
  • Removed the direct context -> apps/main/remote-sync/service dependency by routing access through a shared remote sync service contract.
  • Updated consumers such as the SQLite remote items generator and the file-overridden subscriber to use that shared boundary.

Naming and structure improvements

  • Replaced legacy manager naming with controller naming across the remote sync slice.
  • Removed obsolete files and renamed test coverage to match the current module structure.
  • Added focused tests for the newly extracted controller helpers so the new file structure is reflected in the test layout.

Behavior fixes

  • Fixed the folder sync pagination path so folder sync uses its own configured fetch limit instead of the file limit.
  • Fixed a type mismatch in SQLiteRemoteItemsGenerator when mapping nullable DTO file types into ServerFile.

@egalvis27 egalvis27 changed the title feat(remote-sync): implement remote sync controller and related funct… feat(remote-sync): refactor remote sync process Apr 6, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant