@davoodmehraban89 / LifeMate / commits / 8b71681
Fork 0

LifeMate — Personal, Family & Learning Companion

test: refuse abnormal SQLite coordination files and document cold capture

Quinn White committed Oct 23, 2026 at 06:38 UTC 8b71681f4013696644280018f6024aef9e1037ec
3 files changed +16 -6
apps/lifemate/tool/test_personal_recovery_android.py
+1 -1
@@ -258,7 +258,7 @@ class Harness:
258 f'if [ -f {journal} ] && [ ! -s {journal} ] && [ ! -e {wal} ] && [ ! -e {shm} ]; '
259 'then printf EMPTY_JOURNAL; else printf SIDECAR; fi; '
260 f'elif [ ! -e {wal} ] && [ ! -e {shm} ]; then printf CLEAN; '
261 - f'elif [ -f {wal} ] && [ ! -s {wal} ]; then '
261 + f'elif [ -f {wal} ] && [ ! -s {wal} ] && ( [ ! -e {shm} ] || [ -f {shm} ] ); then '
262 f'if [ -e {shm} ]; then printf EMPTY_WAL_SHM; else printf EMPTY_WAL; fi; '
263 'else printf SIDECAR; fi')
264 output = self.adb.shell('run-as', package, 'sh', '-c', query).strip()
apps/lifemate/tool/test_personal_recovery_android_test.py
+14 -4
@@ -210,7 +210,7 @@ class RecoveryBoundaryTest(unittest.TestCase):
210 subject.independent_sql(self.directory / 'normalized.sqlite'))
211 self.assertEqual({p: p.read_bytes() for p in before}, before)
212
213 - def test_actual_shell_rejects_unsafe_journal_shapes(self):
213 + def test_actual_shell_rejects_unsafe_sidecar_shapes(self):
214 h = self.make()
215 h.preflight()
216 h.install(subject.ORIGINAL)
@@ -227,7 +227,7 @@ class RecoveryBoundaryTest(unittest.TestCase):
227 capture_output=True, text=True, check=True, timeout=2).stdout
228 return previous_shell(*parts, **kwargs)
229 self.adb.shell = shell
230 - for kind in ('byte', 'directory', 'fifo', 'symlink', 'dangling', 'with_wal', 'with_shm'):
230 + for kind in ('byte', 'directory', 'fifo', 'symlink', 'dangling', 'with_wal', 'with_shm', 'shm_directory', 'shm_fifo', 'wal_dangling', 'shm_dangling'):
231 with self.subTest(kind=kind):
232 if kind == 'byte':
233 journal.write_bytes(b'x')
@@ -240,6 +240,14 @@ class RecoveryBoundaryTest(unittest.TestCase):
240 if kind == 'symlink':
241 target.write_bytes(b'')
242 journal.symlink_to(target if kind == 'symlink' else Path(root) / 'missing')
243 + elif kind in ('shm_directory', 'shm_fifo'):
244 + wal.write_bytes(b'')
245 + if kind == 'shm_directory':
246 + shm.mkdir()
247 + else:
248 + subject.os.mkfifo(shm)
249 + elif kind in ('wal_dangling', 'shm_dangling'):
250 + (wal if kind == 'wal_dangling' else shm).symlink_to(Path(root) / 'missing')
251 else:
252 journal.write_bytes(b'')
253 (wal if kind == 'with_wal' else shm).write_bytes(b'')
@@ -247,10 +255,12 @@ class RecoveryBoundaryTest(unittest.TestCase):
255 h._cold(subject.ORIGINAL)
256 if journal.is_dir():
257 journal.rmdir()
250 - else:
258 + elif journal.exists() or journal.is_symlink():
259 journal.unlink()
260 for extra in (wal, shm):
253 - if extra.exists():
261 + if extra.is_dir():
262 + extra.rmdir()
263 + elif extra.exists() or extra.is_symlink():
264 extra.unlink()
265
266 def test_actual_exited_sqlite_reader_leaves_empty_wal_cache_only(self):
docs/superpowers/plans/2026-10-22-personal-recovery-android-acceptance.md
+1 -1
@@ -12,7 +12,7 @@ The temporary execution environment was replaced before the previous uncommitted
12
13 1. Before any adb mutation, require explicit fictional-emulator acknowledgement, `emulator-N` serial, qemu+SDK hardware/product, API35, and no LifeGuide packages.
14 2. Inspect/signature-verify the exact delivered original APK using immutable baseline hash/certificate/package/code. Install without overwrite; seed only a newly owned, unlaunched install's absent default DB with the B1 closed fictional fixture. No uninstall, clear-data, force-stop, root or source checkpoint.
15 -3. Launch ordinary original app UI, verify fictional profile visible, close normally and confirm process absent. Capture only if WAL/SHM/journal absent before and after, without modifying the source. Normalize only a private host copy, validate B1 snapshot and compare all fields after reopen.
15 +3. Launch ordinary original app UI, verify fictional profile visible, close normally and confirm process absent. Capture only when the same inert sidecar shape holds before and after: no sidecars; regular zero-byte WAL with absent/regular SHM and no journal; or regular zero-byte TRUNCATE journal with no WAL/SHM. Require PID absence both times; reject symlinks, abnormal sidecar types, nonempty WAL/journal, orphan SHM, and journal coexistence with WAL/SHM. Never remove/checkpoint any source file. This bounded amendment follows the actual c5942f4 Android metadata receipt (journal0/WAL+SHM absent), not a new owner-data transfer permission. Normalize only a private host copy, validate B1 snapshot and compare all fields after reopen.
16 4. B1 authenticated in-memory encrypted roundtrip; install never-distributed `.personal` QA code10 alongside. Seed only absent default DB, launch/reopen ordinary UI, compare all fields/IDs and independent SQL. Notifications/OS permission remain OFF; no consent copied.
17 5. Reopen original again, then update only the new QA app with same ephemeral test certificate and code11. Close/reopen both default DBs and compare every record. Test certificate is not an owner key or promise of production upgrades.
18 6. Use file-based UIAutomator dump with owned temporary filename and cleanup; `/dev/tty` was actually broken on the prior API35 run. Screenshots contain fictional records only.