Skip to content

tvOS device.io.focus: accessibility-identity focus via bounded Siri Remote traversal#54

Open
setoelkahfi wants to merge 5 commits into
mobile-next:mainfrom
setoelkahfi:feature/tvos-real-device
Open

tvOS device.io.focus: accessibility-identity focus via bounded Siri Remote traversal#54
setoelkahfi wants to merge 5 commits into
mobile-next:mainfrom
setoelkahfi:feature/tvos-real-device

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Jul 15, 2026

Copy link
Copy Markdown

Summary

#53 <- this.

Adds a tvOS device.io.focus JSON-RPC command to the DeviceKit XCTest runner so agents can deterministically move Siri Remote focus to an on-screen element selected by accessibility identity (identifier/label), instead of guessing remote sequences or interpreting screenshots.

This is part of a three-repo upstream change across mobile-next/mobilecli, mobile-next/devicekit-ios, and mobile-next/mobile-mcp.

What's in this PR

  • New tvOS-only device.io.focus handler with bounded (≤50-move) Siri Remote traversal.
  • Success returns the focused SourceTreeElement; failure returns actionable error data including the last focused element.
  • tvOS DumpUI robustness by guarding iOS/SpringBoard-specific normalization behind #if os(iOS).
  • Removes temporary exploration scaffolding and keeps iOS behavior unchanged.

Validation

  • make tvos-ipa-unsigned
  • iOS UITests target still compiles
  • plutil -lint for project file

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

Related PRs

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@setoelkahfi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 400ef376-df0e-4b21-a840-5325be84d6f8

📥 Commits

Reviewing files that changed from the base of the PR and between 4f7e98c and 55e7ab5.

⛔ Files ignored due to path filters (9)
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/bkg.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/logo.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/mask_clean.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/bkg@1x.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/bkg@2x.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/logo@1x.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/logo@2x.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/mask_clean@1x.png is excluded by !**/*.png
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/mask_clean@2x.png is excluded by !**/*.png
📒 Files selected for processing (44)
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json
  • DeviceKitTests/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json
  • DeviceKitTests/JSONRPC/Handlers/DeviceInfo.swift
  • DeviceKitTests/JSONRPC/Handlers/DumpUI.swift
  • DeviceKitTests/JSONRPC/Handlers/IOButton.swift
  • DeviceKitTests/JSONRPC/Handlers/IOFocus.swift
  • DeviceKitTests/JSONRPC/Handlers/IOGesture.swift
  • DeviceKitTests/JSONRPC/Handlers/IOKeys.swift
  • DeviceKitTests/JSONRPC/Handlers/IOLongpress.swift
  • DeviceKitTests/JSONRPC/Handlers/IOOrientationGet.swift
  • DeviceKitTests/JSONRPC/Handlers/IOOrientationSet.swift
  • DeviceKitTests/JSONRPC/Handlers/IOSwipe.swift
  • DeviceKitTests/JSONRPC/Handlers/IOTap.swift
  • DeviceKitTests/JSONRPC/Handlers/IOText.swift
  • DeviceKitTests/JSONRPC/JSONRPCDispatcher.swift
  • DeviceKitTests/JSONRPC/JSONRPCModels.swift
  • DeviceKitTests/JSONRPC/RPCMethodHandler.swift
  • DeviceKitTests/XCTest/EventRecord.swift
  • DeviceKitTests/XCTest/OrientationGeometry.swift
  • DeviceKitTests/XCTest/PointerEventPath.swift
  • DeviceKitTests/XCTest/RunnerDaemonProxy.swift
  • DeviceKitTests/XCTest/SystemPermissionManager.swift
  • DeviceKitTests/XCTestServer.swift
  • DeviceKitTests/devicekit_iosUITests.swift
  • Makefile
  • README.md
  • devicekit-ios.xcodeproj/project.pbxproj
  • devicekit-ios.xcodeproj/xcshareddata/xcschemes/devicekit-tvos.xcscheme
  • scripts/patch-tvos-runner.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

setoelkahfi and others added 5 commits July 15, 2026 15:02
The DeviceKit XCUITest runner now builds for tvOS, so the automation
stack can drive the tvOS Simulator.

- Add a `devicekit-tvos` scheme and tvOS target to the Xcode project,
  plus a `scripts/patch-tvos-runner.sh` helper and Makefile targets that
  build and patch the tvOS runner.
- On tvOS, register a `device.io.button` handler that maps button names
  to `XCUIRemote.Button` presses (up, down, left, right, select, menu,
  home, playPause). tvOS navigates by focus, not touch.
- Keep the touch, keyboard, and orientation handlers iOS-only in the
  JSON-RPC dispatcher, behind `#if os(iOS)`.
- Read the screen size from `UIScreen.main.bounds` on tvOS, since there
  is no SpringBoard to query.
- Guard the remaining iOS-only handlers and helpers with `#if os(iOS)`
  so the shared sources still compile for both platforms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a compiled brandassets catalog (imagestack/imagestacklayer) for the
tvOS UI test runner, wire up ASSETCATALOG_COMPILER_APPICON_NAME and
CFBundleDisplayName on the devicekit-tvosUITests target, and extend
patch-tvos-runner.sh to copy the compiled Assets.car and set
CFBundleIcons/CFBundleDisplayName on the Runner.app so the tvOS test
runner now shows the same Device Kit icon as the iOS one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mirror the iOS real-device flow for tvOS. patch-tvos-runner.sh now takes a
simulator|device argument so it can pull the Swift Testing support libraries
from AppleTVOS.platform for device builds; the new tvos-ipa-unsigned Makefile
target builds the devicekit-tvos runner for generic/platform=tvOS, patches in
the Device Kit display name and icon, and packages an unsigned
devicekit-tvos-runner.ipa for re-signing at install time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a tvOS-only device.io.focus JSON-RPC handler that selects an element
by accessibility identifier/label and drives Siri Remote focus with a
bounded (<=50-move) traversal, returning the focused element on success
or a focusNotFound (-32002) error carrying the last focused element.

- New IOFocusMethodHandler (#if os(tvOS)); registered in the dispatcher
- Re-reads the target frame each move to handle tvOS focus scrolling
- Early-exit on no-progress (dead end / oscillation)
- Guard SpringBoard-specific DumpUI normalisation behind #if os(iOS) so
  tvOS dumps the foreground app's own accessibility hierarchy
- Remove throwaway Viaplay exploration scaffolding + unused import

Implements: SPECS/quality/real-tvos-device-support/SPEC.md (Milestone 4)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allow the tvOS XCTest server to bind CoreDevice IPv6 tunnel addresses while preserving IPv4 localhost behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@setoelkahfi setoelkahfi force-pushed the feature/tvos-real-device branch from 63081f1 to 55e7ab5 Compare July 15, 2026 13:03
@setoelkahfi setoelkahfi marked this pull request as ready for review July 15, 2026 13:48
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