LifeMate — Personal, Family & Learning Companion
feat/personal-encrypted-recovery
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | # LifeGuide — approved synthetic recovery preparation |
| 2 | |
| 3 | **Scope approved by the owner on 2026-10-21:** prepare option B in ADR0018 and test with fictional data only. No real device/data access, signing-key creation, merge, deployment, publication or deletion. Original installation and certificate baseline remain unchanged. |
| 4 | |
| 5 | ## Acceptance and ownership |
| 6 | |
| 7 | 1. **Coordinator:** supply this contract, integration CLI, atomic file publication, CI and evidence. Worktree `/tmp/lifeguide-recovery-options`, branch `feat/personal-encrypted-recovery`, based on PR43. No client/backend/schema changes in this package. |
| 8 | 2. **Archive implementer:** `scripts/personal_recovery/archive.py` and `scripts/tests/test_recovery_archive.py` only. RED → GREEN for authenticated encryption and hostile input. No shared-file edits. |
| 9 | 3. **Snapshot implementer:** `scripts/personal_recovery/snapshot.py` and `scripts/tests/test_recovery_snapshot.py` only. RED → GREEN against the existing SQLite v1 contract. No shared-file edits. |
| 10 | 4. **Coordinator:** integrate, test full round trip and filesystem failures, document limits, create a small PR. Separate Android acceptance work follows; it must use fresh emulators and synthetic data, never a connected owner phone. |
| 11 | 5. **Independent reviewer:** assess confidentiality/integrity, refusal paths, source preservation and evidence before completion. |
| 12 | |
| 13 | Archive and snapshot implementation may proceed concurrently because file ownership and interfaces are disjoint. Integration and mutations to shared files are sequential. Agents must not commit, push, merge, run live commands or spawn more agents. |
| 14 | |
| 15 | ## Stable interfaces |
| 16 | |
| 17 | `common.py`: `RecoveryError(code: str)` exposes only a safe reason code. `MAX_PAYLOAD_BYTES=8*1024*1024`, `MAX_ROWS=20000`, `SCHEMA_VERSION=1`, `FIXTURE_APPLICATION_ID=0x4C475146`. |
| 18 | |
| 19 | `archive.py`: `seal(payload: bytes, passphrase: str) -> bytes`, `open_archive(archive: bytes, passphrase: str) -> bytes`. Format: magic `b'LGRF\\x01'`, 16-byte random salt, 12-byte random nonce, AES-256-GCM ciphertext+tag. Authenticate the whole header. Scrypt fixed n=32768/r=8/p=1, key32. Passphrase 12+ characters, <=1024 UTF-8 bytes, no normalization. Size/version bounds before expensive work; wrong password/tampering produce one safe error. Never write plaintext, log secrets, fetch data or accept caller-controlled KDF parameters. |
| 20 | |
| 21 | `snapshot.py`: `create_sample_database() -> bytes` returns a valid synthetic SQLite v1 database; `export_fixture(path: Path) -> bytes` opens SQLite read-only and returns canonical UTF-8 JSON; `database_from_snapshot(payload: bytes) -> bytes` validates and reconstructs using fixed DDL in memory. Reject an unmarked source before reading profile/plan content: require `PRAGMA application_id=0x4C475146`, user_version1, whitelisted schema and integrity. The marker is an accident-prevention gate, not authentication or proof of provenance. JSON top-level keys are exactly `format`, `schemaVersion`, `syntheticOnly`, `tables`; format=`LifeGuideSyntheticRecovery`, syntheticOnly=true. Tables use existing column names and JSON row objects; canonical sorting by primary keys. Reject duplicate JSON keys, unknown fields/objects, invalid UUID/date/enum/integer/foreign keys, oversized payload/row counts. Known Android system table `android_metadata(locale TEXT)` may exist but its content is excluded. Preserve all personal profile, plan, weekly-slot and independent occurrence values including archive and completion. Fixture dates in 2024, explicit fictional labels, no phone/email. No source mutation, arbitrary SQL execution, reset or future-schema downgrade. |
| 22 | |
| 23 | CLI: `create-fixture`, `pack`, `restore-fixture`, `demo`; all require `--acknowledge-synthetic-only`. No real-data override, adb or physical-device commands. Password via getpass only. Destination write-once, mode0600, atomic no-overwrite publication; validation completes before output creation. Demo uses a process-local random test password and reports counts/hashes/booleans only; never password or content. Interrupt/space failures must leave source and existing destination untouched. This is a synthetic QA tool, not an owner backup feature. |
| 24 | |
| 25 | ## Verification ledger |
| 26 | |
| 27 | - [x] Archive RED/GREEN and tamper/wrong-password/size/version checks. |
| 28 | - [x] Snapshot RED/GREEN, source hash unchanged, full field/ID round trip and invalid inputs. |
| 29 | - [x] CLI round trip on disk; close/reopen and independent SQL; no overwrite, simulated interrupted/ENOSPC failure, no output before acknowledgement. Actual disk exhaustion/power loss UNVERIFIED. |
| 30 | - [x] Existing Python APK/Android host tests; tracked-secret and naming checks. |
| 31 | - [x] Dedicated host CI39673314234 on exact source29fa2c7 PASS; general CI39673386647 initially pending. No Android acceptance inferred. |
| 32 | - [x] Independent review: FIFO and source-path race reproduced, corrected, both original reproductions refuse; final55 recovery tests PASS. |
| 33 | - [x] PR44 and Persian runbook/evidence. Android/owner data/key/Windows remain UNVERIFIED. |
| 34 | |
| 35 | ## Deferred separate acceptance package |
| 36 | |
| 37 | Use the exact delivered original APK on a fresh emulator with only fictional v1 data; install a never-distributed `.personal` QA app alongside; compare both default databases after close/reopen and a subsequent same-test-key higher-code upgrade. Validate notifications default OFF without transferring consent or alarm state. No owner APK is eligible until stable owner signing and actual consent/local transfer acceptance are resolved. Physical device, Windows/USB, storage exhaustion on phone, OEM sound/Doze/reboot and real-data transfer remain UNVERIFIED unless separately run. |