Repository navigation
Conversation
SDCardWalSyncImpl.syncWal looked the recording up by object in its list, but setDevice() rebuilds that list with new Wal objects every time the device connects. A recording page opened before a reconnect passes the old object, so the lookup found nothing and syncWal returned null. SyncProvider.transferWalToPhone treats any normal return as success, so the page said "Transfer complete" and closed while the audio stayed on the SD card. syncWal now matches by id and storage, as deleteWal does, and runs the transfer and its state changes on the listed entry, which is the one the sync pages read. A recording that is no longer listed throws, so the page shows "Transfer failed" instead of a transfer that never happened. That includes a listing whose start time is estimated from the clock, which gets a new id on every connection. 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.
Approving — the production change is correct and tightly scoped, and it converts a silent false-success into an explicit failure.
- app/lib/services/wals/sdcard_wal_sync.dart — syncWal now resolves the target from _wals by id + storage instead of object identity. Wal has no == override, and setDevice()/start() rebuild _wals with new Wal objects on every connect, so a recording page opened before a reconnect held an object the old lookup could never find; syncWal then returned null and SyncProvider.transferWalToPhone treated the normal return as a completed transfer. The new resolution matches how deleteWal and the setDevice() syncing-re-add already identify wals. The not-found path now throws 'Device recording list changed; go back and try again', and the storage offset, synced status, and final reset consistently use the listed entry (walToSync). I verified both call paths handle the throw: transferWalToPhone (app/lib/providers/sync_provider.dart:1187) rethrows after resetting sync state and releasing the keepAlive, and the row-Sync path goes through _performSync, which surfaces the error state instead of a success.
- app/test/unit/sdcard_custody_sync_test.dart — the two new tests cover exactly the two ends of the contract: a relisted recording (new object, same id) transfers and marks the listed entry synced, and an unlisted recording or a same-id phone copy throws with no card writes and no local adds. The storage discriminator is exercised by the phoneCopy case, which is the subtle half.
- .github/failure-classes/FC-wal-lookup-by-object-misses-rebuilt-list.json — accurate contract write-up that matches the code and points at the new tests as the prevention artifact.
- app/changelog/unreleased/20261019-sd-card-transfer-after-reconnect.json — right user-facing wording for the fixed behavior.
Non-blocking follow-up: ring_storage_sync.dart syncWal (the fileNum == -1 branch of the same dispatcher in wal_syncs.dart) still catches errors, logs, and returns an empty response — the same false-success shape this PR removes on the SD card path. Pre-existing and on a separate storage surface, so better as its own issue/PR than an expansion here.
USER IMPACT: After the device reconnects, Transfer to Phone on an SD card recording actually moves the audio; if the recording is no longer listed, the user now sees a transfer failure instead of a 'Transfer complete' message for a transfer that never happened.
What I'd still want as a reviewer: nothing blocking for this diff; the ring-storage follow-up above is the one open thread.
Automated maintainer review on the maintainers' behalf; the merge decision remains human.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
…pendant is listed again (#22895) FlashPageWalSyncImpl.syncWal looked the recording up by object in its list. That list is rebuilt with new Wal objects when the pendant connects, on every discovery wake and after each sync pass, while the recording page keeps the Wal it was opened with. Since #22417 the relisted recording keeps its id, but the lookup by object still found nothing, so Transfer to Phone failed with "Device recording list changed; go back and try again" for a recording that was still listed. Match by id and storage, as deleteWal and the SD card sync (#22414) do, and run the transfer on the listed entry. A recording that is no longer listed still fails without asking the pendant for audio.
What changed and why
Fixes #22412
On a device that uses the legacy SD card sync (firmware before 3.0.17), if the device disconnects and reconnects while an SD card recording's page is open, Transfer to Phone reads nothing from the card, then shows "Transfer complete! You can now play this recording." and closes the page. The audio is still only on the SD card.
SDCardWalSyncImpl.syncWallooked the recording up with==, andWalhas no==override, so the lookup was by object.setDevice()rebuilds_walswith newWalobjects on every connect, while the page keeps theWalit was opened with. After a reconnect the lookup found nothing andsyncWalreturned null.SyncProvider.transferWalToPhoneignores the result, and the page shows its success message whenever that call returns.syncWalnow matches by id and storage.deleteWalin the same class and the syncing-entry re-add instart()/setDevice()already match by id. The storage check keeps a phone copy of the recording, which can share its id, away from the SD card.syncedstatus and the final reset now use the listed entry (walToSync). Before, they used the caller's object while the progress fields used the listed one. That was harmless while the two were always the same object, but with an id match the listed entry would stay pending after the card was cleared.Device recording list changed; go back and try again, the wording fix(app): stop showing a failed Limitless transfer as complete #22370 uses for the same case on the Limitless sync. The page then shows "Transfer failed: …" instead of reporting a transfer that never happened. This covers a disconnected device (the list is empty). It also covers a listing whose start time is estimated: without a device timestamp (firmware before 3.0.16, or no known firmware version on the connect object),_getMissingWalssetstimerStartto now minus the duration, so the same recording gets a new id on every connection and can't be matched. Going back and opening the refreshed recording transfers it.sync_provider.dartandwal_item_detail_page.dartare unchanged:transferWalToPhonealready rethrows, the page already showstransferFailedMessagefor an error, andSyncProvider.syncWal(a row's Sync or Try again) already turns an error into its error state.Issues #22306, #22363 and #22369 report the same "Transfer complete" symptom in the other device syncs, with fixes in PRs #22307, #22364 and #22370. The four PRs change different files. Until #22307 lands, multi-file recordings also reach this method, and they now show the failure instead of "Transfer complete".
Product invariants affected
app/lib/services/wals/**. The SD card is still cleared only after a complete transfer whose chunks are durable on the phone. The change decides which listed recording is transferred; a recording that isn't listed, or a phone copy, never reaches the device.How it was verified
origin/main(501f906; none of these files changed up to 64b082e):wal_item_detail_page.dart:454-470:_handleTransferToPhonepasseswidget.wal, the object the page was opened with, and showstransferCompleteMessageand pops whenevertransferWalToPhonereturns.sync_provider.dart:1177-1197:transferWalToPhoneignores whatsyncWalreturns.wal_syncs.dart:373-379sends SD card recordings other than the ring's toSDCardWalSyncImpl.syncWal.sdcard_wal_sync.dart:943-947matched with==and returned null.setDevice(:1014-1024, called on connect fromdevice_provider.dart:1095and with null on disconnect from:930) andstart(:232-241) replace_walswith new objects.sdcard_wal_sync.dart:187-193estimatestimerStartfrom the clock when it doesn't use the device timestamp.SDCardWalSyncImpl.syncWaland that no existing test relies on its null return.dart format --language-version=3.0 --line-length 120on the changed Dart files made no changes.mobile-changelog.py validate,check-mobile-changelog.py --base origin/mainandcheck_mobile_ux_contract.pypass.validate_definitionfromscripts/failure-classaccepts the new class, and its scope hint matches tracked files.ci:fullruns the new tests and the full app suite. I wrote both tests to fail onmain, wheresyncWalreturns null for an object it doesn't hold, without reading the card or throwing.Tests
app/test/unit/sdcard_custody_sync_test.dart, using the file's existing fake SD card and fake local sync:a recording opened before a reconnect still transfers the relisted recording: the sync's list is replaced with a newWalfor the same recording, assetDevice()does on reconnect, andsyncWalgets the old object. The audio is saved on the phone, the card is cleared, and the listed entry endssyncedand no longer syncing.a recording the sync does not list fails the transfer and leaves the card untouched: a recording with another id and a phone copy with the same id both throw, and nothing is written to the card or saved.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-wal-lookup-by-object-misses-rebuilt-list.Walobjects on connect while a recording page keeps its own, so a lookup by object misses after a reconnect, andSDCardWalSyncImpl.syncWalreported the miss as a null that the caller reads as success.deleteWaldoes, act on the listed entry, and throw when the recording isn't listed.app/test/unit/sdcard_custody_sync_test.dartrelists the recording before the transfer, and checks that an unlisted recording or a phone copy never touches the card..firstcrash on the unlisted case into the silentreturn null. fix(app): stop showing a failed Limitless transfer as complete #22370 (open) handles the unlisted case on the Limitless sync underFC-drain-stall-completes-silently, whose contract covers protocol stalls rather than this lookup.evidence_prsis empty because this PR is the first one filed under the class.🤖 Generated with Claude Code