Skip to content

Real Apple TV (tvOS) automation: CoreDevice identity, agent lifecycle, tunnel transport#3

Closed
setoelkahfi wants to merge 4 commits into
mainfrom
feature/ios-wireless-coredevice
Closed

Real Apple TV (tvOS) automation: CoreDevice identity, agent lifecycle, tunnel transport#3
setoelkahfi wants to merge 4 commits into
mainfrom
feature/ios-wireless-coredevice

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

Adds real Apple TV (tvOS) automation support to mobilecli so a physical Apple TV discovered over CoreDevice can be driven end to end — device discovery, app lifecycle, agent install/lifecycle, accessibility dumps, screenshots, and Siri Remote input — without falling back to go-ios (device not found) or screenshot-guessed navigation.

This is part of a three-repo change (initial PRs target the setoelkahfi forks; upstream mobile-next PRs are deferred until the three-repo E2E is green).

What's in this PR (Milestones 1–3, 6)

  • M1 — CoreDevice identity + app-op parity: retain both the public hardware UDID and the CoreDevice identifier on IOSDevice; derive tvOS state from CoreDevice boot/tunnel state; add CoreDevice (devicectl) branches for terminate/install/uninstall/openURL so real Apple TV app ops no longer hit the go-ios device not found path.
  • M2 — agent install --agent-path <ipa>: sideload a locally built runner (skips download + pinned checksum, keeps re-sign + install); cache the signed runner and a generated .xctestrun under the app cache, device-bound. The release path stays checksum-verified.
  • M3 — runner lifecycle + tunnel transport: start the tvOS runner via xcodebuild test-without-building with the cached .xctestrun, and talk to the DeviceKit server directly over the CoreDevice tunnel IP (net.JoinHostPort, never LAN / never 0.0.0.0). Reuse healthy sessions, restart stale ones, own + clean up the child process on shutdown. Per-platform Siri Remote button gating; tvOS dump ui retains focusable element types.
  • mobilecli io focus (device.io.focus RPC passthrough) for accessibility-identity focus.
  • M6: device-free unit tests for identity retention, platform/state dispatch, --agent-path override, cache keying, button gating, and terminate PID resolution.

Validation

  • go build ./..., go test ./... -race (all packages), gofmt clean. Lint is advisory in CI (make lint || true); new files are lint-clean.
  • Physical Bedroom Apple TV E2E: see the workspace tracking PR.

Guardrails

  • DeviceKit server is never exposed on the regular LAN (tunnel-IP transport only).
  • No hard-coded fork/user paths in runtime defaults; no provisioning-profile/credential logging; iOS and tvOS runner bundle ids kept distinct; public CLI/JSON shapes additive-only.

Implements: SPECS/quality/real-tvos-device-support/SPEC.md

Related PRs (three-repo change)

setoelkahfi and others added 4 commits July 15, 2026 09:43
mobilecli can now list and drive tvOS simulators, not just iOS ones.

- Recognise tvOS runtimes when parsing the simulator runtime string and
  report the `tvos` platform. Version parsing now also handles tvOS,
  watchOS, and xrOS.
- Pick the DeviceKit runner bundle id and process name based on the
  platform, so the `devicekit-tvosUITests` runner is found on tvOS.
- Install the arm64 tvOS runner artifact during agent install, with its
  own version and checksum entries.
- Map the tvOS Siri Remote buttons (UP, DOWN, LEFT, RIGHT, SELECT, MENU,
  PLAY_PAUSE) in the WDA press-button client.
- Include tvOS devices when resolving device model metadata.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Real Apple TV units are discovered over the same go-ios path as iPhones and
iPads, so detect them by product type (AppleTV*) and report platform tvos.
Route real tvOS devices through a shared installResignedRunner helper that
downloads devicekit-tvos-runner.ipa and re-signs it with the provisioning
profile, and suffix-match the tvOS runner bundle id so the re-signed,
team-prefixed id is recognised. Add unit tests for platform detection and
agent matching.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Milestones 1-3 for real Apple TV automation:

M1 - Retain both device identifiers (public hardware UDID +
CoreDevice identifier) on IOSDevice; derive tvOS state from CoreDevice
boot/tunnel state; add CoreDevice branches for terminate/install/
uninstall/openURL so real Apple TV app ops no longer hit go-ios
'device not found'.

M2 - Add 'agent install --agent-path <ipa>' to sideload a locally built
runner (skips download + pinned checksum, keeps re-sign + install); cache
the signed runner and a generated .xctestrun under the app cache, bound
to the device. Release path stays checksum-verified.

M3 - Start the tvOS runner via 'xcodebuild test-without-building' with the
cached .xctestrun and talk to the DeviceKit server directly over the
CoreDevice tunnel IP (net.JoinHostPort, never LAN/0.0.0.0). Reuse healthy
sessions, restart stale ones, own+clean up the child process on shutdown.
Per-platform Siri Remote button gating; tvOS dump ui retains focusable
element types.

Also add 'mobilecli io focus' (device.io.focus RPC passthrough) for
accessibility-identity focus, and device-free unit tests for identity
retention, platform/state dispatch, artifact override, cache keying,
button gating, and terminate PID resolution.

Implements: SPECS/quality/real-tvos-device-support/SPEC.md (Milestones 1-3, 6)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@setoelkahfi

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR mobile-next#299. Keeping the branch as the source branch for upstream review.

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