Skip to content

Handle newer "chosenRuntimeBuild" iOS simulator runtime key on devicelab tests - #194509

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jmagman:chosenRuntimeBuild
Oct 16, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
jmagman:chosenRuntimeBuild

Conversation

@jmagman

@jmagman jmagman commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Newer simctl renamed the preferredBuild key in simctl runtime match list --json to chosenRuntimeBuild. The devicelab only looked for the old key, so it stopped filtering by the selected Xcode and used whatever runtime was listed last.

On a machine with Xcode 27.1 installed that was the iOS 27.1 runtime, which only supports the iPhone Duo device type. simctl create for any iPad or iPhone fails with "Incompatible device".

So:

  • Accept chosenRuntimeBuild or preferredBuild to work on either version
  • Parse simctl list runtimes --json and only consider runtimes whose supportedDeviceTypes includes the requested device. Prefer the selected Xcode's runtime otherwise take the last compatible one. The Map<String, Object?> map parsing was getting crazy and hard to read, so instead replace with a Dart if-case pattern.
  • Bump the iPad used by uiscene_plugin_lifecycle_test_ios from the 3rd gen 11-inch Pro to the M4, which should work on Xcode 26 or 27.

Fixes #194147

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 15, 2026
@jmagman
jmagman marked this pull request as draft October 15, 2026 22:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the iOS simulator device type in uiscene_plugin_lifecycle_test_ios.dart and refactors the simulator runtime selection logic in ios.dart to use structured JSON parsing instead of regex. Feedback suggests optimizing redundant process calls to simctl list runtimes and improving the readability of error messages by formatting the list of available runtimes instead of printing raw JSON.

Comment thread dev/devicelab/lib/framework/ios.dart Resolved
Comment thread dev/devicelab/lib/framework/ios.dart Resolved
@jmagman jmagman changed the title Handle newer chosenRuntimeBuild iOS simulator runtime key on devicelab tests Handle newer "chosenRuntimeBuild" iOS simulator runtime key on devicelab tests Oct 15, 2026
await testWithNewIOSSimulator(
'TestAdd2AppSim',
deviceTypeId: 'com.apple.CoreSimulator.SimDeviceType.iPad-Pro-11-inch-3rd-generation',
deviceTypeId: 'com.apple.CoreSimulator.SimDeviceType.iPad-Pro-11-inch-M4-8GB',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This should work on Xcode 26 or 27

Comment thread dev/devicelab/lib/framework/ios.dart Resolved
@jmagman
jmagman marked this pull request as ready for review October 16, 2026 04:37
@jmagman
jmagman requested a review from hellohuanlin October 16, 2026 04:37

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the iOS simulator runtime selection logic in the devicelab framework to parse the output of simctl list runtimes as JSON and filter runtimes based on their compatibility with the target deviceTypeId. It also updates the simulator device type used in the iOS UI scene plugin lifecycle test. The review feedback identifies a potential regression on older Xcode versions (prior to Xcode 15) where the supportedDeviceTypes key is absent from the JSON output, and suggests making supportedDeviceTypeIds nullable while updating the parsing and filtering logic to prevent runtime errors.

Comment thread dev/devicelab/lib/framework/ios.dart Resolved
Comment thread dev/devicelab/lib/framework/ios.dart Resolved
Comment thread dev/devicelab/lib/framework/ios.dart Resolved

@hellohuanlin hellohuanlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall logic makes sense. Can you add some tests?

if (json.decode(simctlListRuntimesJson) case {'runtimes': final List<Object?> runtimes}) {
return <_SimulatorRuntime>[
for (final Object? runtime in runtimes)
if (runtime case {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

neat

Comment thread dev/devicelab/lib/framework/ios.dart Resolved
@jmagman
jmagman force-pushed the chosenRuntimeBuild branch from af2e9a4 to 7e1d0bc Compare October 16, 2026 20:31
@jmagman

jmagman commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

Overall logic makes sense. Can you add some tests?

Done.

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 16, 2026
Merged via the queue into flutter:master with commit d603405 Oct 16, 2026
22 of 23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…lab tests (flutter#194509)

Newer simctl renamed the `preferredBuild` key in `simctl runtime match
list --json` to `chosenRuntimeBuild`. The devicelab only looked for the
old key, so it stopped filtering by the selected Xcode and used whatever
runtime was listed last.

On a machine with Xcode 27.1 installed that was the iOS 27.1 runtime,
which only supports the iPhone Duo device type. `simctl create` for any
iPad or iPhone fails with "Incompatible device".

So:
- Accept `chosenRuntimeBuild` or `preferredBuild` to work on either
version
- Parse `simctl list runtimes --json` and only consider runtimes whose
`supportedDeviceTypes` includes the requested device. Prefer the
selected Xcode's runtime otherwise take the last compatible one. The
`Map<String, Object?>` map parsing was getting crazy and hard to read,
so instead replace with a Dart
[if-case](https://dart.dev/language/branches#if-case) pattern.
- Bump the iPad used by `uiscene_plugin_lifecycle_test_ios` from the 3rd
gen 11-inch Pro to the M4, which should work on Xcode 26 or 27.

Fixes flutter#194147

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ios] uiscene integration test doesn't use the correct runtime when Xcode 27 is installed

2 participants