Skip to content

Add tvOS simulator support#292

Open
setoelkahfi wants to merge 1 commit into
mobile-next:mainfrom
setoelkahfi:feature/tvos-support
Open

Add tvOS simulator support#292
setoelkahfi wants to merge 1 commit into
mobile-next:mainfrom
setoelkahfi:feature/tvos-support

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Jun 30, 2026

Copy link
Copy Markdown

What

mobilecli can now list and drive tvOS simulators, not just iOS ones.

Changes

  • Recognises tvOS runtimes when parsing the simulator runtime string and reports the tvos platform. Version parsing also handles tvOS, watchOS, and xrOS.
  • Picks the DeviceKit runner bundle id and process name per platform, so the devicekit-tvosUITests runner is found on tvOS.
  • Installs the arm64 tvOS runner artifact during agent install, with its own version and checksum entries. The tvOS runner is arm64-only for now.
  • Maps the tvOS Siri Remote buttons (UP, DOWN, LEFT, RIGHT, SELECT, MENU, PLAY_PAUSE) in the WDA press-button client.
  • Includes tvOS devices when resolving device model metadata.

Notes

The tvOS runner checksum currently points at a locally built artifact. Update it once the runner is published from a devicekit-ios release.

Testing

mobilecli devices lists a booted tvOS simulator with platform: tvos, and io button presses move its focus as expected.

Related

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>
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds tvOS simulator support to the agent installation pipeline and simulator device abstraction. New constants define the tvOS agent version, runner bundle ID, and artifact checksum. The simulator runtime parser is extended to handle tvOS/watchOS/xrOS strings, and new helpers derive the platform identifier, runner bundle ID suffix, and runner process name per platform. The agent install command gains a tvos branch (simulator-only, arm64-enforced). WDA process discovery and agent bundle lookup now use platform-specific runner names. PressButton gains tvOS Siri Remote key mappings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding tvOS simulator support.
Description check ✅ Passed The description is clearly related to the changeset and matches the tvOS simulator support work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli/agent.go (1)

270-283: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

runtime.GOARCH blocks Rosetta-on-Apple-Silicon installs. An amd64 CLI build still maps to x86_64, so the tvOS branch rejects the arm64 simulator runner even on a supported Apple Silicon host. Use host/simulator architecture here instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/agent.go` around lines 270 - 283, The tvOS install path in
installAgentOnSimulator is using runtime.GOARCH to decide the runner
architecture, which incorrectly rejects Apple Silicon hosts running an amd64 CLI
under Rosetta. Update the architecture selection logic in
installAgentOnSimulator so it uses the actual host/simulator architecture rather
than the Go build architecture, and keep the tvOS arm64-only check aligned with
that value so supported Apple Silicon installs are not blocked.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/agent.go`:
- Around line 31-33: The pinned tvOS archive checksum in the install mapping is
still tied to a locally built artifact, so the new tvOS path in
downloadAndInstallAgent() cannot verify the GitHub release successfully. Update
the checksum/version entry used for the devicekit-tvos-Sim-arm64.zip artifact to
match the published release before shipping, or add an explicit early error in
downloadAndInstallAgent() / the tvOS install path that reports the runner is not
published yet instead of attempting the install.

---

Outside diff comments:
In `@cli/agent.go`:
- Around line 270-283: The tvOS install path in installAgentOnSimulator is using
runtime.GOARCH to decide the runner architecture, which incorrectly rejects
Apple Silicon hosts running an amd64 CLI under Rosetta. Update the architecture
selection logic in installAgentOnSimulator so it uses the actual host/simulator
architecture rather than the Go build architecture, and keep the tvOS arm64-only
check aligned with that value so supported Apple Silicon installs are not
blocked.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 90092912-a644-496c-a26a-41e70ca2ab3c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b0278e and 754a9ed.

📒 Files selected for processing (5)
  • cli/agent.go
  • devices/common.go
  • devices/ios.go
  • devices/simulator.go
  • devices/wda/press-button.go

Comment thread cli/agent.go
Comment on lines +31 to +33
// tvOS simulator runner is published from the same devicekit-ios release.
// Update this checksum whenever the tvOS runner artifact is rebuilt/republished.
"devicekit-tvos-Sim-arm64.zip": "49061f17046055c7e89dbf27067a59ab0bffd9d7d14d63031d5411c5963ccb81",

@coderabbitai coderabbitai Bot Jun 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

The pinned tvOS checksum makes the new install path unreleasable.

downloadAndInstallAgent() only accepts the archive fetched from the GitHub release after SHA-256 verification. The PR notes this hash is still from a locally built tvOS artifact, so the new tvos install flow cannot succeed as shipped. Please update the checksum/version pair before merge, or fail earlier with an explicit “runner not published yet” error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/agent.go` around lines 31 - 33, The pinned tvOS archive checksum in the
install mapping is still tied to a locally built artifact, so the new tvOS path
in downloadAndInstallAgent() cannot verify the GitHub release successfully.
Update the checksum/version entry used for the devicekit-tvos-Sim-arm64.zip
artifact to match the published release before shipping, or add an explicit
early error in downloadAndInstallAgent() / the tvOS install path that reports
the runner is not published yet instead of attempting the install.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mentioned there in the comment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@setoelkahfi Acknowledged — I did see the comment.

My concern is that the note documents the limitation, but the code path in cli/agent.go will still try to download and verify the tvOS artifact at runtime. If that checksum is still for a locally built archive, the agent install flow for tvOS will fail rather than degrade gracefully.

So I’d still consider this open unless one of these happens before merge:

  • the checksum/version is updated to the published artifact, or
  • the tvOS install path returns an explicit early error like “tvOS runner not published yet”.

(•ㅅ•)ゞ

@gmegidish

Copy link
Copy Markdown
Member

@setoelkahfi thank you so much for this PR. I'll take a look. I see you also updated mobile-mcp, thank you so much for this! This also means mobilewright may inherit this automatically :). I'll 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.

2 participants