From 7738b8777c78b7184ce76645787db705406abf74 Mon Sep 17 00:00:00 2001 From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com> Date: Sat, 3 Oct 2026 10:35:36 +1000 Subject: [PATCH 1/2] fix(ci): survive cold CoreSimulator on fresh CI runners The first simctl call on a cold GitHub runner takes long enough to trip simctl_pick_udid.py's 15s timeout, which hard-failed both new CI jobs before their fallbacks could run (ios:build:dev fails the same way inside ios:e2e). Warm the CoreSimulator daemon before any simulator query, give the pick script 60s, and let an empty/failed pick fall through to the any-iPhone fallback instead of exiting. Also widens the e2e app-launch poll from 20s to 60s: first launch after a fresh install can exceed the old budget under load (observed flake). Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> --- e2e/tests/helpers.ts | 3 ++- mise.toml | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/e2e/tests/helpers.ts b/e2e/tests/helpers.ts index a00e1c5..b925423 100644 --- a/e2e/tests/helpers.ts +++ b/e2e/tests/helpers.ts @@ -52,7 +52,8 @@ export async function resetAndLaunch(device: Device): Promise { }); // expect.poll() is not available in @mobilewright/test's expect — poll manually. - const deadline = Date.now() + 20_000; + // First launch after a fresh install can be slow on a loaded simulator. + const deadline = Date.now() + 60_000; for (;;) { if (foregroundApp(udid) === BUNDLE_ID) return; if (Date.now() > deadline) { diff --git a/mise.toml b/mise.toml index 1974380..06a669b 100644 --- a/mise.toml +++ b/mise.toml @@ -254,6 +254,11 @@ set -euo pipefail cd Apps/iOS xcodegen generate +# CoreSimulator cold start on fresh CI runners can exceed the pick script's +# timeout — warm the daemon first. Never let the 26.2 pick hard-fail: an empty +# or timed-out result falls through to any available iPhone below. +xcrun simctl list runtimes >/dev/null 2>&1 || true + UDID=$(python3 "$PWD/../../scripts/simctl_pick_udid.py" \ --runtime "com.apple.CoreSimulator.SimRuntime.iOS-26-2" \ --prefer "iPhone 16" \ @@ -261,7 +266,7 @@ UDID=$(python3 "$PWD/../../scripts/simctl_pick_udid.py" \ --prefer "iPhone 16 Plus" \ --prefer "iPhone 16 Pro Max" \ --contains "iPhone" \ - --timeout-seconds 15) || { echo "Failed to query simulators. Try: mise run ios:sim:reset" >&2; exit 1; } + --timeout-seconds 60) || true if [ -z "$UDID" ]; then # CI images may not ship the iOS 26.2 runtime — fall back to any iPhone. @@ -305,7 +310,10 @@ if [ ! -d e2e/node_modules ]; then (cd e2e && npm ci --no-audit --no-fund) fi -# 1. Build the current app (xcodegen + env injection + xcodebuild) +# 1. Warm CoreSimulator (cold CI runners: first simctl call is slow enough to +# trip simctl_pick_udid.py's timeout inside ios:build:dev) and build the +# current app (xcodegen + env injection + xcodebuild). +xcrun simctl list runtimes >/dev/null 2>&1 || true mise run ios:build:dev # 2. Boot a simulator silently (no Simulator.app window) @@ -314,7 +322,7 @@ UDID=$(python3 "$PWD/scripts/simctl_pick_udid.py" \ --prefer "iPhone 16" \ --prefer "iPhone 16 Pro" \ --contains "iPhone" \ - --timeout-seconds 15) || { echo "Failed to query simulators. Try: mise run ios:sim:reset" >&2; exit 1; } + --timeout-seconds 60) || true if [ -z "$UDID" ]; then # CI images may not ship the iOS 26.2 runtime — fall back to any iPhone. From 627512a963ddce7dcc66a4ba9e0c5a212ce6718e Mon Sep 17 00:00:00 2001 From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com> Date: Sat, 3 Oct 2026 11:08:38 +1000 Subject: [PATCH 2/2] test(e2e): raise per-test timeout for slow CI runners resetAndLaunch (uninstall -> install -> launch) counts against the per-test budget, and CI runners are 2-3x slower than local: the suite died at the 60s wall mid-assertions. 120s keeps local runs unaffected and gives CI comfortable headroom. Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> --- e2e/mobilewright.config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e/mobilewright.config.ts b/e2e/mobilewright.config.ts index c0f8ba3..bb4f7c8 100644 --- a/e2e/mobilewright.config.ts +++ b/e2e/mobilewright.config.ts @@ -9,7 +9,9 @@ export default defineConfig({ // simctl — mobilewright's LaunchOptions only supports locales. autoAppLaunch: false, viewTree: 'on-failure', - timeout: 60_000, + // Per-test budget: resetAndLaunch (uninstall -> install -> launch) counts + // against the test, and CI runners are 2-3x slower than local. + timeout: 120_000, expect: { timeout: 8_000 }, retries: 1, workers: 1,