refactor(ios): point xcodebuild at the scoped simulator set and delete the XCTestDevices redirect
Summary
For a simulator in a scoped set (--ios-simulator-device-set), both runner xcodebuild phases now get -DVTSimulatorSetLocation=<set>. With that, xcodebuild resolves and runs the test inside the user's set, so nothing has to swap ~/Library/Developer/XCTestDevices any more. The XCTestDevices redirect is deleted: the symlink and backup, the host-wide lock, the session redirect handle, the simulator_set_redirect handoff and adoption refusals, and the close-retain exclusion for scoped sets.
This removes the data-loss path from #2935 by construction. On Macs whose Xcode shims are armed, the shims run xcodebuild -runFirstLaunch, which cleans XCTestDevices. XCTestDevices now never points at user data, so those cleanups can't delete it. Scoped-set runners also work on those Macs now, where #2947 would have refused them.
Evidence for the key: static presence in every Xcode from 14.0 through 27.1, and live runs on 26.2 and 27.1 (see the #2935 redesign comment). If a future Xcode drops the key, the runner fails with a typed simulator_set_destination_not_found error that names the set path and the Xcode version, and never falls back to a redirect. A one-time cleanup at daemon startup undoes a redirect that an older version left behind. It only touches state that agent-device wrote.
Closes #2935. Supersedes #2947. 31 files. Production +171/−499, net −328. Tests +288/−879.
Validation
Tested head 9e623baff2:
check:affected --runpasses (3758 tests, 497 files, command-docs 12/12). Also passing: typecheck, lint,format:check, layering, and fallow with no issues in changed files (one pre-existing inherited finding, unchanged).apple-runnerproject: 622/622 tests.- Live, Xcode 26.2, armed shims: on a scoped set, a cold
open,snapshot, a runner-backedpress,snapshotandcloseall pass.- Both xcodebuild phases carry the argument.
- A watcher sampled XCTestDevices 116 times, and it was a real directory every time. The device survived 6
-runFirstLaunchcleanups, includingsimctl --set XCTestDevices delete allduring the build. - A fresh daemon adopted the scoped runner, which main refused.
- The default set works unchanged, with no argument added.
- Live, daemon-startup legacy-redirect restore (v0.21.14 leftovers): three runs — a symlink with its backup, a symlink with no backup, and a read-only
Library/Developer(EACCES) — the daemon stays up in all three, and each outcome is recorded in daemon.log. A scoped runner start with no per-start restore call still resolves and interacts correctly, with the hostXCTestDevicesdirectory untouched throughout. - The
simulator_set_destination_not_foundmessage text is now captured from real Xcode 26.2 output (three xcodebuild invocations, all exit 70), not invented. - The pipeline ran three adversarial reviews, a final ship review, and a maintainer review round.
- Xcode coverage: there is live evidence on 26.2 and 27.1. Older Xcodes are out of scope, because App Store submission now requires building with Xcode 26 or 27.