Skip to content

[Bounty proposal] fix(app): legacy SD card sync clears the card after a cancelled or failed download ($50 proposed) #14907

Closed

Description

@singhharsh1708

Product impact

  • Primary loop layer: Capture
  • Involves data loss, failed capture, or broken sync/trust

Describe the bug
On firmware without timestamp markers, SD card sync uses _readStorageBytesToFileLegacy in app/lib/services/wals/sdcard_wal_sync.dart. If saving a chunk fails, or the user cancels mid-download, the chunk loop catches the error, sets hasError and breaks, then returns normally. _syncWal sees that some chunks were downloaded, sends the clear command to the device, and syncWal marks the recording synced.

To Reproduce

  1. Use a device on firmware without timestamp markers, with a recording on the SD card longer than one 180 s chunk.
  2. Start the SD card sync.
  3. Cancel it after the first chunk has saved (or have the phone fail to save a chunk, e.g. out of storage).

Current behavior
The SD card is cleared and the recording shows as synced. Everything after the first chunk only existed in memory, so it is gone.

Expected behavior
A cancelled or failed download leaves the SD card alone and the recording unsynced, so the sync can be retried. The marker path already does this by completing with the error.

Additional context
Reproduced on origin/main with a unit test that streams just over two chunks from a fake device and cancels after the first; the clear command is sent.

Proposing this as a paid bounty ($50, since it loses recorded audio) per the contribution docs, @kodjima33. The fix with tests is in #14899.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions