Clear the app before every on-device run, as !122 said it did

!122 described this change and did not contain it. Its commit carries
only SignUpFlowTest.kt; the script edit stayed in the working tree,
because the file is tracked as `scripts/` and was staged as `Scripts/`,
the same file on a case-insensitive disk. The on-device run that passed
used the uncommitted script, so the pass was real and main never had
the fix behind it.

The fix itself is unchanged from what !122 described. The uninstall used
to run only when the emulator was already up, on the reasoning that a
cold boot starts clean. A cold boot starts with no snapshot; the disk
image keeps whatever was installed. An AVD used to try a release build
kept that build, and the debug test APK could not install over it:
INSTALL_FAILED_UPDATE_INCOMPATIBLE, zero tests run. It now clears on
both paths and refuses to continue if anything survives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-09-11 12:14:44 -04:00
co-authored by Claude Opus 5
parent 668bd48415
commit 945897a742
+30 -6
View File
@@ -66,14 +66,38 @@ if ! "$ADB" shell getprop sys.boot_completed 2>/dev/null | grep -q 1; then
-no-snapshot-load -no-snapshot-save -no-boot-anim \
-netdelay none -netspeed full >/tmp/fnmsg-emu.log 2>&1 &
until "$ADB" shell getprop sys.boot_completed 2>/dev/null | grep -q 1; do sleep 5; done
else
echo "### emulator already up, clearing the app rather than trusting it"
"$ADB" uninstall io.flamenet.messenger >/dev/null 2>&1 || true
"$ADB" uninstall io.flamenet.messenger.test >/dev/null 2>&1 || true
fi
echo "### signed-in account on the device before we start:"
"$ADB" shell pm list packages 2>/dev/null | grep -i flamenet || echo " (nothing installed, good)"
# Unconditionally, on BOTH paths. This uninstall used to live only in the
# "emulator already up" branch, on the reasoning that a cold boot starts clean.
# A cold boot starts with no SNAPSHOT; the disk image keeps whatever was
# installed on it. So an AVD that had been used to test a RELEASE build kept
# that build, and the debug APK could not install over it:
#
# INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package
# io.flamenet.messenger signatures do not match newer version
#
# Release and debug are signed by different keys, which is the whole point of
# them, so this is not a rare collision: it happens every time somebody uses
# this AVD to try a real build, which is what an AVD is for.
#
# The line below already PRINTED the leftover package, and the run continued
# anyway. A check whose output nobody acts on is decoration.
"$ADB" uninstall io.flamenet.messenger >/dev/null 2>&1 || true
"$ADB" uninstall io.flamenet.messenger.test >/dev/null 2>&1 || true
echo "### installed packages after clearing:"
LEFTOVER=$("$ADB" shell pm list packages 2>/dev/null | grep -i flamenet || true)
if [ -n "$LEFTOVER" ]; then
echo "$LEFTOVER"
echo "REFUSED: could not remove the existing install above." >&2
echo "It will make the test APK fail to install, and the run would report" >&2
echo "zero tests as though nothing were wrong. Remove it by hand:" >&2
echo " $ADB uninstall io.flamenet.messenger" >&2
exit 1
else
echo " (nothing installed, good)"
fi
echo "### relay $RELAY · classes $CLASSES"
set +e