Skip to content

fix(app): stop showing a failed Limitless transfer as complete - #22370

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
apoorvdarshan:fix/limitless-transfer-failure
Oct 19, 2026
Merged

kodjima33 merged 2 commits into
BasedHardware:mainfrom
apoorvdarshan:fix/limitless-transfer-failure

Conversation

@apoorvdarshan

Copy link
Copy Markdown
Collaborator

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.syncWal sends flash-page recordings to FlashPageWalSyncImpl.syncWal, which returned null in two failure cases:

  • _syncWal returned 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. syncWal ignored that result.
  • The recording was no longer in its list. The list is rebuilt when the pendant connects and before each sync, so a page opened before that holds an entry the sync no longer lists, and nothing was read from the pendant.

SyncProvider.transferWalToPhone ignores the result and only rethrows errors, and the recording page shows its success message whenever that call returns.

FlashPageWalSyncImpl.syncWal now 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.dart and wal_item_detail_page.dart are 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

  • INV-CAP-1: 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

  • Traced the path on origin/main (9f6da67):
    • wal_item_detail_page.dart:454-470: _handleTransferToPhone shows transferCompleteMessage and pops whenever transferWalToPhone returns.
    • sync_provider.dart:1177-1197: transferWalToPhone ignores what syncWal returns and only rethrows errors.
    • wal_syncs.dart:380-382 sends flash-page recordings to FlashPageWalSyncImpl.syncWal.
    • flash_page_wal_sync.dart:315-316 returns null for an unlisted recording (Wal has no ==, so this is an identity check), and :323-337 returns null whatever _syncWal returned. _syncWal returns 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 from device_provider.dart:1096) and refreshWalsFromDevice (:218-228, called by WalSyncs.syncAll at wal_syncs.dart:332) replace the list with new Wal objects.
  • Checked the other paths that reach this method:
    • Cancel: cancelSync sets _cancelRequested, which the new check reads, so a cancel from the page stays quiet.
    • SyncProvider.syncWal (a row's "Try again" and retrySync) already turns an error into its error state. Flash-page rows never offer it: their retry count stays 0, and failedWal is only set by that same call.
    • After a failed transfer, _refreshWals reads 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 120 made no changes. check_mobile_ux_contract.py, mobile-changelog.py validate and check-mobile-changelog.py pass.
  • I did not run tests locally. CI with ci:full runs the changed tests and the full app suite. I wrote the two updated tests to fail on main, where syncWal returns 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. syncWal now throws, nothing is acknowledged, the recording stays pending and isSyncing is cleared. On main the 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 reaches syncWal as the same false from _syncWal that 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. syncAll already reports classified stalls through SyncProvider._performSync; Transfer to Phone goes through syncWal, which returned null. #22364 proposes FC-device-transfer-failure-reported-as-complete, which lists this file in its scope, but it is not on main yet.

🤖 Generated with Claude Code

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]>
@apoorvdarshan apoorvdarshan added the ci:full Maintainer-granted: run full CI on this fork PR label Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mobile bug fix: clear root cause (failed Limitless transfer reported as success), fixes real issue #22369, scoped diff, tests added, CI green. Merging per confidence gate (5/5).

@kodjima33
kodjima33 merged commit dd04383 into BasedHardware:main Oct 19, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Maintainer-granted: run full CI on this fork PR flutter flutter work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limitless: Transfer to Phone says 'Transfer complete' when the transfer failed

3 participants