Skip to content

Commit 4bec4c8

Browse files
Alex VegaAlex Vega
authored andcommitted
test(app): add authenticated CV1 black-box harness
Add an internal-only 3.0.30 diagnostics client, fixed DFU/export routes, side-by-side Android identity, signed iOS helper, and the exact customer-plane provisioning runbook. Ordinary app builds continue to reject the diagnostic firmware. Tests: blackbox protocol/DFU unit tests; Android and signed iOS physical builds; firmware snapshot and trace exports on both phones.
1 parent 09c90e3 commit 4bec4c8

18 files changed

Lines changed: 1655 additions & 6 deletions

‎app/android/app/build.gradle‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ android {
6565
}
6666
dev {
6767
dimension "flavor-type"
68-
applicationId "com.friend.ios.dev"
69-
resValue "string", "app_name", "Omi Dev"
68+
applicationId "com.friend.ios.dev.blackbox"
69+
resValue "string", "app_name", "Omi Blackbox"
7070
}
7171
}
7272

@@ -145,6 +145,10 @@ android {
145145
debug{
146146
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
147147
minifyEnabled true
148+
firebaseCrashlytics {
149+
// Physical dev builds are local artifacts; never block them on a symbols upload.
150+
mappingFileUploadEnabled false
151+
}
148152
}
149153
}
150154

‎app/android/gradle.properties‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ org.gradle.jvmargs=-Xmx5120M
22
android.useAndroidX=true
33
android.enableJetifier=true
44
android.enableR8=true
5+
# This builtInKotlin flag was added automatically by Flutter migrator
6+
android.builtInKotlin=false
7+
# This newDsl flag was added automatically by Flutter migrator
8+
android.newDsl=false
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# CV1 black-box physical testing
2+
3+
This runbook is for `codex/cv1-blackbox-diagnostics` only. It installs an internal diagnostic firmware and dev apps;
4+
it is not a production or beta release procedure.
5+
6+
## Fixed identities and configuration
7+
8+
- Firmware: `3.0.30+101`, built from the `3.0.29` storage-first/AAD policy lineage.
9+
- Android black-box package: `com.friend.ios.dev.blackbox`. It is installed beside the authenticated `com.friend.ios.dev` app,
10+
whose signing key is not present locally; the original app and its recordings must remain untouched.
11+
- iOS test package: `com.omi.reliability.alexsmacbookpro`, team `6DV84DW2BA`. Updating this exact bundle preserves the signed-in app data and keychain access group.
12+
- Physical Firebase project: `based-hardware`. `based-hardware-dev` is a placeholder on this machine and must never be used for a physical auth test.
13+
- The app admits `3.0.30` to the storage-authoritative live-audio lane only when compiled with
14+
`OMI_BLACKBOX_HARNESS=true`. Ordinary app builds still fail closed for every version except the production test line `3.0.29`.
15+
- Canonical ignored inputs live outside Git at `~/.config/omi-mobile-test`. They include `dev.env`, the generated Envied files,
16+
and both platform Firebase registrations. Never run `flutterfire configure` for this flow. The bootstrap finishes by running
17+
the repository's Android and iOS customer-plane preflights; either failure is a hard stop before building or installing.
18+
19+
Bootstrap from the app directory. The script aborts unless Android JSON, iOS plist, and both Dart platform options all say
20+
`based-hardware`:
21+
22+
```bash
23+
./e2e/scripts/bootstrap_physical_dev_config.sh
24+
flutter config --jdk-dir /opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home
25+
flutter pub get
26+
```
27+
28+
Do not substitute `flutterfire configure`, a generic `flutter run`, the
29+
`based-hardware-dev` Firebase project, a new iOS bundle identifier, or an app
30+
uninstall. Those are the previously observed causes of the auth-success stall,
31+
lost device identity, and provisioning churn. Re-run the bootstrap and the
32+
platform build helper instead; both are idempotent and fail before installation
33+
if the customer-plane identity has drifted.
34+
35+
## Build and update Android without losing auth
36+
37+
```bash
38+
blackbox_apk="$(./e2e/scripts/build_android_blackbox.sh)"
39+
adb -s R5CY70NZW5X install -r "$blackbox_apk"
40+
./e2e/scripts/clone_android_test_identity.sh
41+
adb -s R5CY70NZW5X shell am force-stop com.friend.ios.dev.blackbox
42+
adb -s R5CY70NZW5X shell monkey -p com.friend.ios.dev.blackbox 1
43+
```
44+
45+
The clone copies only the existing auth/pairing preferences and Firebase auth store, never recordings or WAL files, and forces
46+
automatic offline sync off. Confirm the package is `com.friend.ios.dev.blackbox` before testing. Do not uninstall, update, or clear
47+
the original `com.friend.ios.dev` app.
48+
The build helper temporarily selects the workstation debug key that signed the already-authenticated side-by-side package, verifies
49+
the resulting APK certificate, and restores the repository's normal physical-test key selection before returning.
50+
The dev build disables Crashlytics mapping upload locally; it must not depend on the symbols endpoint to produce an APK.
51+
52+
## Build and update the signed iPhone app without losing auth
53+
54+
The personal profile does not contain Omi's production entitlements or companion targets. The checked-in helper builds the dev
55+
Flutter payload without signing, copies it without companion plug-ins, installs the known-good profile, signs every framework and
56+
the app with the same identity, and verifies the result:
57+
58+
```bash
59+
signed_app="$(./e2e/scripts/build_signed_ios_physical_dev.sh)"
60+
xcrun devicectl device install app --device D019FCB0-B857-5C7B-95C7-D28071D0E113 "$signed_app"
61+
```
62+
63+
The resulting app must have all of these properties before installation:
64+
65+
```text
66+
CFBundleIdentifier = com.omi.reliability.alexsmacbookpro
67+
application-identifier = 6DV84DW2BA.com.omi.reliability.alexsmacbookpro
68+
Firebase PROJECT_ID = based-hardware
69+
no PlugIns/ or Watch/ payloads
70+
```
71+
72+
Never stop `/Applications/Omi.app`, `Omi Beta.app`, or the production iPhone
73+
bundle. Install the exact custom bundle in place. iOS may relaunch that custom
74+
bundle for CoreBluetooth restoration; when handing the pendant to Android,
75+
disable iPhone Bluetooth or terminate only the custom dev bundle.
76+
77+
Known-good local shell/profile source:
78+
79+
```text
80+
/private/tmp/omi-ios-storage-first-known-good-auth-20260729.o1Z4dQ/OmiDev-storage-first.app
81+
```
82+
83+
Device identifiers:
84+
85+
```text
86+
Flutter/CoreDevice UDID: 00008110-001E4D681E6B801E
87+
CoreDevice ID: D019FCB0-B857-5C7B-95C7-D28071D0E113
88+
```
89+
90+
Use `xcrun devicectl device install app --device D019FCB0-B857-5C7B-95C7-D28071D0E113 <signed-app>` to update in place.
91+
Do not uninstall the existing custom bundle.
92+
93+
For a locked-screen lab run, copy the fixed-name artifact into the app's Documents directory and launch the exact internal URL
94+
`omi://blackbox/dfu`. The route does not exist unless `OMI_BLACKBOX_HARNESS=true`, accepts no arbitrary path or device identifier,
95+
waits for the already-paired Omi CV1, and uses the same `prepareDFU()`/MCUmgr path as the visible developer screen.
96+
97+
After the pendant reconnects, launch `omi://blackbox/export`. That exact opt-in
98+
route writes `omi-blackbox-export-latest.json` to the app Documents directory.
99+
The export contains the firmware and hardware revisions, pendant counters and
100+
event ring, SD-ring status, and native mobile BLE disconnect/reconnect history.
101+
It accepts no command, file path, or device identifier from the URL.
102+
103+
## Firmware build and DFU
104+
105+
Run the pinned build from the repository root:
106+
107+
```bash
108+
docker run --rm \
109+
-v "$PWD/omi/firmware:/omi/firmware" \
110+
-e CMAKE_PREFIX_PATH=/opt/toolchains \
111+
ghcr.io/zephyrproject-rtos/ci:v0.26.13@sha256:b0ac6334d1926cd0971a0a444f7adc6dd020e88ee3ce865aa070b6475a3ac4eb \
112+
bash /omi/firmware/scripts/ci/build-cv1.sh
113+
```
114+
115+
The OTA artifact is `omi/firmware/v2.9.0/build/dfu_application.zip`. Confirm firmware `3.0.30` after DFU before collecting data.
116+
The artifact flashed for the 2026-08-01 physical run had SHA-256
117+
`38c8d25de638eda065b88d04e4be854ce1bdc07b491a199a4fa453ad1ff12393`.
118+
The fresh pinned-gate rebuild from the final source produced SHA-256
119+
`cbebda3e9fce626fe997b535fa76377f42a66d80d9d12e8048c74fc65057ebf8`.
120+
Record a new hash after every rebuild and never substitute one artifact's hash
121+
for another physical run's evidence.
122+
123+
## Test order and evidence
124+
125+
Only one phone owns the pendant at a time. Use Android first, disable Android Bluetooth before iOS, and reverse that order when
126+
returning to Android.
127+
128+
For each platform:
129+
130+
1. Start a 12-hour pendant trace in Device diagnostics.
131+
2. Verify connected means battery updates and live transcription preview receives spoken TTS.
132+
3. Toggle phone Bluetooth off for 15 seconds, continue TTS, re-enable Bluetooth, and measure reconnect/preview recovery.
133+
4. Leave the app backgrounded and repeat the interruption.
134+
5. Initiate SD sync explicitly; verify live preview remains usable and no unsolicited backlog drain starts merely because the pendant is charging.
135+
6. End a continuous 5-minute speech sample and verify it does not become one-second recordings or multiple conversations without the two-minute boundary.
136+
7. Export Device diagnostics. The JSON includes mobile BLE history, OS identity, pendant snapshot/counters, trace events, and SD ring status.
137+
138+
For Samsung radio testing, `adb shell svc bluetooth disable` can return a
139+
non-zero shell status even after printing `disable: Success`, and the phone may
140+
restore Bluetooth automatically. Do not put the disable command in an
141+
`errexit` script. Start the offline TTS immediately after it, record the actual
142+
GATT disconnect/reconnect timestamps from logcat, and run the enable/recovery
143+
step separately.
144+
145+
The pendant keeps exact cumulative counters for every observed frame, error, and sync operation. High-frequency timeline events are
146+
sampled by event class (1 second to 5 minute minimum spacing, depending on the event) so a sustained failure cannot overwrite hours of
147+
connection history in seconds. Connect/disconnect, negotiated-link, boot, trace-lifecycle, and storage-health transitions remain
148+
available as discrete timeline events.
149+
150+
Capture Android logs with `adb logcat` and iOS logs with `xcrun devicectl device process launch --console`. Record firmware version,
151+
phone OS, wall-clock start/end, initial/final battery, ring unread counts, live-preview recovery time, recording durations, and any
152+
server processing IDs. Never delete pendant or production recordings as part of this diagnostic flow.
153+
154+
## 2026-08-01/02 black-box results
155+
156+
The 3.0.30+101 firmware export was clean: no queue-full, storage-reject,
157+
microphone, dropped-frame, notification, or sync error was recorded. Two
158+
link-setup errors recovered. The steady Android link used a 15 ms interval, MTU
159+
498, 2M PHY, and DLE 251. The firmware artifact SHA-256 is recorded above.
160+
161+
Android physical reconnect evidence from the final scheduler build:
162+
163+
- Bluetooth disconnected at 21:35:56.090 and GATT reconnected at
164+
21:36:19.654, a 23.564-second transport outage.
165+
- Dart reported connected at 21:36:20.050 and began the newest 25-record head
166+
read at 21:36:21.996 (1.946 seconds later).
167+
- The following transfer repaired the immediately preceding 96-record gap;
168+
old history did not run ahead of the live head.
169+
- Preview resumed without a new user connection or app launch. Existing
170+
preview state is preserved when present; an empty preview remains empty until
171+
the server returns its first segment.
172+
- The run exposed an audio-clock/wall-clock mismatch in canonical ownership.
173+
Storage-authoritative completion now uses the configured silence lifecycle
174+
edge as the wall-clock lower bound and retains transcript offsets only as an
175+
additional signal. Focused regression coverage pins both storage and legacy
176+
policies.
177+
- The rerun closed at the exact intended wall-clock window: 27 physical ring
178+
WALs became one canonical replacement with 3,439 frames over 69 seconds
179+
(01:35:39–01:36:47). It contains pre-outage Lima, Bluetooth-off Mike, and
180+
post-reconnect November in that order. Production returned all three.
181+
- Production also appended the canonical transcript beside the original Lima
182+
and November live segments. The client sent `transcript_mode=replace`, but
183+
`/v2/sync-local-files` does not declare that query parameter. Atomic backend
184+
replacement is therefore a release prerequisite; app-side audio durability
185+
is proven, transcript deduplication is not.
186+
187+
iOS physical process-restart evidence from the same shared Dart ownership
188+
code, before the final wall-clock-bound rebuild:
189+
190+
- the custom dev app was killed for 19 seconds and relaunched in place;
191+
- it reclaimed the exact in-progress server owner before opening the socket;
192+
- 46 ring fragments contained 5,342 frames with zero sequence gaps across the
193+
before/down/after interval;
194+
- one 107-second canonical artifact was published, and the production result
195+
contained the three spoken markers in order.
196+
197+
The iOS app must be rebuilt and installed from the helper after every shared
198+
Dart change. A signed app built before the Android boundary fix is stale even
199+
if its native Swift payload is unchanged.
200+
201+
The final shared-Dart iOS build was installed in place from
202+
`/private/tmp/omi-ios-blackbox.OzDVPz/OmiBlackbox.app`. The production process
203+
remained running at its original path and PID throughout. Oscar produced a
204+
live completed conversation. The custom dev process was then terminated at
205+
01:49:46, Papa was spoken during the process-down interval, the app relaunched
206+
at 01:50:01, and Quebec produced a live completed conversation after recovery.
207+
208+
The phone persisted 33 exact contiguous ring ranges covering
209+
`[1724089, 1725811)` with no source-sequence gap across that test. This proves
210+
iOS transport recovery and local durability on the final shared scheduler.
211+
It does **not** prove final semantic parity: Papa remained in durable local
212+
`miss` ranges and was not attached automatically after the backend had already
213+
closed Oscar. Without app-local speech proof, timestamp proximity alone cannot
214+
safely decide whether an offline interval is conversation speech or keyboard/
215+
pocket noise. Release therefore still requires either a real local VAD-backed
216+
ownership signal or an atomic backend canonical replacement/merge contract.
217+
218+
The custom iOS container currently has 936 Documents files accumulated across
219+
the earlier tests, including large historical recordings. That is a credible
220+
cause of the observed slow sync UI and large WAL-manifest work; this run did
221+
not delete user recordings or use container cleanup as a performance fix.
222+
223+
The final Android diagnostic export is stored locally at
224+
`/private/tmp/omi-blackbox-export-20260802.json` (SHA-256
225+
`163101a0104a9195170136bd4f60629cf79687149f464f9341bc77c1dac4c9e0`).
226+
After 20 pendant connections and 2,853 ring reads it reported zero audio queue
227+
full, storage rejection, frame drop, microphone read, SD write rejection, SD
228+
health, sync, or diagnostics-busy errors. Two of 80 link-setup attempts failed
229+
and recovered. The final link remained 15 ms / MTU 498; battery was 93%.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>application-identifier</key>
6+
<string>6DV84DW2BA.com.omi.reliability.alexsmacbookpro</string>
7+
<key>com.apple.developer.team-identifier</key>
8+
<string>6DV84DW2BA</string>
9+
<key>get-task-allow</key>
10+
<true/>
11+
<key>keychain-access-groups</key>
12+
<array>
13+
<string>6DV84DW2BA.com.omi.reliability.alexsmacbookpro</string>
14+
</array>
15+
</dict>
16+
</plist>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
APP_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
5+
CONFIG_DIR="${1:-${HOME}/.config/omi-mobile-test}"
6+
7+
fail() {
8+
echo "physical-dev bootstrap: $*" >&2
9+
exit 1
10+
}
11+
12+
required=(
13+
dev.env
14+
firebase_options_dev.dart
15+
google-services.json
16+
GoogleService-Info.plist
17+
dev_env.g.dart
18+
prod_env.g.dart
19+
)
20+
21+
for name in "${required[@]}"; do
22+
[[ -f "${CONFIG_DIR}/${name}" ]] || fail "missing ${CONFIG_DIR}/${name}"
23+
done
24+
25+
android_project="$(jq -r '.project_info.project_id // empty' "${CONFIG_DIR}/google-services.json")"
26+
ios_project="$(plutil -extract PROJECT_ID raw "${CONFIG_DIR}/GoogleService-Info.plist" 2>/dev/null || true)"
27+
dart_android_project="$(
28+
sed -n '/static const FirebaseOptions android =/,/);/p' "${CONFIG_DIR}/firebase_options_dev.dart" |
29+
sed -n "s/.*projectId: '\([^']*\)'.*/\1/p"
30+
)"
31+
dart_ios_project="$(
32+
sed -n '/static const FirebaseOptions ios =/,/);/p' "${CONFIG_DIR}/firebase_options_dev.dart" |
33+
sed -n "s/.*projectId: '\([^']*\)'.*/\1/p"
34+
)"
35+
36+
for project in "$android_project" "$ios_project" "$dart_android_project" "$dart_ios_project"; do
37+
[[ "$project" == "based-hardware" ]] ||
38+
fail "refusing non-canonical Firebase project '${project:-missing}' (expected based-hardware)"
39+
done
40+
41+
mkdir -p \
42+
"${APP_DIR}/android/app/src/dev" \
43+
"${APP_DIR}/ios/Config/Dev" \
44+
"${APP_DIR}/ios/Runner" \
45+
"${APP_DIR}/lib/env"
46+
47+
cp "${CONFIG_DIR}/dev.env" "${APP_DIR}/.dev.env"
48+
cp "${CONFIG_DIR}/firebase_options_dev.dart" "${APP_DIR}/lib/firebase_options_dev.dart"
49+
android_config_tmp="$(mktemp /private/tmp/omi-google-services.XXXXXX)"
50+
jq '
51+
([.client[] | select(.client_info.android_client_info.package_name == "com.friend.ios.dev")][0]) as $source
52+
| if $source == null then error("canonical com.friend.ios.dev Firebase client is missing")
53+
else .client += [($source | .client_info.android_client_info.package_name = "com.friend.ios.dev.blackbox")]
54+
end
55+
' "${CONFIG_DIR}/google-services.json" > "$android_config_tmp"
56+
mv "$android_config_tmp" "${APP_DIR}/android/app/src/dev/google-services.json"
57+
cp "${CONFIG_DIR}/GoogleService-Info.plist" "${APP_DIR}/ios/Config/Dev/GoogleService-Info.plist"
58+
cp "${CONFIG_DIR}/GoogleService-Info.plist" "${APP_DIR}/ios/Runner/GoogleService-Info.plist"
59+
cp "${CONFIG_DIR}/dev_env.g.dart" "${APP_DIR}/lib/env/dev_env.g.dart"
60+
cp "${CONFIG_DIR}/prod_env.g.dart" "${APP_DIR}/lib/env/prod_env.g.dart"
61+
cp "${APP_DIR}/setup/prebuilt/key.properties" "${APP_DIR}/android/key.properties"
62+
63+
# main.dart imports both option files even in a dev build. This is a compile-only
64+
# stub; physical commands below must always use --flavor dev.
65+
if [[ ! -f "${APP_DIR}/lib/firebase_options_prod.dart" ]]; then
66+
cp "${APP_DIR}/setup/prebuilt/firebase_options.dart" "${APP_DIR}/lib/firebase_options_prod.dart"
67+
fi
68+
69+
"${APP_DIR}/scripts/verify_android_physical_test_auth_config.sh"
70+
"${APP_DIR}/scripts/verify_ios_physical_test_auth_config.sh"
71+
72+
echo "physical-dev bootstrap: canonical based-hardware config installed for Android and iOS dev flavors"

0 commit comments

Comments
 (0)