Repository navigation
fix(android-e2e): wait for the Home/Recents surface change before pixel assertions - #4716
Conversation
…el assertions The Android smoke scenario captured one screenshot immediately after home and app-switcher and asserted it differed from the previous surface. When the launcher or Recents transition had not drawn yet, the capture still showed the previous surface and the identical-image assertion failed intermittently on main and unrelated PRs (#4710). assertHomeAndRecentsRestoration now polls screenshots through the new waitForSurfaceChange helper at that seam: each attempt overwrites the artifact so the final observed image is kept, the Home foreground-package proof and both assertFilesDiffer pixel comparisons are retained, and the wait fails at its 10s deadline if navigation never produces the change. No fixed sleep, no retry of the smoke test, no weakened assertion. live-surface-transition.test.ts pins the contract deterministically under fake timers: a delayed transition satisfies the wait only once a capture differs (keeping that final image), transient capture failures are retried, and a surface that never changes (or captures that keep failing) fails at the deadline with the last observation. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Size Report
Startup median (7 runs, lower is better):
|
|
The review of 13b6f71 found two issues that need attention before merge. Could the regression exercise both Home and Recents through the scenario harness with delayed captures? The new cases call the helper directly, so restoring the old single captures in the scenario leaves them passing while the race returns. Please show that the regression fails with the old route. Test The changed Android smoke path has no completed hosted run at the final head, and issue #4710 requires ten consecutive passes at an unchanged head. Please run the hosted scenario through Home, Recents, and fixture restoration ten times at the final head, retaining logs and artifacts that identify the head and prove both screenshot comparisons and restoration. Scenario Not blocking: You can take or leave a change to pass the remaining deadline through screenshot capture, bound or defer failure evidence, reject late observations, and cover slow capture and failure paths. The Android Smoke Tests job, which runs this scenario, was still running when I posted. No conflicts are known. Before merge, protect the scenario wiring, address the deadline overrun, and obtain the exact-head Android smoke evidence. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 13b6f71. The verdict and the full list are in the summary comment.
…d bound captures by the wait deadline Review of #4716: the helper-level tests alone would still pass if the scenario went back to single captures, so the regression now also runs assertHomeAndRecentsRestoration through the real harness wiring (context runCli override) against a scripted device whose first Home capture still shows the fixture and whose first Recents capture still shows Home. The scenario passes only via the polling wait, and fails at the 10s deadline when either surface never changes — a single-capture route fails both pixel comparisons on the first identical capture. waitForSurfaceChange now passes the remaining deadline into each capture (capped at 5s, allowFailure so per-attempt failure evidence stays deferred to the deadline verdict), removes the stale artifact before each attempt, and rejects a capture that resolves after the deadline as a late observation. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 8516300. The verdict and the full list are in the summary comment.
|
At 8516300, the default capture now forwards the remaining timeout, fixing the issue raised in the earlier review, but the regression coverage and hosted validation still need work. No conflicts are known. Could the deadline test exercise the default capture through the harness with a CLI double that observes and enforces the forwarded timeout? The current test injects a capture that rejects itself, so removing the timeout from the default capture would leave it passing and allow the long screenshot wait to return. Please verify that removing the timeout makes the test fail. The hosted run was still in progress, so ten consecutive hosted Android Smoke Tests passes at this head are not yet established. Please run the hosted Android smoke lane ten consecutive times at the unchanged head and retain links and output showing that smoke:automation-system reaches both Home and Recents transition waits and passes their pixel comparisons. Could the test use the harness-owned runCli injection to run the registered scenario with a scripted device, keeping timeout handling at the screenshot observation boundary? That would require exposing or constructing the Android harness with its existing runner injection, then deleting the context override and scenario-internal export. The open scenario runner thread still applies; no lower-priority threads still apply. The capture timeout thread no longer applies because the default capture forwards the bounded timeout. Smoke Tests, which runs both changed transitions, was still running when I posted. Before merge, add a regression that detects removal of the default capture timeout and obtain ten consecutive hosted Android smoke passes at the exact head. |
|
Both blocking findings are addressed at 1. Scenario-level regression. New 2. Deadline overrun (taken). 3. Ten consecutive hosted Android smoke passes at the final head. Workflow run 44388138478 ( Each attempt's full job log and Local gates at |
|
Thanks. I checked both against 8516300, and my last review missed them:
The per-attempt deadline and the late-observation rejection are covered by their own tests. All checks pass, and there are no conflicts. This is ready for review. |
…try and pin the capture timeout Review of #4716 at 8516300: the scenario test faked the route via a context runCli override and a direct internal export. The Android harness is now constructible with its existing runner injection (createAndroidLiveHarness), the assertion helpers are bound per harness (createAndroidLiveAssertions), and the Home/Recents lane runs as a registered scenario (runScenario) with steps passed in — the context override and the scenario-internal export are gone. The scripted CLI double observes and enforces the forwarded step timeout like a real runner: captures finish after 60s unless the forwarded timeoutMs kills them. With the timeout, the wedged-capture test fails at the 10s wait deadline with 'capture N failed' and the recorded timeouts show the remaining deadline (capped at 5s, shrinking); removing timeoutMs from the default capture makes both scenario tests fail (verified locally), so the regression detects the removal. waitForSurfaceChange takes the bound capturePng so the default capture's timeout reaches the harness's CLI runner. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
fallow flags automationScenarioSteps as an unused export; only the scenario module consumes it as the default steps parameter. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
Addressing the review at 1. Timeout-removal regression through the harness entry (was: self-rejecting capture test). The scripted CLI double observes and enforces the forwarded timeout like a real runner: a capture would finish after 60 s, but a forwarded 2. Ten consecutive hosted Android smoke passes at the unchanged head.
Every attempt's job log and Local gates at |
… Home (#4990) (#5045) The Android smoke lane failed at the Home foreground assertion on three unrelated 0.22 PRs (jobs 137197315801, 137220955468, 137350879830). Each run shows the same ordering: `home` finished after 55-121 ms (one injected keyevent), the next `appstate` read started 90-193 ms later, answered in 193-443 ms, and still named com.callstack.agentdevicelab/MainActivity. The retained failed-step evidence for run 45068801264 shows `topResumedActivity=NexusLauncherActivity` about 1.5 s after the keyevent, so Home did happen; the scenario read the foreground while WindowManager was still resuming the launcher. #4716 added the bounded wait for the pixel transition and kept the single unconditional foreground read. `assertHomeAndRecentsRestoration` now waits at that observation with `waitForForegroundLeaves` (same owner, deadline, poll and per-read bound as `waitForSurfaceChange`), and the lane reads pixels only once the device itself reports the foreground left the fixture. A foreground that never leaves fails at the deadline with its last observation; no sleep, no assertion retry, no relaxed check. Coverage runs through the harness entry: a scripted device that keeps the foreground stale for the first reads passes only via the wait (the pre-fix route fails it with the hosted notStrictEqual signature), and a foreground that never transitions fails the lane before any Home-surface capture. The wait owns delayed reads, read failures, reads that answer no package, reads bounded to the remaining deadline, and late observations.
… Home (#4990) (#5045) The Android smoke lane failed at the Home foreground assertion on three unrelated 0.22 PRs (jobs 137197315801, 137220955468, 137350879830). Each run shows the same ordering: `home` finished after 55-121 ms (one injected keyevent), the next `appstate` read started 90-193 ms later, answered in 193-443 ms, and still named com.callstack.agentdevicelab/MainActivity. The retained failed-step evidence for run 45068801264 shows `topResumedActivity=NexusLauncherActivity` about 1.5 s after the keyevent, so Home did happen; the scenario read the foreground while WindowManager was still resuming the launcher. #4716 added the bounded wait for the pixel transition and kept the single unconditional foreground read. `assertHomeAndRecentsRestoration` now waits at that observation with `waitForForegroundLeaves` (same owner, deadline, poll and per-read bound as `waitForSurfaceChange`), and the lane reads pixels only once the device itself reports the foreground left the fixture. A foreground that never leaves fails at the deadline with its last observation; no sleep, no assertion retry, no relaxed check. Coverage runs through the harness entry: a scripted device that keeps the foreground stale for the first reads passes only via the wait (the pre-fix route fails it with the hosted notStrictEqual signature), and a foreground that never transitions fails the lane before any Home-surface capture. The wait owns delayed reads, read failures, reads that answer no package, reads bounded to the remaining deadline, and late observations.
Summary
Closes #4710.
The Android emulator smoke scenario (
smoke:automation-system) took one screenshot immediately afterhomeand afterapp-switcherand asserted it differed from the previous surface. When the launcher or the Recents transition had not drawn yet, the capture still showed the previous surface, so the identical-image assertion failed intermittently onmainand on unrelated PRs (e.g. #4297).assertHomeAndRecentsRestorationnow waits at that observation seam with the boundedwaitForSurfaceChangehelper (test/integration/android-emulator-e2e/live-surface-transition.ts, same contract as the existingwaitForImeWindow): re-capture every 250 ms until the screenshot differs from the baseline, within a 10 s deadline. Each attempt removes and overwrites the artifact, so the final observed image is kept and a failed capture cannot leave a stale one; the default capture is bounded by the remaining deadline (5 s per-attempt cap, failure evidence deferred to the deadline verdict); a capture resolving after the deadline is rejected as late. The Home foreground-package proof and bothassertFilesDifferpixel comparisons are retained unchanged; the wait fails at the deadline if navigation never produces the change. No fixed blanket sleep, no smoke-test retry, no weakened assertion, no production change, no workflow/runner change (#4712 untouched).Regression coverage runs the lane through the harness entry:
createAndroidLiveHarness({ runCli })(the harness-owned runner injection) +createAndroidLiveAssertions(harness)+createHomeAndRecentsRestorationScenario(steps)executed viarunScenario, with a scripted CLI double that observes and enforces the forwarded capture timeout. Tests cover: delayed Home/Recents captures passing only via the wait (single-capture route fails them), timeout negatives at the 10 s deadline, wedged captures cut at the forwarded remaining timeout (removing thetimeoutMsfrom the default capture fails these tests — verified by mutant), and late-observation rejection.Validation
55f5b877e31a676107f47d5457d2d5179a317b83afterpnpm install --frozen-lockfile && pnpm build.pnpm check:affected --run --head 55f5b877e31a676107f47d5457d2d5179a317b83(receipt.tmp/validation/run-S084nc,exactCommit=true): format, lint, typecheck, fallow, layering, di-seams, build, package, integration-node, macos-coverage, vitest-related all passed;unitpassed 20613/20627 with only known host-load 5 s-timeout flakes inscripts/__tests__/release-publish.test.ts/test/repo-guards/release-assets.test.ts(pass solo; same failures on unchangedorigin/mainunder the same host load). Focused: 27/27 across the four android-emulator-e2e suites (9 new tests),live-device-e2e-runtime14/14;pnpm typecheck,pnpm format,oxlint,fallow auditclean.head_sha 55f5b877e31a676107f47d5457d2d5179a317b83— the Smoke Tests job passed on the initial run plus ten consecutive reruns at the unchanged head (11 executions, all success; job attempts 135162841640, 135166033700, 135169807283, 135173730913, 135177643973, 135180726313, 135184007531, 135187535422, 135190285281, 135193942664, 135197493388). Per-attempt logs +android-artifactsretained (/tmp/ad-smoke-55f5b877/01..11): each shows✔ live Android emulator fixture E2Epass 1/fail 0, step-historycapture Android Home surface (attempt N)andcapture Android Recents surface (attempt N)status 0 (both transition waits passed their pixel comparisons; three distinct PNG md5s per attempt), andhome-recents-restorationincoverage-report.json(fixture restoration). This satisfies Android emulator smoke: Home and Recents screenshot comparisons fail intermittently #4710's ten-consecutive-passes criterion at the final head.