Skip to content

fix(apple): parse parenthesized xctrace physical device format#1360

Merged
thymikee merged 4 commits into
mainfrom
devin/1355-xctrace-parenthesized-physical-devices
Jul 22, 2026
Merged

fix(apple): parse parenthesized xctrace physical device format#1360
thymikee merged 4 commits into
mainfrom
devin/1355-xctrace-parenthesized-physical-devices

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Fixes part of #1355.

xcrun xctrace list devices now emits physical devices as Device Name (OS Version) (device-id), while the legacy Device Name [device-id] format is still in circulation. The parser in parseXctracePhysicalAppleDevices only recognized the bracket form, so iPhone 8 Plus-class physical devices were missing from agent-device devices --platform ios.

What changed:

  • XCTRACE_DEVICE_LINE_PATTERN in src/platforms/apple/core/devices.ts now accepts both:
    • My iPhone [00008020-001C2D2234567890]
    • iPhone 8 Plus (16.7.16) (00008020-001C2D2234567890)
  • It captures an optional parenthesized OS version and reads the device id from either [id] or (id).
  • The OS version is included as an extra descriptor when resolving appleOs, giving the same ios/ipados/tvos/visionos classification as before.
  • Added a regression test covering the parenthesized format for iPhone, iPad, and Apple TV devices.

This intentionally does not tackle the larger devicectl fallback work described in #1355; it only fixes the discovery parser so the device is no longer silently dropped.

Link to Devin session: https://app.devin.ai/sessions/5d7319f5e4d4404c95bf6f2988ae8553
Requested by: @thymikee

Accept the new 'Device Name (OS Version) (device-id)' output from xctrace list devices while preserving the legacy bracket format.

Relates to #1355

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@thymikee thymikee self-assigned this Jul 22, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.8 MB 1.8 MB +287 B
JS gzip 578.0 kB 578.1 kB +111 B
npm tarball 692.7 kB 692.8 kB +83 B
npm unpacked 2.4 MB 2.4 MB +287 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.5 ms 26.5 ms +1.1 ms
CLI --help 55.4 ms 56.2 ms +0.8 ms

Top changed chunks: no changes in the largest emitted chunks.

Extract device line parsing and DeviceInfo construction into focused helpers so the discovery loop stays under fallow thresholds.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@thymikee

Copy link
Copy Markdown
Member

Re-review of 740462fa: changes requested.

[P1] XCTRACE_DEVICE_LINE_PATTERN makes the optional (osVersion) apply to both the new parenthesized-ID form and the legacy bracket-ID form. That regresses valid legacy device names ending in parentheses: Office iPhone (2) [udid] is parsed as name Office iPhone plus OS version 2, while Alex's (iPhone) [udid] becomes name Alex's and is silently dropped by target resolution. This can also break name-based --device selection for devices that were previously discoverable.

Parse the legacy [id] syntax separately so its full name is preserved, and only interpret (version) for the current (version) (id) syntax. Add a regression for a bracket-format device name containing parentheses. After fixing, attach exact-head agent-device devices --platform ios output for the reported iPhone 8 Plus; opening it can remain explicitly out of scope as #1355 describes.

All exact-head CI checks are green. Do not apply labels.

…OS version

Only treat 'Name (version) (id)' as the new parenthesized xctrace format; preserve the full name for legacy 'Name [id]' lines, including names that contain parentheses.

Addresses review feedback in #1360.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Fixed the review points in fc188ab10.

  • XCTRACE_DEVICE_LINE_PATTERN now matches [id] directly and only interprets (version) (id) for the new parenthesized form. This preserves full names like Office iPhone (2) and Alex's (iPhone) for legacy bracket-format lines.
  • Added a regression test for bracket-format device names that contain parentheses.

I can't attach the exact-head agent-device devices --platform ios output for the reported iPhone 8 Plus from this environment — it doesn't have macOS/Xcode or a physical iOS device. The parser regression tests cover the iPhone 8 Plus (16.7.16) (udid) format directly.

@thymikee

Copy link
Copy Markdown
Member

Re-review of fc188ab: the prior parser finding is fixed. The legacy [id] branch now preserves the full device name, only the current (version) (id) branch captures an OS version, and the new regression is non-vacuous. The Apple TV fixture now also matches the documented current format. All 24 exact-head checks are green; no remaining code findings.

Readiness is still blocked by practical evidence. The author confirmed this environment has no macOS/Xcode/physical iOS device, so there is no exact-head agent-device devices --platform ios result for the reported iPhone 8 Plus. Per the repository’s device-facing readiness rule, please have someone run that discovery command on fc188ab and attach the output. Opening a session remains explicitly out of scope under #1355.

ready-for-human remains withheld only for that evidence gap.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I can't produce the exact-head agent-device devices --platform ios output for the iPhone 8 Plus from this environment — it's Linux and has no macOS/Xcode or physical iOS device, so xctrace/devicectl aren't available. The regression tests cover both the new Name (version) (id) format and the legacy Name [id] format with parentheses in the name.

Could you (or anyone with the reported iPhone 8 Plus setup) run that command against fc188ab and paste the output here? Opening a session can stay out of scope per #1355.

@thymikee

Copy link
Copy Markdown
Member

Validated on exact head fc188ab10 on macOS with Xcode and a connected physical iPhone.

xcrun xctrace list devices reported the current parenthesized physical-device form:

<redacted device name> (26.5.2) (<redacted UDID>)

After pnpm build and pnpm clean:daemon, the built CLI correctly discovered it:

<redacted device name> (ios device target=mobile) booted=true

No session was opened; that remains out of scope for #1355. pnpm check:affected --base origin/main --run also passed on this exact head.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Thanks for validating this on exact head with a physical iPhone. Good to see the parenthesized xctrace format is discovered correctly and check:affected passes.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the exact-head physical-device check. This confirms the parenthesized xctrace format exists on a real device, but it does not yet clear the practical-evidence blocker. The tested iOS 26.5.2 phone is not the reported legacy device, and listAppleDevices merges devicectl results before xctrace, so the shown CLI entry may have come entirely from devicectl even if the changed parser were broken. Please attach exact-head output for the reported iPhone 8 Plus, or show the tested UDID absent from xcrun devicectl list devices while present in both xcrun xctrace list devices and agent-device devices --platform ios. Code review and CI remain clean; ready-for-human stays withheld only for this route-specific device evidence.

When devicectl reports no devices, listAppleDevices must source the physical device from the parenthesized xctrace output.

Addresses review feedback in #1360.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Added a route-specific unit test (listAppleDevices falls back to xctrace parenthesized devices when devicectl reports none) that stubs devicectl list devices to return an empty list and xctrace list devices to return the parenthesized iPhone 8 Plus (16.7.16) (udid) line. It asserts listAppleDevices produces exactly that physical device, so the CLI entry cannot come from devicectl.

I still can't attach an exact-head run on the reported iPhone 8 Plus from this Linux environment. If you have access to that device, could you run agent-device devices --platform ios on c165b6861 and paste the output?

@thymikee

Copy link
Copy Markdown
Member

Good catch: the first run was not route-specific. devicectl does contain the tested device’s hardware UDID, so it could have supplied the merged CLI result.

I reran exact head fc188ab10 with an isolated, temporary xcrun shim that deliberately made only devicectl fail while delegating simctl and xctrace to the real Xcode tools. That forces the production listAppleDevices fallback route to consume real xctrace list devices output.

The connected physical device was still discovered by the built CLI:

<redacted device name> (ios device target=mobile) booted=true

The source xctrace line was the current parenthesized form:

<redacted device name> (26.5.2) (<redacted UDID>)

This proves the changed parser route against a real physical device, though it is not the originally reported iPhone 8 Plus. The shim and isolated daemon state were removed after the run; no session was opened.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Thanks for doing the isolated shim validation — that's a clean way to force the xctrace-only fallback route on a real physical device. Good to confirm the parenthesized parser works in the production listAppleDevices path when devicectl is unavailable.

@thymikee

Copy link
Copy Markdown
Member

Re-review of c165b686: no findings. The new listAppleDevices regression forces an empty devicectl inventory and proves the parenthesized xctrace device reaches the shipped discovery result; reverting the parser or removing the xctrace merge makes it fail. All 24 exact-head checks are green. The isolated physical-device run also forced devicectl failure while using real xctrace output, so the remaining device-evidence blocker is cleared. The original iPhone 8 Plus remains untested, but that exact line is covered by both parser and orchestration regressions; this is non-blocking. Ready for human review.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Jul 22, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Thanks for the final review and for running the isolated shim validation. All exact-head checks are green and the route-specific regression is in place, so this is ready for the next human reviewer.

@thymikee
thymikee merged commit 611c7ed into main Jul 22, 2026
24 checks passed
@thymikee
thymikee deleted the devin/1355-xctrace-parenthesized-physical-devices branch July 22, 2026 15:13
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-22 15:13 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant