@davoodmehraban89 / LifeMate / commits / 62e82ba
Fork 0

LifeMate — Personal, Family & Learning Companion

ci: drive persistence phases and verify Android guard lifetime

Codex committed Oct 8, 2026 at 06:20 UTC 62e82baab96f742b86d4ef7bb886168039ddede5
2 files changed +21 -10
.github/workflows/local-persistence.yml
+18 -10
@@ -35,9 +35,10 @@ jobs:
35 run: |
36 dart format --output=none --set-exit-if-changed \
37 lib/main.dart lib/phase3_ui.dart lib/role_entry_main.dart \
38 - lib/local_data_store.dart lib/local_only_api.dart \
38 + lib/local_data_store.dart lib/local_only_api.dart lib/local_write_guard.dart \
39 test/app_test.dart test/local_persistence_test.dart \
40 - test/local_persistence_ui_test.dart integration_test
40 + test/local_persistence_ui_test.dart test/local_test_preferences.dart \
41 + integration_test test_driver
42 - run: flutter analyze --no-pub
43 - run: flutter test --no-pub --reporter expanded
44
@@ -76,7 +77,7 @@ jobs:
77 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
78 sudo udevadm control --reload-rules
79 sudo udevadm trigger --name-match=kvm
79 - - name: Verify real Android storage across four app processes
80 + - name: Verify Android storage and guard lifetime
81 uses: reactivecircus/android-emulator-runner@v2
82 with:
83 api-level: 35
@@ -90,19 +91,23 @@ jobs:
91 emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
92 working-directory: apps/lifemate
93 # Each command runs in its own shell. Keep pipefail with each test.
93 - # --no-uninstall retains SharedPreferences during Flutter test teardown.
94 - # Direct VM service avoids the observed DDS startup failure between phases.
94 + # The official integration driver avoids Flutter 3.47.6 test's custom
95 + # golden VM stream, which requires DDS. --no-dds avoids the observed
96 + # DDS startup failure. Drive normally uninstalls at teardown, so retain
97 + # the app with --keep-app-running and stop each process explicitly.
98 script: |
96 - bash -eo pipefail -c 'flutter test integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --no-uninstall --no-dds --dart-define=PERSISTENCE_PHASE=create --reporter expanded 2>&1 | tee "$RUNNER_TEMP/local-persistence-create.log"'
99 + bash -eo pipefail -c 'flutter drive --driver=test_driver/integration_test.dart --target=integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --keep-app-running --no-dds --dart-define=INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false --dart-define=PERSISTENCE_PHASE=create 2>&1 | tee "$RUNNER_TEMP/local-persistence-create.log"'
100 adb -s emulator-5554 shell am force-stop com.example.lifemate.localtest
98 - bash -eo pipefail -c 'flutter test integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --no-uninstall --no-dds --dart-define=PERSISTENCE_PHASE=update --reporter expanded 2>&1 | tee "$RUNNER_TEMP/local-persistence-update.log"'
101 + bash -eo pipefail -c 'flutter drive --driver=test_driver/integration_test.dart --target=integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --keep-app-running --no-dds --dart-define=INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false --dart-define=PERSISTENCE_PHASE=update 2>&1 | tee "$RUNNER_TEMP/local-persistence-update.log"'
102 adb -s emulator-5554 shell am force-stop com.example.lifemate.localtest
100 - bash -eo pipefail -c 'flutter test integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --no-uninstall --no-dds --dart-define=PERSISTENCE_PHASE=archive --reporter expanded 2>&1 | tee "$RUNNER_TEMP/local-persistence-archive.log"'
103 + bash -eo pipefail -c 'flutter drive --driver=test_driver/integration_test.dart --target=integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --keep-app-running --no-dds --dart-define=INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false --dart-define=PERSISTENCE_PHASE=archive 2>&1 | tee "$RUNNER_TEMP/local-persistence-archive.log"'
104 adb -s emulator-5554 shell am force-stop com.example.lifemate.localtest
102 - bash -eo pipefail -c 'flutter test integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --no-uninstall --no-dds --dart-define=PERSISTENCE_PHASE=verify --reporter expanded 2>&1 | tee "$RUNNER_TEMP/local-persistence-verify.log"'
105 + bash -eo pipefail -c 'flutter drive --driver=test_driver/integration_test.dart --target=integration_test/local_persistence_device_test.dart -d emulator-5554 --no-pub --keep-app-running --no-dds --dart-define=INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false --dart-define=PERSISTENCE_PHASE=verify 2>&1 | tee "$RUNNER_TEMP/local-persistence-verify.log"'
106 bash -eo pipefail -c 'adb -s emulator-5554 shell pm path com.example.lifemate.localtest | grep -q "^package:"'
107 adb -s emulator-5554 shell am force-stop com.example.lifemate.localtest
108 bash -e -c 'if grep -E "Uninstalling old version|Package install error" "$RUNNER_TEMP"/local-persistence-*.log; then echo "An installation reset invalidated the persistence test."; exit 1; fi'
109 + flutter build apk --debug --no-pub --target=lib/role_entry_main.dart
110 + bash -eo pipefail -c 'cd android && ./gradlew app:connectedDebugAndroidTest -Ptarget="$PWD/../lib/role_entry_main.dart" 2>&1 | tee "$RUNNER_TEMP/local-persistence-native-guard.log"'
111 - name: Build local role-entry APK after persistence gates
112 run: flutter build apk --release --no-pub --target=lib/role_entry_main.dart
113 - name: Upload local test APK
@@ -117,6 +122,9 @@ jobs:
122 uses: actions/upload-artifact@v4
123 with:
124 name: local-persistence-device-logs
120 - path: ${{ runner.temp }}/local-persistence-*.log
125 + path: |
126 + ${{ runner.temp }}/local-persistence-*.log
127 + apps/lifemate/build/app/outputs/androidTest-results/connected/**
128 + apps/lifemate/build/app/reports/androidTests/connected/**
129 if-no-files-found: warn
130 retention-days: 14
apps/lifemate/test_driver/integration_test.dart new
+3
@@ -0,0 +1,3 @@
1 +import 'package:integration_test/integration_test_driver.dart';
2 +
3 +Future<void> main() => integrationDriver(timeout: const Duration(minutes: 5));