Skip to content

refactor(ios): drop the transport seam usbmux-first made dead - #1540

Open
thymikee wants to merge 1 commit into
mainfrom
refactor/drop-dead-usbmux-transport-seam
Open

refactor(ios): drop the transport seam usbmux-first made dead#1540
thymikee wants to merge 1 commit into
mainfrom
refactor/drop-dead-usbmux-transport-seam

Conversation

@thymikee

@thymikee thymikee commented Aug 1, 2026

Copy link
Copy Markdown
Member

Answering "is there code we can safely drop now that usbmux is primary?" — yes, this much.

What went dead

IosPhysicalDeviceControl exposed:

resolveRunnerTransport(device, timeoutBudgetMs): Promise<
  { kind: 'network'; tunnelIp: string | null } | { kind: 'usbmux' }
>

That predates #1517, when the control still chose the transport. Since #1517 the route resolver chooses: it returns a usbmux route for an XCTest device, and for a CoreDevice device too, reaching the control only after usbmux has reported the device unattached. At that point the sole question left is "what is the tunnel address".

So the usbmux arm has no live producer or consumer:

  • the resolver's if (transport.kind === 'usbmux') branch was unreachable — the only control that gets that far is CoreDevice, which always answers network
  • the XCTest implementation returning { kind: 'usbmux' } was called only from a test; production returns a usbmux route before it

Change

  • collapse the union to IosPhysicalDeviceTunnel = { tunnelIp: string | null } — one shape, so no discriminator to carry
  • rename resolveRunnerTransportresolveTunnel, which is what it now does; the old name advertised a decision this seam no longer makes
  • delete the unreachable branch in the resolver
  • XCTest now rejects a tunnel lookup, matching how it already rejects app inventory, process lookup and runner file copy — it has no CoreDevice tunnel, which is exactly why the resolver never asks it for one

Behaviour is unchanged: every path that ran before runs the same way. This removes a false affordance rather than a feature — the interface implied XCTest devices resolve a transport, when the transport question was settled upstream.

Testing

The one test that exercised the dead path now asserts the rejection instead of a value production never produced, matching its sibling tests for the other unsupported XCTest operations. physical-device-control and runner-transport suites pass (19 tests); typecheck and lint clean.

On the gate run

check:affected reports failures in help-conformance-bench, install-source (unzip exited with code 9), owner-identity, device-claims and android-recording. Two of those are assertion failures, which I would normally treat as blocking rather than flake — so I checked rather than assumed: all 51 of those tests pass in isolation, both with and without this change, and none of them are reachable from a diff that touches only Apple physical-device control, the Apple route resolver, and one Apple test. The host has been driving real devices and xcodebuild for hours; unzip failing with a subprocess code and a process-liveness check flipping are both load-sensitive.

Worth a separate look if they recur on a quiet machine — I would rather flag that than bury it.

The physical-device control exposed resolveRunnerTransport returning either a
network tunnel or usbmux, from before the route resolver decided transports.
Since #1517 the resolver returns a usbmux route for XCTest devices and for any
attached CoreDevice one, and only reaches the control after usbmux has reported
the device unattached — so the control is asked exclusively for a tunnel.

That left the usbmux arm with no live producer or consumer: the branch handling
it in the resolver was unreachable, and the XCTest implementation returning it
was called only by a test.

Collapse the union to the one shape that is resolved, rename the seam to say
what it does, delete the unreachable branch, and let XCTest reject a tunnel
lookup the way it already rejects app inventory and process lookup — it has no
CoreDevice tunnel, which is why the resolver never asks it for one.
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.92 MB 1.92 MB -2.8 kB
JS gzip 615.5 kB 614.6 kB -890 B
npm tarball 733.5 kB 732.6 kB -926 B
npm unpacked 2.57 MB 2.57 MB -2.8 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.0 ms 22.1 ms -0.9 ms
CLI --help 47.0 ms 46.3 ms -0.6 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/physical-device-control.js +23.1 kB +7.6 kB
dist/src/screenshot-result.js -3.3 kB -910 B
dist/src/runner-disposal.js -52 B -18 B
dist/src/internal/daemon.js +41 B +16 B
dist/src/session.js +363 B -13 B

@thymikee

thymikee commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

Re-reviewed at 08be0f5: code clean and all CI green. The resolver still owns transport choice: XCTest never reaches tunnel lookup, while CoreDevice reaches resolveTunnel only after the typed usbmux-unattached verdict. Existing route tests cover usbmux-first, CoreDevice same-attempt fallback, and XCTest’s terminal cable hint; the new rejection test makes the removed test-only seam explicit. Remaining readiness evidence: please attach an exact-head physical CoreDevice replay for the cabled usbmux path and Wi-Fi tunnel fallback, or document the concrete device-availability blocker.

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