Repository navigation
fix(app): stop showing a failed Limitless transfer as complete - #22370
Conversation
FlashPageWalSyncImpl.syncWal returned null both when the recording was no longer in its list and when the flash-page download stopped early (a stall, a lost connection, a failed save on the phone). Transfer to Phone treats any normal return as success, so the page showed "Transfer complete! You can now play this recording." and closed while the audio was still on the pendant. syncWal now throws in both cases, so the page shows "Transfer failed". A user cancel still returns quietly. Audio that was already saved on the phone and acknowledged to the pendant stays saved, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verdict: The production change here is correct and nicely scoped — approving.
Correctness, per file:
- app/lib/services/wals/flash_page_wal_sync.dart — both silent-failure paths in syncWal now throw with user-readable messages: the orphan-WAL guard at line 319 ('Device recording list changed; go back and try again') and the incomplete-download guard at lines 342-344 ('Device transfer incomplete; recording kept on device'). The !_cancelRequested condition correctly keeps a user cancel quiet, since the page has already shown 'Transfer cancelled'. I traced the full caller chain: transferWalToPhone (sync_provider.dart:1190-1193) refreshes and rethrows into the page's existing catch (wal_item_detail_page.dart:465-468), and the background/auto-sync paths go through _performSync's catch (sync_provider.dart:857-880, rethrowOnError=false), which degrades the throw to an error state — syncAll (lines 259-284) is untouched. No caller crashes or regresses.
- app/test/unit/legacy_storage_limitless_seam_test.dart — the failed-durable-save test now asserts the throw plus isSyncing reset, and the new cancelled-transfer test pins the quiet-return contract and the pending status. Good coverage of exactly the two behaviors the diff introduces.
- app/test/unit/local_wal_sync_test.dart — the orphan-WAL group correctly diverges local (null) vs flash-page (throw) with an updated comment explaining why; the expectation flip matches the new guard.
- app/changelog/unreleased/20261019-limitless-transfer-failure.json — matches the established fragment convention and states the user-visible change accurately.
UX: this turns a false 'Transfer complete!' (with page pop, losing the retry context) into the existing localized failure message; retry/resume semantics from the acknowledged start page are unchanged. Blast radius: Limitless Pendant flash-page transfers only; SD-card/ring/phone sync paths are untouched (the sibling storage types are fixed in parallel in #22307/#22364, which touch different files).
USER IMPACT: If a Transfer to Phone from a Limitless Pendant fails or stalls, you now see 'Transfer failed' with the audio kept on the pendant instead of a false 'Transfer complete'.
Remaining wants (non-blocking): a widget-level test of the transfer button showing the failure message would be nice-to-have, and the generic Exception type matches the multi-file sync's wording but a typed exception would help future callers distinguish failure classes.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
What changed and why
Fixes #22369
With a Limitless Pendant, Transfer to Phone on an offline recording showed "Transfer complete! You can now play this recording." and closed the page even when the transfer failed. The audio, or the part that didn't arrive, was still only on the pendant.
WalSyncs.syncWalsends flash-page recordings toFlashPageWalSyncImpl.syncWal, which returned null in two failure cases:_syncWalreturned false: the download stalled before the newest page (the pendant disconnected or stopped sending, or is still recording), or an error ended it, such as a failed save on the phone.syncWalignored that result.SyncProvider.transferWalToPhoneignores the result and only rethrows errors, and the recording page shows its success message whenever that call returns.FlashPageWalSyncImpl.syncWalnow throws in both cases, so the page shows its existing "Transfer failed: …" message:A cancel still returns quietly: the page has already shown "Transfer cancelled" and closed. Nothing else changes. Audio already saved on the phone and acknowledged to the pendant stays saved, the recording stays pending with its start page moved past that part, and pressing Transfer again on the same page resumes from there.
sync_provider.dartandwal_item_detail_page.dartare unchanged.#22307 and #22364 (both open) fix the same symptom for multi-file and ring recordings. The three PRs change different files.
Product invariants affected
app/lib/services/wals/**. Flash pages are still acknowledged to the pendant only after their audio is durably registered on the phone. This change only reports an unfinished transfer as failed; the rest of the audio stays on the pendant as before.How it was verified
origin/main(9f6da67):wal_item_detail_page.dart:454-470:_handleTransferToPhoneshowstransferCompleteMessageand pops whenevertransferWalToPhonereturns.sync_provider.dart:1177-1197:transferWalToPhoneignores whatsyncWalreturns and only rethrows errors.wal_syncs.dart:380-382sends flash-page recordings toFlashPageWalSyncImpl.syncWal.flash_page_wal_sync.dart:315-316returns null for an unlisted recording (Walhas no==, so this is an identity check), and:323-337returns null whatever_syncWalreturned._syncWalreturns false on a stall before the newest page (:678-698), a missing connection (:351-355) and any error, including a failed save on the phone (:699-714).setDevice(:809-821, called on connect fromdevice_provider.dart:1096) andrefreshWalsFromDevice(:218-228, called byWalSyncs.syncAllatwal_syncs.dart:332) replace the list with newWalobjects.cancelSyncsets_cancelRequested, which the new check reads, so a cancel from the page stays quiet.SyncProvider.syncWal(a row's "Try again" andretrySync) already turns an error into its error state. Flash-page rows never offer it: their retry count stays 0, andfailedWalis only set by that same call._refreshWalsreads the cached list (getAllWals→getMissingWals) without rebuilding it, so the same recording stays listed and a retry from the same page resumes.dart format --language-version=3.0 --line-length 120made no changes.check_mobile_ux_contract.py,mobile-changelog.py validateandcheck-mobile-changelog.pypass.ci:fullruns the changed tests and the full app suite. I wrote the two updated tests to fail onmain, wheresyncWalreturns normally in both cases.Tests
app/test/unit/legacy_storage_limitless_seam_test.dart:Limitless: a failed durable save fails the transfer — no ACK, wal stays miss(renamed from… aborts — …): saving the downloaded chunk on the phone fails.syncWalnow throws, nothing is acknowledged, the recording stays pending andisSyncingis cleared. Onmainthe call returns normally.Limitless: a cancelled transfer returns quietly and keeps the wal pending(new): a cancel during the download returns null without an error, the recording stays pending, and the pendant is put back in real-time mode.app/test/unit/local_wal_sync_test.dart:FlashPageWalSyncImpl.syncWal fails when the WAL is not tracked(was… returns null …).No test drives a stall: it takes 60 empty reads 500 ms apart plus a device-status read through
ServiceManager. It reachessyncWalas the samefalsefrom_syncWalthat the save-failure test produces.UI evidence
UI-Evidence: none -- no layout change: the page already has its "Transfer failed" message, and no simulator or device is available here. The tests above cover the result the page reads.
Failure class (fixes)
Failure-Class: FC-drain-stall-completes-silently
Same contract on the per-recording path: a flash-page download that stalled or failed must not be reported as complete.
syncAllalready reports classified stalls throughSyncProvider._performSync; Transfer to Phone goes throughsyncWal, which returned null. #22364 proposesFC-device-transfer-failure-reported-as-complete, which lists this file in its scope, but it is not onmainyet.🤖 Generated with Claude Code