Skip to content

fix(apple): press Home through simulator HID on a foldable simulator - #5079

Merged
thymikee merged 4 commits into
callstack:mainfrom
kacperkapusciak:fix/foldable-home-hid
Nov 24, 2026
Merged

thymikee merged 4 commits into
callstack:mainfrom
kacperkapusciak:fix/foldable-home-hid

Conversation

@kacperkapusciak

@kacperkapusciak kacperkapusciak commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On a foldable iOS simulator (iPhone Duo), home and app-switcher reported success, but the app stayed in the foreground. XCUITest's XCUIDevice.shared.press(.home) never reaches SpringBoard there.

On a simulator with more than one panel, both commands now press Home through the fold helper's simulator HID: one consumer Menu key for home, two for app-switcher. This is the same routing orientation already uses. Single-panel simulators, physical devices, tvOS, and macOS keep the runner press.

Scope: help foldable also documents reaching Split View through SpringBoard.

Before / after

iPhone Duo, iOS 27.2, open pose, app in front:

# base 22bb75b
$ agent-device home        -> Home
$ agent-device appstate    -> State: runningForeground
$ agent-device app-switcher -> Opened app switcher
$ agent-device appstate    -> State: runningForeground

# head 92fb89d
$ agent-device home        -> Home
$ agent-device appstate    -> State: runningBackground   (home screen shown)
$ agent-device app-switcher -> Opened app switcher        (switcher shown)

Screenshots after each command, base left, head right:

iPhone Duo home and app-switcher, base vs head

Validation

  • pnpm check:affected --run --head 92fb89d: passed, exactCommit: true.
  • Device: node bin/agent-device.mjs at head on an iPhone Duo simulator (iOS 27.2, default set). home and app-switcher each passed in the closed, half-open, and open poses, checked with appstate and the screenshots above. The Split View steps were checked by hand with agent-device 0.21.39.
  • Not run: a scoped device set (--ios-simulator-device-set), and a live single-panel simulator. Unit tests cover the single-panel routing.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

XCUIDevice's home press never reaches SpringBoard on the iPhone Duo
simulator, so home and app-switcher reported success while the app
stayed in the foreground. Route both through the fold helper's simulator
HID on a foldable simulator, the same routing orientation uses: one
consumer Menu key press for home, two for the app switcher.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. The diff at 92fb89d routes Home through the simulator HID path on a foldable simulator, and the code has no problems that need to change before merge.

Smoke Tests (ios) failed at 'Restore and build iOS XCTest runner' because the runner could not find the actions/cache save action. This is an infrastructure failure, and the diff touches no workflow file or Apple runner build step. The smoke phases never ran, so no smoke test exercised this change. Coverage failed on a 5000ms timeout in packages/capture-kit/src/snapshot/tests/snapshot-diff-scale.test.ts, which this diff does not touch, so it looks like a flaky timeout. The four Body rules runs were cancelled by concurrency after new pushes, not by a rule violation.

There are no conflicts. Before merge, re-run Smoke Tests (ios) and Coverage, and confirm on the Coverage re-run that the new fold-helper code is covered.

Not verified here: a foldable simulator run, the changed code, or the tests. The closed, half-open and open pose results rest on the PR body. The claims that the XCUIDevice home press never reaches SpringBoard on a foldable simulator and that the Menu key (0x0c/0x40) does rest on the author's measurement.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@kacperkapusciak

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both reruns are green on 92fb89d: Smoke Tests (ios) and Coverage now pass, and all 17 checks pass.

Coverage of the new code: the CI job doesn't print per-file numbers, so I ran the platform-apple tests with v8 coverage locally on 92fb89d.

  • foldable/fold-helper.ts: 100% lines and functions, including pressHome and HOME_FAILURE.
  • interactor.ts: both new branches run, pressHome(1) from home (line 170) and pressHome(2) from app-switcher (line 188).

@thymikee
thymikee merged commit bfedef5 into callstack:main Nov 24, 2026
43 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants