Commit 51de36c
authored
fix(desktop): macOS bug audit cycle 3 follow-up — Bee audio, conversation cache, installer atomicity, floating bar, WAL sync (#10047)
## macOS bug audit — cycle 3 follow-up (deferred low-severity set)
Follow-up to the merged cycle-3 audit (#10035). Cycle 3 fixed the
high-severity crash/data-loss/leak/security findings and consciously
deferred a set of lower-severity items. This PR completes the deferred
findings that have a clean, hermetically-testable seam — each
re-verified against current `main` before fixing.
### Fixes
1. **Bee audio frame drift (C6)** — `processAudioPacket` popped only the
first ADTS frame per BLE notification; a notification completing two
frames emitted the second one notification late (~64ms/frame,
cumulative) and discarded surplus complete frames on stop. Now drains
every complete frame per notification. Regression test feeds a two-frame
packet and asserts both drain in order.
2. **Conversation optimistic-edit revert (C24)** — the cache-first
`load()` published bare cached rows without overlaying pending
optimistic mutations, so a filter change mid-mutation visually reverted
an in-flight star/title/folder edit. Cache emit now overlays
`pendingMutations` (mirrors the server merge path). Hermetic test
suspends a star mutation and asserts the cache reload keeps it.
3. **Non-atomic app install (C14)** — the DMG install did `removeItem`
then `copyItem`; a copy failure after the remove destroyed the user's
working `/Applications/Omi.app`. `replaceInstalledApp` now stages then
`replaceItemAt`-swaps, leaving the existing install untouched on
failure. Real-FileManager temp-dir tests assert survival on copy failure
+ successful swap.
4. **Floating-bar pill drift (C10)** — `savePreChatCenterIfNeeded`
snapped the draggable pill's restore origin (computed for the
glow-inflated window) using the bare pill size, drifting the recorded
center ~22pt left / 18pt down per rapid re-open cycle. Now stores +
snaps the full restore frame; restore-origin math routes through pure
`FloatingControlBarGeometry` helpers with a round-trip identity test.
5. **WAL sync stuck on auth failure (C1)** — `fetchSyncJobStatus`
swallowed an auth-header failure with `try?` (sending an unauthenticated
GET) and mapped 401 → `.transient`, parking the WAL in a forever-retry.
Now returns a distinct `.unauthorized` (pure `forStatusCode` mapping)
without an unauthenticated request; the reconciler reverts to `.miss`
for re-upload via the authenticated path (poll stays session-preserving,
INV-AUTH-1).
6. **Unbounded WAL retention (C19)** — `cleanupOldWals` was dead code,
so synced audio + metadata grew without bound. Now invoked at the end of
each `syncToCloud`, selecting reclaimable entries via a pure
`WALCloudSyncLogic.cleanupCandidates` (synced-only, past the 7-day
window) using the injected clock.
### Verification
- Hermetic regression tests added for every fix (behavioral where a
production seam exists; pure-function tests for the
mapping/geometry/retention predicates).
- Swift compiles/tests only in CI (no Swift toolchain in this sandbox).
Local static gates green: `check_desktop_test_quality.py`, line-count
ratchet (FloatingControlBarWindow baseline raised with justification),
e2e flow-coverage (AppInstaller added to `desktop-update-relaunch`
covers).
### Product invariants affected
- INV-AUTH-1
- INV-CHAT-1
C1 names INV-AUTH-1 because the WAL status poll is a background,
session-preserving request: on an auth failure it throws `.unauthorized`
and reverts the WAL for re-upload through the authenticated path — it
does not invalidate the Firebase session (that ownership stays with
`AuthSessionCoordinator`). No session-death path changes.
INV-CHAT-1 is named because the C10 pill-drift fix touches
`FloatingControlBarWindow.swift` / `FloatingControlBarGeometry.swift`
(path globs). The change is presentation geometry only — it stores and
snaps the full restore *frame* instead of pairing an inflated origin
with the bare pill size. It does not touch any chat write-path surface:
no `ChatProvider`, kernel journal/projection, floating viewport cursor,
turn identity, or pill projection code changes. The floating bar's chat
continuity contract is unaffected — only where the collapsed pill window
comes to rest on screen.
### Failure class (fixes)
Failure-Class: none
Independent instance fixes across unrelated subsystems (Bluetooth audio,
conversations cache, installer, floating bar, WAL sync); none recurs
against a registered failure class.
### Deferred (not in this PR)
- **C27** BYOK keys → Keychain migration: security-sensitive migration,
unverifiable without a macOS Keychain here; needs a dedicated PR +
on-device proof + sign-off.
- **C8** notch cursor-follow: the pure decision seam is testable, but
the state-desync side effect has a residual on-device gap (verified by
investigation); needs a notched Mac.
- **C5** dormant `AudioSourceManager`: unreachable dead code; the
correct resolution is delete + relocate the still-live `AudioSource`
enum across many files, which needs a local Swift compile.
- **S1** voice-turn watchdog: INV-VOICE-1 reducer logic; needs the macOS
live continuity/voice gauntlet.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RAxLsaxtwVNDTWAZFfJp9q)_
<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10047?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. -->24 files changed
Lines changed: 419 additions & 62 deletions
File tree
- .github/scripts/product_file_line_count_ratchet_baseline
- desktop/macos
- Desktop
- Sources
- Bluetooth/Connections
- FloatingControlBar
- MainWindow/Conversations
- Services/APIClient
- Startup
- WAL
- Tests
- changelog/unreleased
- e2e/flows
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
Lines changed: 17 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
157 | 169 | | |
158 | 170 | | |
159 | 171 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
Lines changed: 24 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
| |||
1301 | 1305 | | |
1302 | 1306 | | |
1303 | 1307 | | |
1304 | | - | |
| 1308 | + | |
1305 | 1309 | | |
1306 | | - | |
| 1310 | + | |
| 1311 | + | |
1307 | 1312 | | |
1308 | 1313 | | |
1309 | 1314 | | |
| |||
1312 | 1317 | | |
1313 | 1318 | | |
1314 | 1319 | | |
1315 | | - | |
1316 | | - | |
1317 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
1318 | 1323 | | |
1319 | 1324 | | |
1320 | 1325 | | |
1321 | 1326 | | |
1322 | 1327 | | |
1323 | | - | |
| 1328 | + | |
1324 | 1329 | | |
1325 | 1330 | | |
1326 | 1331 | | |
| |||
2160 | 2165 | | |
2161 | 2166 | | |
2162 | 2167 | | |
2163 | | - | |
| 2168 | + | |
2164 | 2169 | | |
2165 | 2170 | | |
2166 | 2171 | | |
| |||
4738 | 4743 | | |
4739 | 4744 | | |
4740 | 4745 | | |
4741 | | - | |
| 4746 | + | |
4742 | 4747 | | |
4743 | 4748 | | |
4744 | 4749 | | |
| |||
4763 | 4768 | | |
4764 | 4769 | | |
4765 | 4770 | | |
4766 | | - | |
4767 | | - | |
4768 | | - | |
4769 | | - | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
4770 | 4779 | | |
4771 | | - | |
| 4780 | + | |
4772 | 4781 | | |
4773 | | - | |
| 4782 | + | |
4774 | 4783 | | |
4775 | 4784 | | |
4776 | 4785 | | |
| |||
4789 | 4798 | | |
4790 | 4799 | | |
4791 | 4800 | | |
4792 | | - | |
| 4801 | + | |
4793 | 4802 | | |
4794 | 4803 | | |
4795 | 4804 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
315 | 322 | | |
316 | 323 | | |
317 | 324 | | |
| |||
Lines changed: 42 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
136 | 149 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
158 | 163 | | |
159 | 164 | | |
160 | 165 | | |
| |||
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
| 339 | + | |
334 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
335 | 355 | | |
336 | 356 | | |
337 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 87 | | |
95 | 88 | | |
96 | 89 | | |
97 | | - | |
| 90 | + | |
98 | 91 | | |
99 | | - | |
| 92 | + | |
100 | 93 | | |
101 | 94 | | |
102 | 95 | | |
| |||
110 | 103 | | |
111 | 104 | | |
112 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
113 | 136 | | |
114 | 137 | | |
115 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
127 | 140 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1085 | 1085 | | |
1086 | 1086 | | |
1087 | 1087 | | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1088 | 1093 | | |
1089 | 1094 | | |
1090 | 1095 | | |
| |||
1171 | 1176 | | |
1172 | 1177 | | |
1173 | 1178 | | |
1174 | | - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1175 | 1182 | | |
1176 | | - | |
1177 | | - | |
| 1183 | + | |
1178 | 1184 | | |
1179 | | - | |
| 1185 | + | |
| 1186 | + | |
1180 | 1187 | | |
1181 | 1188 | | |
1182 | 1189 | | |
| |||
0 commit comments