@davoodmehraban89 / LifeMate / commits / c5b548b
Fork 0

LifeMate — Personal, Family & Learning Companion

fix: stream synthetic SQLite uploads through adb exec-in

Quinn White committed Oct 22, 2026 at 19:46 UTC c5b548bfd534a41aadf147e0c26e3009147cdb20
3 files changed +90 -1
apps/lifemate/tool/test_personal_recovery_android.py
+2 -1
@@ -60,7 +60,8 @@ def binary_adb(serial, remote, data=None):
60 'binary_input_limit')
61 process = None
62 try:
63 - process = subprocess.Popen(['adb', '-s', serial, 'exec-out', remote],
63 + direction = 'exec-in' if data is not None else 'exec-out'
64 + process = subprocess.Popen(['adb', '-s', serial, direction, remote],
65 stdin=subprocess.PIPE if data is not None else subprocess.DEVNULL,
66 stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
67 result, sent = bytearray(), 0
apps/lifemate/tool/test_personal_recovery_android_test.py
+17
@@ -210,6 +210,23 @@ class RecoveryBoundaryTest(unittest.TestCase):
210 with self.assertRaisesRegex(subject.AcceptanceError, 'binary_output_limit'):
211 subject.binary_adb('emulator-5554', 'unused')
212
213 + def test_binary_transport_uses_adb_input_and_output_directions(self):
214 + # Android15 adb commandline.cpp: exec-in copies stdin to device;
215 + # exec-out only copies device bytes to stdout and never consumes stdin.
216 + uploaded = self.directory / 'uploaded-fixture'
217 + real_popen = subprocess.Popen
218 + child_source = ("import sys; from pathlib import Path; "
219 + "mode=sys.argv[1]; "
220 + "Path(sys.argv[2]).write_bytes(sys.stdin.buffer.read()) "
221 + "if mode == 'exec-in' else sys.stdout.buffer.write(b'fictional capture')")
222 + def child(argv, **kwargs):
223 + return real_popen(['python3', '-c', child_source, argv[3], str(uploaded)], **kwargs)
224 + payload = bytes(range(256)) * 32
225 + with patch.object(subject.subprocess, 'Popen', side_effect=child):
226 + self.assertEqual(subject.binary_adb('emulator-5554', 'fixed synthetic command', payload), b'')
227 + self.assertEqual(uploaded.read_bytes(), payload)
228 + self.assertEqual(subject.binary_adb('emulator-5554', 'fixed synthetic command'), b'fictional capture')
229 +
230 def test_failure_receipt_without_device_is_sanitized(self):
231 output = self.directory / 'exports' / 'failed.json'
232 code = subject.main(['--serial', 'physical-phone', '--original-apk', str(self.paths[0]),
docs/audits/evidence/personal-recovery-failed-2026-10-22.json new
+71
@@ -0,0 +1,71 @@
1 +{
2 + "schemaVersion": 1,
3 + "status": "FAILED_ACTUAL_ANDROID_ACCEPTANCE",
4 + "runId": 39841416277,
5 + "sourceCommit": "0f294af4a3d7b53728571bbc63be00b6b264c5eb",
6 + "artifactId": 12454220764,
7 + "artifactZipSha256": "39bd4d42a341406e9976e51f8cb87d20688ed7eeff84620c9a405d4cc1515681",
8 + "rootVerifiedArtifactDigest": true,
9 + "receipt": {
10 + "apks": {
11 + "original": {
12 + "package": "ir.lifeguide.app.device",
13 + "sha256": "c24ff6e75a987945399b0d96129f5d1a72525fa0270f31b0c481f9780f84db8e",
14 + "versionCode": 9,
15 + "versionName": "0.7.2-personal.1"
16 + },
17 + "qaNeverDistribute": {
18 + "package": "ir.lifeguide.app.personal",
19 + "sha256": "89caa1b92334c094af03c8e1a9190f103df3f7d1aea904c0aa861d83134b14a4",
20 + "versionCode": 10,
21 + "versionName": "0.7.2-recovery-qa.10"
22 + },
23 + "upgradeNeverDistribute": {
24 + "package": "ir.lifeguide.app.personal",
25 + "sha256": "969f6748ef53126cd4afd0b84d6dfd2dc5ec7416a94ee03ccbd05922e30d2139",
26 + "versionCode": 11,
27 + "versionName": "0.7.2-recovery-qa.11"
28 + }
29 + },
30 + "canonicalSnapshotSha256": "f64bf8f30e41dc4eddca18629f2ca950839fdb11f489c85889a40500739c06f9",
31 + "certificatesSha256": [
32 + "4ef990d647fc98ac41113d5dbe7ee476ba80bf95b71b5f219b7863fa95263391",
33 + "0a361b66092c8612d00f66120e70256b8e1a7dbc394f42d06ea3fda9da0279af",
34 + "0a361b66092c8612d00f66120e70256b8e1a7dbc394f42d06ea3fda9da0279af"
35 + ],
36 + "checks": {
37 + "allApksAndFreshEmulatorGatedBeforeInstall": "PASS"
38 + },
39 + "counts": {
40 + "local_occurrences": 4,
41 + "local_plans": 4,
42 + "local_profiles": 1,
43 + "local_weekly_slots": 3
44 + },
45 + "currentPhase": "original_seed_and_ordinary_ui",
46 + "errorCode": "binary_adb_timeout",
47 + "limitations": {
48 + "Doze": "UNVERIFIED",
49 + "USB": "UNVERIFIED",
50 + "Windows": "UNVERIFIED",
51 + "distributionApk": "UNVERIFIED",
52 + "originalNotificationsEnabled": "UNVERIFIED",
53 + "ownerData": "UNVERIFIED",
54 + "ownerSigningKey": "UNVERIFIED",
55 + "physicalDevice": "UNVERIFIED",
56 + "powerLossOrFullDisk": "UNVERIFIED",
57 + "reboot": "UNVERIFIED",
58 + "soundOrVibration": "UNVERIFIED"
59 + },
60 + "result": "FAIL",
61 + "schemaVersion": 1,
62 + "syntheticDataOnly": true
63 + },
64 + "diagnosis": {
65 + "officialSource": "https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/android15-release/client/commandline.cpp?format=TEXT",
66 + "httpStatusActuallyObserved": 200,
67 + "sourceObservation": "exec-in copies STDIN_FILENO to device fd; exec-out copies device fd to STDOUT_FILENO only",
68 + "fixScope": "host test transport direction only; no app/data/permission/signing changes",
69 + "regression": "actual subprocess reproduces directional transport; failed with exec-out upload, passed after exec-in upload; seed still requires independent exact-byte readback"
70 + }
71 +}