Skip to content

fix: make push resilient on slow uploads and prevent duplicate upload#629

Merged
r0ssing merged 1 commit into
OpenDataEnsemble:devfrom
najuna-brian:fix/desktop-sync
May 7, 2026
Merged

fix: make push resilient on slow uploads and prevent duplicate upload#629
r0ssing merged 1 commit into
OpenDataEnsemble:devfrom
najuna-brian:fix/desktop-sync

Conversation

@najuna-brian
Copy link
Copy Markdown
Contributor

Description

This PR improves Desktop sync reliability for slow or unstable internet connections, especially when observations include attachment files.

Before this change, sync could fail because attachment upload and observation push had fixed client-side timeouts, and retries could re-run expensive attachment upload work even when files had already been uploaded. The UI could also look inconsistent (for example, showing 0 pending queued attachments while still running attachment preflight for observation-referenced files).

This PR makes push more resilient and reduces duplicate work by:

  • removing client-side time limits for attachment upload and observation push phases
  • adding attachment upload de-duplication across retries and app restarts (scoped by profile and repository generation)
  • improving sync phase messaging so users can see what step is currently running
  • treating non-fatal upload warnings as warnings (instead of hard-failing the whole push when no files actually failed)

What changed

  • desktop/src/store/useCustodianStore.ts
    • removed timeout wrappers around:
      • uploadOutboundAttachments(...)
      • syncGateway.push(...)
    • added durable cache key/value handling for uploaded attachment IDs:
      • persisted in localStorage
      • keyed by active profile
      • invalidated by repository generation change
    • filters attachment IDs before upload so already-confirmed IDs are skipped on retry/restart
    • updates push status text to better reflect current phase and count
    • includes upload warning text in sync message when present
    • only throws attachment upload error when failed > 0

Test plan

  • Push observations with many/large attachments on throttled network and verify no client timeout failure.
  • Trigger a retry scenario after attachment phase starts and verify attachments are not re-uploaded unnecessarily.
  • Restart Desktop mid-workflow, retry push, and verify durable de-duplication still prevents duplicate uploads.
  • Confirm status text transitions through expected phases and includes observation count.
  • Confirm non-fatal upload warning does not abort push when failed == 0.
  • Confirm failed upload (failed > 0) still blocks push with clear error.

@najuna-brian najuna-brian changed the title desktop(sync): make push resilient on slow uploads and prevent duplic… fix: make push resilient on slow uploads and prevent duplicate upload May 6, 2026
@najuna-brian najuna-brian requested a review from r0ssing May 7, 2026 11:01
Copy link
Copy Markdown
Contributor

@r0ssing r0ssing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @najuna-brian

@r0ssing r0ssing merged commit 5edf85b into OpenDataEnsemble:dev May 7, 2026
18 of 19 checks passed
@najuna-brian najuna-brian deleted the fix/desktop-sync branch May 7, 2026 11:35
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.

2 participants