Repository navigation
fix(app): order offline sync results by recording time - #11064
Conversation
Failure-Class: none
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks @aryanorastar — clean consistency fix. The main conversation stream ( Extracting Looks good from my side — leaving for a human maintainer to approve/merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
@Git-on-my-level thanks for the positive signal earlier — checks remain green on this head. Ready for human maintainer approve/merge whenever convenient. |
kodjima33
left a comment
There was a problem hiding this comment.
Post-sync pointer list sorted by createdAt while the main stream orders by startedAt ?? createdAt, so an older recording uploaded later jumped to the top. Fix aligns both. Test included. 5/5 - merging.
#11134) ## Summary Reverts #11084 (`75e4e1789d`), which added `CaptureController.onRecordingDeviceDisconnected()` and the `DeviceProvider` hook that starts a **phone-mic batch recording whenever the wearable disconnects mid-session**. ## Why **This behaviour was already reviewed and rejected.** #11066 proposed the same phone-side fallback and received `CHANGES_REQUESTED` from the app maintainer: > The tagged issue actually means recording on the device offline when not connected to bluetooth. Right now it does record offline but it breaks sometimes. This PR is not the right fix for this #11066 was closed, and #11078 was opened specifically so a phone-side fallback could be scoped on its own merits. **#11078 is still open and unapproved.** **The PR description did not match its diff.** #11084 is titled "preserve on-device offline batch across BLE disconnect" and its body states it "prevents the phone-mic fallback from triggering". Before #11084 there was no such fallback to prevent: `onRecordingDeviceDisconnected` did not exist and nothing called it, and `_startPhoneMicBatch` was reachable only from user-initiated paths. The PR introduced the feature together with a guard for it; the Implementation section listed neither the new method nor the `device_provider.dart` call site. **The guard does not cover Omi hardware.** It reads: ```dart final bool isOnDeviceOfflineBatchActive = SharedPreferencesUtil().batchModeEnabled && _recordingDevice != null && (_recordingDevice!.type == DeviceType.limitless || _offlineSessionStartSeconds != 0); ``` It consults `batchModeEnabled`, but ring-buffer capture is keyed on firmware (`WalSyncs.isRingBufferFirmware`, 3.0.20+) and is independent of that pref. With batch mode off, an Omi on 3.0.20+ keeps writing to its on-device ring while the phone starts its own mic batch — the same interval is captured twice and syncs as duplicate conversations, plus an unrequested mic activation and the battery cost. #11084 did address the technical review notes from #11066 (`deviceRecord` state, awaited stop hand-off, `deviceSupportsTranscribeLater`). The product objection was not addressed. ## Scope Revert only. #11064 and #11085 from the same batch are left in place — #11064 is a genuine sort fix, and #11085 needs a real fix rather than a revert (its `filterFullySyncedConversations` never releases a WAL retired to `WalStatus.outsideRecoveryWindow` by #10995, so those conversations stay filtered out of the synced list; tracked separately). #7194 remains open on its actual subject: on-device offline recording that works but is flaky across disconnects. ## Verification ``` flutter analyze lib/services/capture/capture_controller.dart lib/utils/batch_recording.dart \ lib/providers/device_provider.dart test/unit/batch_recording_phone_test.dart -> 1 info (unnecessary_import at device_provider.dart:4), confirmed pre-existing on main; 0 new flutter test test/unit/batch_recording_phone_test.dart test/providers/capture_provider_test.dart \ test/providers/sync_provider_fully_synced_conversations_test.dart \ test/unit/synced_conversation_pointer_order_test.dart -> 89 tests, all passed grep shouldFallbackToPhoneOnDeviceDisconnect | onRecordingDeviceDisconnected | isRecordingDuringDeviceDisconnect | _phoneMicBatchStopCompleter -> no matches remain under app/ make preflight -> 11 checks passed ``` Clean revert: no later commit touched `capture_controller.dart`, `batch_recording.dart`, `device_provider.dart`, or `batch_recording_phone_test.dart` between #11084 and `84e4c1828b`. ## Product invariants affected none ## Failure class (fixes) No `fix:` commits; no declaration required. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11134?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Fixes #5859.
The main Conversations stream already orders and groups by recording time
(
startedAt ?? createdAt). The post-offline-sync processed-conversations liststill sorted its pointers by upload/creation time, so an older recording uploaded
the next morning could appear above a newer conversation.
The shared sync-pointer ordering now uses recording time with a creation-time
fallback, keeping the post-sync list consistent with the main conversation stream.
Verification
flutter test test/unit/synced_conversation_pointer_order_test.dartrecording and a missing-
startedAtfallback.Invariants
No product invariants are affected.
Failure-Class: none