LifeMate — Personal, Family & Learning Companion
test: isolate never-distributed Android recovery QA build
Quinn White committed
Oct 22, 2026 at 06:13 UTC
98070d99f14ba5041958ac718cd610fa7e1edfdc
5 files changed
+81
-5
apps/lifemate/android/app/build.gradle.kts
+25
-4
@@ -12,11 +12,25 @@ plugins {
12
val releaseRequested = gradle.startParameter.taskNames.any { it.contains("release", ignoreCase = true) }
13
// A separate, debug-only device edition. The published online identity stays fixed.
14
val devicePlannerOnly = providers.gradleProperty("lifeguideDevicePlanner").orNull == "true"
15
+// Never-distributed synthetic acceptance identity, not a replacement user APK.
16
+val personalRecoveryQa = providers.gradleProperty("lifeguidePersonalRecoveryQa").orNull == "true"
17
val requestedTasks = gradle.startParameter.taskNames.map { it.substringAfterLast(':').lowercase() }
18
val assembling = requestedTasks.any { it.startsWith("assemble") || it.startsWith("bundle") }
19
val decodedDefines = providers.gradleProperty("dart-defines").orNull.orEmpty()
20
.split(',').filter { it.isNotBlank() }.map { String(Base64.getDecoder().decode(it)) }
21
val standaloneDefine = decodedDefines.contains("LIFEGUIDE_STANDALONE=true")
22
+val recoveryDefine = decodedDefines.contains("LIFEGUIDE_PERSONAL_RECOVERY_QA=true")
23
+val dartTarget = providers.gradleProperty("target").orNull.orEmpty().replace('\\', '/')
24
+val recoveryTarget = dartTarget.endsWith("tool/personal_recovery_fixture.dart")
25
+if (personalRecoveryQa && !devicePlannerOnly) {
26
+ throw GradleException("Synthetic recovery QA requires the isolated device planner.")
27
+}
28
+if (assembling && personalRecoveryQa && !(standaloneDefine && recoveryDefine && recoveryTarget)) {
29
+ throw GradleException("Synthetic recovery QA requires its matching defines and entry point.")
30
+}
31
+if (assembling && !personalRecoveryQa && (recoveryDefine || recoveryTarget)) {
32
+ throw GradleException("Recovery fixtures cannot be packaged as a user application.")
33
+}
34
if (devicePlannerOnly) {
35
if (requestedTasks.any { it.contains("release") || it.contains("profile") || it == "assemble" || it == "bundle" }) {
36
throw GradleException("The independent device planner is a debug-only initial edition.")
@@ -24,8 +38,7 @@ if (devicePlannerOnly) {
38
if (assembling && !standaloneDefine) {
39
throw GradleException("Device planner builds require the matching LIFEGUIDE_STANDALONE define.")
40
}
27
- val target = providers.gradleProperty("target").orNull.orEmpty().replace('\\', '/')
28
- if (assembling && !(target.endsWith("lib/standalone_main.dart") || target.endsWith("tool/standalone_acceptance_fixture.dart"))) {
41
+ if (assembling && !(dartTarget.endsWith("lib/standalone_main.dart") || dartTarget.endsWith("tool/standalone_acceptance_fixture.dart") || (personalRecoveryQa && recoveryTarget))) {
42
throw GradleException("The device edition requires its isolated Dart entry point.")
43
}
44
} else if (assembling && standaloneDefine) {
@@ -65,7 +78,7 @@ android {
78
ndkVersion = flutter.ndkVersion
79
buildFeatures { buildConfig = true }
80
if (devicePlannerOnly) {
68
- sourceSets.getByName("debug").manifest.srcFile("src/devicePlanner/AndroidManifest.xml")
81
+ sourceSets.getByName("debug").manifest.srcFile(if (personalRecoveryQa) "src/recoveryQa/AndroidManifest.xml" else "src/devicePlanner/AndroidManifest.xml")
82
}
83
84
compileOptions {
@@ -75,8 +88,13 @@ android {
88
89
defaultConfig {
90
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
78
- applicationId = if (devicePlannerOnly) "ir.lifeguide.app.device" else "ir.lifeguide.app"
91
+ applicationId = when {
92
+ personalRecoveryQa -> "ir.lifeguide.app.personal"
93
+ devicePlannerOnly -> "ir.lifeguide.app.device"
94
+ else -> "ir.lifeguide.app"
95
+ }
96
buildConfigField("boolean", "DEVICE_PLANNER_ONLY", devicePlannerOnly.toString())
97
+ buildConfigField("boolean", "PERSONAL_RECOVERY_QA", personalRecoveryQa.toString())
98
// You can update the following values to match your application needs.
99
// For more information, see: https://flutter.dev/to/review-gradle-config.
100
minSdk = flutter.minSdkVersion
@@ -87,6 +105,9 @@ android {
105
// flag during build.
106
versionCode = flutter.versionCode
107
versionName = flutter.versionName
108
+ if (assembling && personalRecoveryQa && (flutter.versionCode !in 10..11 || flutter.versionName != "0.7.2-recovery-qa.${flutter.versionCode}")) {
109
+ throw GradleException("Only private synthetic recovery QA versions 10 and 11 are allowed.")
110
+ }
111
}
112
113
signingConfigs {
apps/lifemate/android/app/src/main/kotlin/ir/lifeguide/app/DevicePlannerReminders.kt
+3
-1
@@ -22,7 +22,9 @@ internal object DevicePlannerReminders {
22
private const val ENABLED = "enabled"
23
@Volatile private var choiceFailedClosed = false
24
25
- fun supported(c: Context) = BuildConfig.DEVICE_PLANNER_ONLY && c.packageName == "ir.lifeguide.app.device"
25
+ fun supported(c: Context) = BuildConfig.DEVICE_PLANNER_ONLY && (
26
+ c.packageName == "ir.lifeguide.app.device" ||
27
+ (BuildConfig.PERSONAL_RECOVERY_QA && c.packageName == "ir.lifeguide.app.personal"))
28
fun enabled(c: Context): Boolean {
29
if (!supported(c) || choiceFailedClosed) return false
30
return try { c.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(ENABLED, false) }
apps/lifemate/android/app/src/recoveryQa/AndroidManifest.xml
new
+8
@@ -0,0 +1,8 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ xmlns:tools="http://schemas.android.com/tools">
3
+ <!-- Test identity only. Never distribute; no network permission or cloud backup. -->
4
+ <uses-permission android:name="android.permission.INTERNET" tools:node="remove"/>
5
+ <application android:label="آزمون بازیابی" tools:replace="android:label">
6
+ <meta-data android:name="ir.lifeguide.PERSONAL_RECOVERY_QA" android:value="true"/>
7
+ </application>
8
+</manifest>
apps/lifemate/tool/personal_recovery_fixture.dart
new
+16
@@ -0,0 +1,16 @@
1
+// Never distribute. Reuses the ordinary planner UI and DEFAULT SQLite database.
2
+// Only the fresh-emulator host harness may seed fictional data before launch.
3
+import 'package:flutter/foundation.dart';
4
+
5
+import '../lib/standalone_main.dart' as personal;
6
+
7
+void main() {
8
+ if (!kDebugMode ||
9
+ kIsWeb ||
10
+ defaultTargetPlatform != TargetPlatform.android ||
11
+ !const bool.fromEnvironment('LIFEGUIDE_STANDALONE') ||
12
+ !const bool.fromEnvironment('LIFEGUIDE_PERSONAL_RECOVERY_QA')) {
13
+ throw StateError('Synthetic Android recovery QA only.');
14
+ }
15
+ personal.main();
16
+}
docs/superpowers/plans/2026-10-22-personal-recovery-android-acceptance.md
new
+29
@@ -0,0 +1,29 @@
1
+# Synthetic Android recovery acceptance — B2
2
+
3
+Approved boundary: ADR0018 option B preparation and fictional tests only. This is a separate PR on PR44. No owner data/phone, owner signing key, distribution, merge, deploy or DNS. Original `.device` certificate baseline and user-APK upload hold stay fixed.
4
+
5
+The temporary execution environment was replaced before the previous uncommitted B2 harness reached GitHub. PR44 remains durable and its general CI39673693877 actually succeeded. Rebuild B2 from the persisted plan; commit partial work explicitly before environment resets. Do not call the lost draft verified code.
6
+
7
+## Ownership and acceptance
8
+
9
+- Coordinator: Gradle opt-in QA identity, manifest and Dart wrapper, workflow, docs/evidence; no application schema/feature changes.
10
+- Host QA implementer: four new `*personal_recovery*` checker/harness Python files under `apps/lifemate/tool`; RED/GREEN for safety gates before integration.
11
+- Independent reviewer: whole B2 diff and refusal paths. Coordinator runs actual CI and inspects receipt/screenshots.
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.
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.
19
+7. CI uploads sanitized JSON and fictional PNGs only. No APK, SQLite, archive or key upload. App/fixture builds are debug-only with matching Gradle properties, Dart defines, target and codes; release/profile/mismatch fail closed. Existing online `.app` and personal `.device` defaults remain unchanged.
20
+
21
+## Ledger
22
+
23
+- [ ] Host safety and manifest RED/GREEN.
24
+- [ ] Opt-in QA build gates; default identities preserved.
25
+- [ ] Independent review; applicable tests/format/analyze run.
26
+- [ ] Actual fresh API35 CI; inspect outputs and screenshots before claims.
27
+- [ ] Record failures and precise remaining UNVERIFIED items; PR and stop at real-data boundary.
28
+
29
+Physical devices, Windows/USB/ACL, real data/keys, old-app notification ON/dedup, Doze/sound/reboot, permission consent UI and production readiness remain UNVERIFIED. Real owner transfer requires separately accepted tooling, local user choice and stable signing; this test harness is not that interface.