Skip to content

fix(ios): spawn the AX bridge and fold helper inside the scoped simulator set - #2818

Merged
thymikee merged 2 commits into
mainfrom
fix/2784-simctl-spawn-scoped-set
Sep 23, 2026
Merged

thymikee merged 2 commits into
mainfrom
fix/2784-simctl-spawn-scoped-set

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

With --ios-simulator-device-set, two simctl spawn calls ignored the scoped set: the AX snapshot bridge and the fold HID helper. Both now build argv with the shared core/simctl.ts helper. The bridge uses buildSimctlArgs, fed by a new simulatorSetPath on the snapshot target. The resolver copies it from DeviceInfo, and SnapshotSourceHost.start now takes the target. Fold uses runSimctlForDevice, and sendSimulatorFoldPose now takes the DeviceInfo. Without a set, both argv arrays are unchanged. No new builder was added. 12 files changed, platform-apple only.

Where the code differs from the issue: fold on a scoped-set foldable still fails, one step before the HID dispatch. devicectl device info displays, and the hinge readback, cannot see a simulator outside the default set ("The specified device was not found"). This PR does not address that.

Closes #2784

Validation

  • Tested SHA da6e28702f: pnpm check:affected --run passed (268 files / 1725 tests). Unit tests assert both argv arrays with and without a set. Reverting each hop fails the 4 new scoped-set tests.
  • Live check on a throwaway iPhone Duo (iOS 27.1) in a temp set, with --ios-simulator-device-set:
    • snapshot -i --debug logged ios.snapshot-source.acquire/present from simulator-ax-bridge, with no fallback warning. The bridge ran as simctl --set <set> spawn.
    • fold half-open failed at the devicectl inventory, as described above.
    • The fold helper argv worked by hand: simctl --set <set> spawn <udid> fold half-open exited 0; without --set it failed with Invalid device.
  • Adversarial review: fixed a stale discoveryCount helper and added an adapter-hop assertion. Rejected as out of scope or pre-existing: UDID-only session and cache keys (UDIDs are unique across sets), the perf.ts and app-log marker simctl spawn text matches, the bridge bypassing the Apple tool provider, and duplicated target types. platform-apple is private, so there is no dts compatibility concern.

🤖 Generated with Claude Code

thymikee and others added 2 commits September 23, 2026 15:47
…ator set

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…start

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.79 MB 4.79 MB -1.3 kB
Package (unpacked) 4.79 MB 4.79 MB -1.3 kB
Package (download) 1.43 MB 1.43 MB -334 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 21.0 ms 21.6 ms +0.6 ms
CLI --help 61.3 ms 60.7 ms -0.5 ms

@thymikee

Copy link
Copy Markdown
Member Author

The code looks ready at da6e287. Not blocking: fold on a scoped set still fails earlier at devicectl inventory, before it reaches the HID dispatch this PR fixes (https://github.com/callstack/agent-device/blob/da6e287/packages/platform-apple/src/foldable/pose.ts#L45), and the fake-child cast in the host test is a minor style point — both can be taken or left.

The Smoke Tests failure in the "Restore and build iOS XCTest runner" step (xcrun --sdk iphonesimulator --show-sdk-version timing out, log line 1549) matches the known cold-toolchain flake and looks unrelated to this change: the diff only touches simctl spawn argv for the AX bridge and the fold helper, and neither runs during the toolchain probe or the runner build. The second Smoke Tests job is still queued.

I read the PR body's report of simctl --set <set> spawn for the bridge and the ios.snapshot-source present event, but did not reproduce the scoped-set run myself, and the fold HID route on a scoped set can't be exercised end to end since devicectl fails first. I also did not run the unit tests; the expectation that they'd fail without this fix comes from reading the pre-change code, not from running them.

Please wait for the queued Smoke Tests job to finish green and rerun the job that hit the cold-toolchain flake. It's also worth opening a follow-up issue for the devicectl scoped-set gap, since fold still fails outright there, rather than closing #2784 on this PR.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 23, 2026
@thymikee
thymikee added this pull request to stack #2827 September 23, 2026 15:26
@thymikee
thymikee merged commit 5c0c412 into main Sep 23, 2026
17 of 20 checks passed
@thymikee
thymikee deleted the fix/2784-simctl-spawn-scoped-set branch September 23, 2026 16:55
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-23 16:55 UTC

@thymikee

Copy link
Copy Markdown
Member Author

This is still the case on main at 5c19230. I traced the code and did not run a device.

  • setAppleFoldPose queries the display inventory before it dispatches HID: packages/platform-apple/src/foldable/pose.ts:45-46, then :48.
  • The inventory call is devicectl device info displays --device <udid> and passes no set (packages/platform-apple/src/core/display-inventory.ts:99-104). Any failure becomes unresolved (:105-107, :115-120). pose.ts:65-73 then returns COMMAND_FAILED with a hint to update Xcode, which is misleading here.
  • Even with a set-aware inventory, fold would fail again after dispatch, because the hinge readback also goes only through devicectl (pose.ts:55, then core/hinge-angle.ts:31-47).
  • The HID send is the only set-aware step (foldable/simulator-hid.ts:54).

Filed #2871 as an implementation contract. It asks for one of two outcomes: support the scoped set end to end with verified readback, or refuse up front with a typed UNSUPPORTED_OPERATION reason declared at the fold fact. It also lists completion conditions and the live evidence path.

🤖 Generated with Claude Code

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.

fix(ios): pass the scoped simulator set to the AX bridge and fold simctl spawn calls

1 participant