Skip to content

Support devicectl JSON version 5 - #193

Merged
rolfbjarne merged 4 commits into
dotnet:mainfrom
rolfbjarne:dev/rolf/fix-26482
Sep 16, 2026
Merged

rolfbjarne merged 4 commits into
dotnet:mainfrom
rolfbjarne:dev/rolf/fix-26482

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Parse the new properties dictionary with compatibility fallbacks for deprecated fields, and cover the new JSON shape.

Ref: dotnet/macios#26482.

Parse the new properties dictionary with compatibility fallbacks for deprecated fields, and cover the new JSON shape.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 14:36

Copilot AI 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.

🟡 Changes recommended

Nested v5 lookups, CPU fallback handling, and mixed-format test coverage need correction.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates devicectl parsing for JSON version 5 while preserving deprecated-field compatibility.

Changes:

  • Parses the new nested properties structure.
  • Adds compatibility fallbacks for deprecated fields.
  • Adds version 5 parser test coverage.
File summaries
File Description
Xamarin.MacDev/DeviceCtlOutputParser.cs Adds v5 property parsing and compatibility fallbacks.
tests/DeviceCtlOutputParserTests.cs Adds coverage for the v5 JSON structure.
Review details

Suppressed comments (2)

Xamarin.MacDev/DeviceCtlOutputParser.cs:62

  • The compatibility path is not exercised by the tests: the legacy case has no properties object, while the v5 case has no deprecated fields. If a v5 payload omits one field but still supplies it through deviceProperties, hardwareProperties, or connectionProperties, a regression in this per-field fallback ordering would pass both tests. Add a mixed-format case that verifies the deprecated value is used for a missing new field.
					info.Name = GetString ("name", newDeviceProperties, stateProperties, properties, deviceProperties);
					info.BuildVersion = GetString ("osBuildUpdate", stateProperties, newDeviceProperties, properties, deviceProperties);
					info.OSVersion = GetString ("osVersionNumber", stateProperties, newDeviceProperties, properties, deviceProperties);
					info.Udid = GetString ("udid", newHardwareProperties, properties, hardwareProperties);

tests/DeviceCtlOutputParserTests.cs:100

  • The new test fixture is not the Xcode 27 v5 shape: it puts osBuildUpdate and osVersionNumber directly under properties.state, but v5 nests them under properties.software as osBuildVersions.buildVersion.name and osVersionNumber.stringValue. It therefore passes against the current incorrect lookups and would not catch the missing v5 support; update the fixture to the real nested shape (and put name under state).
							""state"": {
								""osBuildUpdate"": ""23B85"",
								""osVersionNumber"": ""18.1"",
								""pairingState"": ""paired""
							}
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Xamarin.MacDev/DeviceCtlOutputParser.cs Outdated
Comment thread Xamarin.MacDev/DeviceCtlOutputParser.cs Outdated
Read build and OS version values from the nested software objects emitted by Xcode 27 while retaining the legacy compatibility fallbacks. Resolve CPU architecture by the first non-empty name so numeric-only v5 cpuType objects do not hide the deprecated named value. Update the v5 fixture to reflect the observed payload and exercise mixed-format fallback behavior.

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

Copilot AI 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.

🟡 Changes recommended

CPU architecture parsing still depends on deprecated data for v5 devices.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread Xamarin.MacDev/DeviceCtlOutputParser.cs Outdated
Translate the Mach CPU type and subtype values in the Xcode 27 properties payload into the architecture names expected by PhysicalDeviceInfo. Preserve named architecture fallback for legacy and unknown payloads, and cover both arm64e and arm64 without deprecated CPU data.

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

Copilot-Session: 891a4a77-04cb-4497-8c29-83759604e389

Copilot AI 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.

🟡 Changes recommended

Handle unsigned 64-bit CPU subtypes and add a regression test before approval.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread Xamarin.MacDev/DeviceCtlOutputParser.cs
Read Xcode 27 CPU subtype values as UInt64 so sign-extended ARM64e values retain their low-byte architecture discriminator. Update the v5 regression fixture to use the exact unsigned value emitted by devicectl.

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

Copilot-Session: 891a4a77-04cb-4497-8c29-83759604e389

Copilot AI 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.

🟢 Approval recommended

No unresolved issues were identified, and regression coverage is included.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@rolfbjarne
rolfbjarne merged commit 8cd05c6 into dotnet:main Sep 16, 2026
5 of 7 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/fix-26482 branch September 16, 2026 16: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.

3 participants