Repository navigation
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
The fix itself looks right and well-scoped — nice catch on the root cause, and the changelog entry is accurate. One blocking problem in the new tests:
WatchTransport._state starts as DeviceTransportState.disconnected (watch_transport.dart:17), and disconnect() early-returns at the if (_state == DeviceTransportState.disconnected) guard (lines 126-128) before reaching the new stopRecording() call. So in watch_transport_disconnect_test.dart:
- 'disconnect calls stopRecording...' expects 1, will see 0
- 'AppleWatchDeviceConnection.disconnect delegates...' expects 1, will see 0
- 'disconnect and dispose handle stopRecording errors gracefully' expects 2, will see 1
Only the dispose-only test passes as written. Note the Dart Analyze & Tests check is skipped for this PR, so CI won't catch this — running flutter test test/unit/watch_transport_disconnect_test.dart locally should show the failures.
Two ways to fix (either works):
- Drive the transport through a successful
connect()first (stubisWatchPaired/isWatchReachableon the fake in addition toisWatchSessionSupported), so_stateisconnectedwhendisconnect()is called; or - Move the best-effort
stopRecording()above the state guard indisconnect()— arguably more robust, since we want the watch mic off regardless of the tracked Dart-side state.
Once the tests actually exercise the new path, this should be in good shape. Leaving for human maintainer review after the fixes; no security concerns in this diff.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Thanks for this contribution! Our review requested some changes (see above) and we haven't heard back in a while. If you're still working on it, just push a commit or leave a comment within the next 7 days. To keep the queue healthy we'll close this PR in 14 days if it stays inactive — and it can always be reopened once updates land. Happy to re-review! |
|
Hey @Aj2280 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
Fixes #20780: Forgetting or disconnecting an Apple Watch from Settings invokes
DeviceService._teardownConnection, which disconnects and disposes theWatchTransport. Previously, neitherWatchTransport.disconnect()norWatchTransport.dispose()invokedstopRecording(). Because onlystopRecording()sends the stop message throughWCSessiontoWatchAudioRecorderViewModelon the Watch, the Apple Watch microphone was left continuously recording after being forgotten.This PR:
await stopRecording()toWatchTransport.disconnect().await stopRecording()toWatchTransport.dispose().WatchRecorderHostAPIto enable hermetic testing.app/test/unit/watch_transport_disconnect_test.dartvalidating that bothdisconnect(),dispose(), andAppleWatchDeviceConnection.disconnect()invokestopRecording()and handle communication failures gracefully.Product Invariants Affected
none
Failure Class (fixes)
Failure-Class: none