AX notes · How-to

Claude Code real-device E2E: 31 fixes in 3 rounds

We ran a Flutter app that Claude Code had built through three rounds of end-to-end tests on a real phone and an emulator. Unit tests passed at the end of every round, and we still fixed 31 defects.

By Stephen Testing and release 11 min read Last updated

The first button on the first screen did nothing. That was the start of a morning spent walking a Flutter family app through sign-up, invites, AI suggestions and account deletion on a Galaxy S21 and a PC emulator, with its unit tests passing. A Claude Code agent had committed the zero-cost test stack minutes earlier; three rounds later, 31 defects had been fixed.

Every unit test was green, which is when an agent reports it is done. The guard that kept the test build away from production was wrong at first: a test build documented as running "without the real cloud" sent requests to Google servers every time it ran, until October 13. Requests that the Firebase SDK opens on its own do not go through the local emulator connection.

Contents (9)
  1. 07:53: the Start button did nothing on either device
  2. The zero-cost stack swapped four services for fakes
  3. Unit tests were green after every round
  4. "Without the real cloud" was false until October 13
  5. The day we stopped using the emulator
  6. Building the same harness
  7. Errors we hit
  8. Purchases, push and Play Integrity went to a separate runbook
  9. FAQ

07:53: the Start button did nothing on either device

At 07:37 KST on October 10, 2026, Claude Code committed a local test stack for the family calendar app AXFamily and went straight into device E2E (end-to-end testing: using the whole app in the order a person would). Device A was the operator's own Galaxy S21; device B was an Android emulator on the PC.

When Start did nothing, the agent dumped the view hierarchy, read the router, and wrote a failing test before touching the code. The router's navigation rule should have sent a user in onboarding to the age check, but that step listed the welcome screen as an allowed route, so the rule sent them nowhere.

Sign-up then failed on both devices. The app pointed at the local Firebase stack on 127.0.0.1, but FlutterFire, the Firebase plugin set for Flutter, rewrites that address to 10.0.2.2 by default. Both devices failed with 'Cleartext HTTP traffic to 10.0.2.2 not permitted', because the test build allowed plain HTTP only to 127.0.0.1 and localhost. And 10.0.2.2 reaches the host PC only from inside an emulator, so even with that allowed the S21 could not have reached it.

Creating a family failed next: every server function call broke because the fake API key was not in the format Firebase expects. Each fix meant rebuilding the release APK with R8 (Android's code shrinker for release builds) and reinstalling it. The first build took about five and a half minutes and later rebuilds mostly one to three.

Bar chart: device E2E on 2026-10-10 fixed 12 defects in round 1, 13 in round 2 and 6 in round 3; none came from R8 shrinking.
Three rounds fixed 31 defects, and none of them was caused by R8.

The zero-cost stack swapped four services for fakes

Commit 1fcc1e1 swapped four real services for local stand-ins:

Real serviceStand-inCondition that keeps it out of production
Firebase Auth, Firestore, FunctionsFirebase Local Emulator Suite on the PCOnly projects whose ID starts with demo- (they have no real resources)
AI extraction modelA deterministic fake modelOnly when the Functions emulator flag and a demo- project are both true
Photo storage serverA local photo server (a Worker) on the PCLocal config and a demo- project
App Check (app attestation)An unsigned local tokenOnly the emulator accepts it; production functions take signed tokens only

Firebase's own debug App Check provider was an option, but it has to exchange tokens with Google's servers, which a demo- project cannot do.

The other direction is guarded too. The release gate opens the production AAB and searches the compiled code (dex) and the Flutter code library (libapp.so) for test marker strings; any hit stops the release. A CI check confirms the guard statements are still in the source and that a copy with each guard deleted fails the check. The harness commit shipped 14 of these guard-removal cases. Why a gate should read the artifact itself is in Our release gates were checking something other than the release.

Unit tests were green after every round

RoundTime (KST)R8 APK builds
107:44-09:489
209:48-11:012
311:01-12:254

Each round ran Android's monkey tool for 3,000 random events on both devices with no crashes or ANRs (app-not-responding errors). The instructions asked the agent to look for R8 symptoms in the logs, classes or methods the shrinker had removed, and there were none. The case where R8 did kill a release build, in a different app, is in AI-built Android app release checklist: R8 and real devices.

What showed up instead were flow and state defects. After B joined the family, A could not assign a task to B until A restarted the app, a defect you only see when two accounts take turns; after an AI suggestion was approved, the Today screen stayed on the first-run card because the app never heard about the server's write. The round 1 and round 3 commit messages say each of their 18 fixes came with a test that fails without the fix. When the harness was committed, all 1,118 Flutter tests passed with the round 1 defects still in the code.

One round 3 fix: on device B, AI organizing ended with a retryable error, yet the banner at the top of the Records tab kept saying a result was waiting. It had been left open in round 2; round 3 marked the pending record as failed and changed the text.

Two AXFamily Records tab screenshots: before, the banner says 'An AI result is waiting for you.' after a failed run; after the fix it says 'AI organizing didn't finish.' The first list item is marked Not organized.
Device B captures from the round 3 screen record (commit 218b34c); the right one is after fix commit 9c8bda6. With every unit test passing, the banner reported the opposite of what had happened.

We also counted whether any defect appeared only on the real phone. None of the fix records says "S21 only". One defect surfaced because of the emulator: it ran on GMT while the S21 used Seoul time, the same as the family, so a date picker whose "today" followed the device time zone looked wrong only on the emulator.

"Without the real cloud" was false until October 13

The harness README opened by saying it runs the core flow on two devices without the real cloud. Round 1's report already contradicted it: a Google logging endpoint answered with HTTP 200 and Firebase Installations (the service that issues an ID per install) rejected requests with HTTP 400, so requests were leaving the device. The agent noted in its own report that the 400s started after it fixed the fake key's format.

At the end of round 3 each app process still logged 24 Installations warnings. That afternoon, commit 753cc37 switched off Firebase's automatic collection settings in the test build and the README said there were no Installations or FCM registration requests. Thirty-five minutes later a review fix, c2aeb59, noted that only one setting had actually changed and downgraded the line: until a device showed zero requests, "network zero" was not done.

The next day a QA run on the operator's other phone, a Galaxy S20, logged the Installations 400 again and settled that open item as false. The cause it named was a push token request.

The harness redirected only the server addresses the app calls itself; requests the SDKs open on their own were outside it. And the isolation gate read source statements and strings inside the artifact, so the harness commit's 21 isolation tests checked network config such as the cleartext host list, but none blocked or counted a running app's outbound connections.

On October 13, commit d90e21a blocked traffic at the transport layer instead of switching off more settings:

The same day a device script counted the off-device bytes of the app's UID (the user number Android gives each app): zero on both the S21 and the S20. Review then pointed out that a zero alone cannot be told apart from a broken counter that always returns zero, so a PASS now also requires the system UID, counted the same way, to be above zero.

Terminal output of the isolation tests re-run on three snapshots: 21 tests at the harness commit, 38 at the network-block commit and 46 now, all passing, with 14, 23 and 30 guard-removal cases. Eight network-blocking cases are listed below.
Output lines from a 2026-11-16 re-run, redrawn verbatim. The eight Korean test names cover the trust-anchor, provider-order, https-handler and Dart allow-list guards. The harness commit's 21 tests never checked outbound blocking; those cases first appear in d90e21a.

The day we stopped using the emulator

At 14:32 on October 11 the operator asked why the agent kept starting the PC emulator when it had been told to test on the S20. The agent shut the emulator down and said it had itself told the store-screenshot agent to use it. Commit 9fcff82 that afternoon traced the root cause to an old decision in the plan, "Second test device: Play image emulator. Do not use the S20.", plus two lines in its table that echoed it.

The old decision is now struck through, with a new one beneath it: S21 is device A, S20 is device B. The install script exits, with no override, when the device serial starts with emulator- or the system properties say it is one, and a docs check fails if the three old sentences come back. The GMT device that caught the time zone defect went with it.

Building the same harness

Accept an agent's "done" only when it comes with a round record of the release build run end to end on two devices. Here is how to get that record without paying for cloud time.

  1. Build the test APK with production's release and R8 settings, and let one build constant (a dart-define) pull in the test code. Add a package suffix, debug-key-only signing and a ban on Play bundles (AABs).

  2. Choose the fake backend and fake model only when "running in the emulator" and "demo- project" are both true; if only one is, refuse the call.

  3. Turn off FlutterFire's host rewriting and connect with adb reverse, which forwards a PC port to 127.0.0.1 on the device. Allow cleartext only for 127.0.0.1 and localhost.

    firestore.useFirestoreEmulator('127.0.0.1', 8180, automaticHostMapping: false);
    adb -s <device> reverse tcp:8180 tcp:8180
  4. Have the release gate search the production AAB for test markers, and lock it with guard-removal cases that must fail.

  5. Give the two devices different languages and time zones and run a 12-step scenario covering sign-up, invites, AI suggestions, photos and account deletion. For each defect: failing test, fix, rebuild the APK, recheck on the device.

  6. Count off-device traffic on the device from dumpsys netstats detail by the app's UID. The increase must be zero, the blocker's install log must be present, and the system UID, counted the same way, must be above zero. That output also holds other apps and carrier identifiers, so filter on the device and pull out only the numbers.

  7. Make the install script refuse devices you have decided not to use.

Errors we hit

SymptomCauseFix
Sign-up fails with Cleartext HTTP traffic to 10.0.2.2 not permittedFlutterFire's automatic host mappingautomaticHostMapping: false
Every server function call (callable) throws IllegalArgumentException (valid API key)The fake key did not match the Installations format (39 characters starting with A)A fake key in the right format
Firestore triggers die with default Firebase app does not existA check that skipped default app setupCheck for the default app (the bug was in production too)

Purchases, push and Play Integrity went to a separate runbook

Completed Play purchases, real push delivery, photo file deletion and App Check tokens backed by Play Integrity (Google's check that the app came from Play) are out of reach for this harness. Device tests with the real AI model and production backend got their own runbook on October 13 and install through Play's internal testing track. The same day the operator set the bar: the E2E has to pass clearly on the S20 and S21 before anything counts as done.

The Firebase emulator produced its own errors. Family deletion failed several times with CANCELLED; the agent put that down to the emulator but added retries anyway. Whether production Firestore does the same is something this harness cannot show.

With a personal phone as device A, the agent kept the share sheet and photo picker closed, because they show contacts and personal photos. Photo steps ran on device B, and round 3 recorded the invite-code hand-off as a partial pass caused by the harness.

The round 3 fix to the account deletion screen could not be reproduced on a device again and is covered only by unit and widget tests. A checklist step that sets one phone to a time zone different from the family's is what would catch the date picker class of defect again; this project's checklist has no such step today.

FAQ

Is passing on the emulator enough to ship?

Not on this record. None of the 31 defects was marked as real-phone only, but a library default that assumes an emulator blocked both devices and pointed the real phone at an address it could never reach, and the time zone difference between the two devices exposed a defect.

How do I connect a Flutter release build to the Firebase Local Emulator Suite?

Apps targeting Android 9 or later block cleartext HTTP by default. Allow cleartext only for 127.0.0.1 in the test build's network security config, then connect with automaticHostMapping: false and adb reverse.

Checked 2026-11-16. AXFamily repository git history (1fcc1e1, 6a51d59, 5b52ff5, 7d5dfa7, d3fde30, 74df690, 9c8bda6, 218b34c, 753cc37, c2aeb59, c966602, 9fcff82, d90e21a, dab90fe, eae1508; all co-authored with Claude Opus 5.5), per-round results of the device E2E workflow (2026-10-10 KST), QA records (2026-10-10 screens, 2026-10-11 S20 report), real-device E2E runbook (2026-10-13), Claude Code session logs (2026-10-10 to 10-13), isolation test re-run (2026-11-16, node 22).

This note is written from values SugarMount measured itself; an AI coding agent was used to draft it.

All notes on Testing and release · All AX notes