Repository navigation
fix(app): stop reporting a failed ring transfer to phone as complete - #22364
Merged
undivisible merged 2 commits intoOct 19, 2026
Merged
undivisible merged 2 commits into
undivisible merged 2 commits into
Conversation
RingStorageSyncImpl.syncWal, which Transfer to Phone uses for recordings on firmware 3.0.20 and later, ignored _syncRing's completion result and caught every exception, returning the same empty response either way. SyncProvider.transferWalToPhone treats any normal return as success, so a transfer that the device ended with an error, that went idle, lost its connection or was refused phone storage showed "Transfer complete" while the unread audio stayed on the pendant. syncWal now marks the recording synced only after a complete transfer and otherwise throws, and it rethrows transfer errors as SDCardWalSyncImpl.syncWal does, so the page shows "Transfer failed". Unadvanced records stay on the device as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
approved these changes
Oct 19, 2026
Git-on-my-level
left a comment
Member
There was a problem hiding this comment.
The production change here is correct and nicely scoped — approving.
- app/lib/services/wals/ring_storage_sync.dart — syncWal now marks WalStatus.synced and reports 100% progress only after _syncRing completes; an incomplete transfer throws before any success signal, and the catch rethrows after the debug log, matching how SDCardWalSyncImpl.syncWal already behaves. Moving listener.onWalUpdated() into finally means listeners also hear about failed transfers — verified it still fires exactly once on success and once on failure.
- Caller safety — I checked every caller of the changed path: SyncProvider.transferWalToPhone (sync_provider.dart:1177) catches, refreshes, and rethrows; _performSync routes the error to SyncStatus.error; WalItemDetailPage._handleTransferToPhone then shows the existing transferFailedMessage. "Transfer complete!" can no longer appear for a transfer that did not finish.
- Device side unchanged — _syncRing still advances the ring only after a validated DONE, so an incomplete transfer keeps the unread records on the pendant for the next sync, exactly as syncAll does.
- app/test/unit/ring_storage_sync_no_advance_test.dart — two new tests drive the real Transfer-to-Phone entry point (WalSyncs.syncWal, fileNum -1) and assert the incomplete-DONE and GATT-error outcomes throw while WalStatus stays miss, no advance happens, and audio that already arrived stays saved; six existing expectations updated to match the new contract, including a receivedDone ? completes : throwsException split. app/test/unit/ring_custody_download_test.dart — three expectations tightened to throwsException. All green on this head (Dart Analyze & Tests, Android JVM Unit Tests, Android Emulator Acceptance).
- .github/failure-classes/FC-device-transfer-failure-reported-as-complete.json follows the existing schema, describes this exact contract accurately, and points at the new tests as prevention artifacts. app/changelog/unreleased/20261019-ring-transfer-failure.json is user-facing and accurate.
- Security: no new inputs, permissions, or data flows; blast radius is the Transfer-to-Phone flow for firmware 3.0.20+ ring recordings, where the previous behavior silently misrepresented data loss as success.
USER IMPACT: "Transfer to Phone" now tells you the transfer failed and keeps the recording listed as on the device when it doesn't finish, instead of showing "Transfer complete!" while your audio stays on the pendant.
Nothing blocking. If the phone-storage-refused path is reachable in the fake harness, a test for it would be a nice follow-up.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
This was referenced Oct 19, 2026
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.
What changed and why
Fixes #22363
On an Omi with firmware 3.0.20 or later (the ring-buffer storage protocol), pressing "Transfer to Phone" on a device recording shows "Transfer complete! You can now play this recording." and closes the page even when the transfer did not finish: the device ended the read with an error, the read went idle, the BLE link dropped, phone storage refused the audio, or the device refused the advance. The unread audio is still on the pendant and the recording is still listed as on the device, but nothing says the transfer failed.
WalSyncs.syncWalsends the ring's recording (fileNum == -1) toRingStorageSyncImpl.syncWal. When_syncRingreturned false, that method skipped marking the recording synced but still reported 100% progress and returned the same emptySyncLocalFilesResponseas a finished transfer. Itscatchalso swallowed every exception from the transfer (no connection, a failed INFO or status read, a listener that could not be set up).SyncProvider.transferWalToPhonetreats any normal return as success, andWalItemDetailPage._handleTransferToPhonethen showstransferCompleteMessageand pops.RingStorageSyncImpl.syncWalmarks the recording synced and reports 100% only after a complete transfer. An incomplete transfer throwsDevice transfer incomplete; recording kept on device, and transfer errors are rethrown after the existing debug log, the waySDCardWalSyncImpl.syncWalalready rethrows. The page shows "Transfer failed: …" through its existing error path.listener.onWalUpdated()moved intofinally, so listeners also hear about a failed transfer, after the download fraction is cleared._syncRingstill advances the ring only after a validated DONE whose records are durable on the phone, and an incomplete transfer keeps the unadvanced records for the next sync, assyncAlldoes. Audio that already arrived stays saved on the phone.A cancelled transfer also throws now, as on the SD card path. The page's Cancel button shows "Transfer cancelled" and closes the page before the transfer ends, so no error appears there.
#22306 (open fix: #22307) has the same symptom on firmware 3.0.17 to 3.0.19, where the recording reached the wrong sync. Here the right sync drops its own result. The two PRs change different files.
Product invariants affected
app/lib/services/wals/**. The ring is still advanced only for records that are durable on the phone, and an incomplete transfer keeps the rest on the device for the next sync. Only what the caller is told changes.How it was verified
origin/main(9f6da67):wal_item_detail_page.dart:454-470showstransferCompleteMessagewhenevertransferWalToPhonereturns, andtransferFailedMessagewhen it throws.sync_provider.dart:1177-1197ignores the return value ofsyncWaland rethrows errors.wal_syncs.dart:373-377sendsfileNum == -1recordings to the ring sync.ring_storage_sync.dart:373-394returned an empty success when_syncRingreturned false or threw._syncRing: it returns true only after a successful advance or when the ring has nothing unread, which stays a success. Both callers ofWalSyncs.syncWalhandle a throw:transferWalToPhonerethrows to the page, andSyncProvider.syncWalsets its existing error state in_performSync.syncWaltransfer incomplete now expect the throw, and that the tests for complete transfers still await normally.dart format --language-version=3.0 --line-length 120with the pinned Flutter SDK on the changed Dart files made no changes..github/scripts/mobile-changelog.py validatepasses.validate_definitionfromscripts/failure-classaccepts the new class, and each of its scope hints matches a tracked file.ci:fullruns the new tests and the full app suite. I wrote the two new tests to fail onmain, wheresyncWalreturns an empty success in both cases.Tests
app/test/unit/ring_storage_sync_no_advance_test.darthas two new tests. They callWalSyncs.syncWal, the entry point Transfer to Phone uses, with the ring's recording (fileNum: -1) and the file's existing fake device and local sync:WalSyncs.syncWal fails a ring transfer that the device ends with an error: DONE carries an error status. The call throws, no advance is sent, the recording stays pending and the audio that arrived is saved on the phone.WalSyncs.syncWal rethrows a ring transfer error instead of returning an empty success: the status read fails. The same error reaches the caller and no read command is sent.The existing tests in that file and in
app/test/unit/ring_custody_download_test.dartthat end asyncWaltransfer incomplete (idle timeout, failed read command, READ_BEGIN or DONE mismatch, DONE error, index save failure, reconnect, stale or mismatched ACK) now also expect the call to throw. The tests for complete transfers still expect it to return and mark the recording synced.UI evidence
UI-Evidence: none -- no layout change: the page reuses its existing "Transfer failed" message, and no simulator or device is available here. The tests above cover the service result the page reads.
Failure class (fixes)
Failure-Class: new
Failure-class transition narrative
New class
FC-device-transfer-failure-reported-as-complete.RingStorageSyncImpl.syncWalignored_syncRing's result and caught every exception, so Transfer to Phone reported success.syncWalmarks the recording synced only after a complete transfer and otherwise throws, rethrowing transfer errors, asSDCardWalSyncImpl.syncWaldoes.ring_storage_sync_no_advance_test.dartdrives this throughWalSyncs.syncWal, and both ring test files assert the throw for each incomplete outcome. The scope hints also cover the other sub-syncs'syncWal, which have the same contract.FC-per-wal-sync-routed-to-non-ownerfor the routing cause on the multi-file path; this class covers a sync that drops its own result.evidence_prsis empty because this PR is the first one filed under the class.🤖 Generated with Claude Code