Skip to content

perf: speed up iOS swipes and harden runner cache#676

Merged
thymikee merged 2 commits into
mainfrom
codex/ios-swipe-speed
Jun 3, 2026
Merged

perf: speed up iOS swipes and harden runner cache#676
thymikee merged 2 commits into
mainfrom
codex/ios-swipe-speed

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented Jun 2, 2026

Summary

Speed up and harden the iOS/Android Maestro replay path used by React Navigation.

iOS gestures

swipe now uses a synthesized iOS runner drag path instead of XCTest's long press/drag path. This makes swipes closer to user/Maestro timing and avoids the multi-second pauses we saw in material top tabs.

Repeated iOS swipes (--count > 1 / dragSeries) now use the same synthesized path and skip XCTest idle-timeout wrapping. pan is also aligned with swipe/scroll for non-tvOS iOS targets, so common drag-like gestures no longer quietly stay on the old slow path.

If synthesized drag is unavailable, the runner still falls back to XCTest coordinate dragging, but the fallback is exposed in response data and emitted as a debug diagnostic so slow fallback paths are observable.

iOS runner cache

The iOS runner derived-data cache is now keyed by a stable runner fingerprint and guarded by a filesystem lock. Identical runner builds can be reused across sessions/worktrees, while stale or foreign artifacts are rejected through metadata/path/product validation.

This avoids unnecessary runner rebuilds without accepting stale cache risk.

Maestro compat runtime

Maestro compat now prefers optimized snapshots for normal assertions, taps, and runFlow.when checks, then uses raw fallback only where we still need it on iOS. The raw fallback policy is shared in runtime support.

Android optimized snapshots now keep nodes with meaningful app ids so testID selectors can resolve without raw snapshots. Generic Android framework/resource ids remain filtered, so the snapshot can grow slightly but should not regress into noisy framework output.

Selector/tap geometry was tightened for React Navigation-style tab bars so visible/on-screen tab targets are preferred over broad parent containers.

CI setup

iOS smoke/nightly workflows now prepare the iOS runner before replay. This prevents the first Maestro snapshot from paying a cold xcodebuild cost inside the daemon request timeout.

Validation

  • pnpm exec vitest run src/core/__tests__/dispatch-interactions.test.ts src/platforms/ios/__tests__/index.test.ts src/compat/maestro/__tests__/runtime-flow.test.ts
  • pnpm exec vitest run src/compat/maestro/__tests__/runtime-assertions.test.ts src/compat/maestro/__tests__/runtime-interactions.test.ts src/platforms/ios/__tests__/runner-client.test.ts
  • pnpm check:fallow --base 491ad7e9224d787f1d90568085479e2b2c7787f3
  • pnpm check:quick
  • pnpm build:xcuitest
  • Previous PR CI was fully green before the latest review-feedback amend.
  • Manual/live checks from this branch:
    • two-process smoke test for iOS runner cache lock serialization
    • two-daemon/two-simulator prepare check where iPhone 17 built fresh cache bucket cache-22e3c70b47ebf0c4, iPhone 17 Pro reused the same .xctestrun, and warm reruns reused the same cache on both simulators with ensure_xctestrun at 14-26ms
    • React Navigation 3-flow smoke comparison on iOS and Android

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Size Report

Metric Base Current Diff
JS raw 1.1 MB 1.1 MB +2.5 kB
JS gzip 366.2 kB 367.0 kB +812 B
npm tarball 471.2 kB 473.0 kB +1.8 kB
npm unpacked 1.6 MB 1.6 MB +11.8 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.2 ms 28.8 ms +1.6 ms
CLI --help 43.1 ms 44.5 ms +1.4 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/session.js +1.4 kB +482 B
dist/src/9533.js -605 B -180 B
dist/src/2415.js +745 B +62 B
dist/src/221.js -124 B -45 B

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c63e3b541

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/platforms/ios/interactions.ts Outdated
Comment on lines +119 to +121
durationMs: iosSwipeDurationMs(durationMs),
synthesized: true,
appBundleId: ctx.appBundleId,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate synthesized swipes to iOS only

In macOS sessions createAppleInteractor also gets its swipe implementation from iosRunnerOverrides, so this now sends synthesized: true for macOS swipes as well. The macOS runner's synthesized path always returns unsupported, and RunnerTests+CommandExecution.swift then falls back using synthesizedSwipeFallbackHoldDuration, which converts a requested/default 300 ms swipe into a 60 ms hold capped at 120 ms instead of the previous direct drag duration. This can make macOS swipe/scroll gestures much shorter than requested; only set this flag for iOS/touch devices or preserve the old duration path on macOS.

Useful? React with 👍 / 👎.

@thymikee thymikee force-pushed the codex/ios-swipe-speed branch 2 times, most recently from d19aa27 to 835582d Compare June 2, 2026 22:00
@thymikee thymikee force-pushed the codex/ios-swipe-speed branch 9 times, most recently from 92a072f to 3930d5a Compare June 3, 2026 04:37
@thymikee thymikee force-pushed the codex/ios-swipe-speed branch from 3930d5a to 3412898 Compare June 3, 2026 04:51
@thymikee thymikee merged commit 7400701 into main Jun 3, 2026
18 checks passed
@thymikee thymikee deleted the codex/ios-swipe-speed branch June 3, 2026 11:59
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-03 11:59 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant