You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 17eabc8
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(android): separate adb transport addressing from the command payload (#2632)
* refactor(android): separate adb transport addressing from the command payload
One array carried two meanings: which device and which adb server a call was
for, and what to run on it. Five relays read and rewrote the first meaning out
of the second — findAdbSerialIndex, readAdbSerial, stripAdbSerialArgs,
withServerPort, assertManagedAdbCommand — and a provider handed that array had
to undo the stitching to recover the command its caller actually asked for.
An invocation now carries the two apart:
`{ target: { selector, server, waitFor?, hostGlobals? }, command, rawArgv? }`.
One table holds the argv grammar — global option arity, the 20
`wait-for[-TRANSPORT][-STATE]` forms, the server and transport commands a
device-scoped call must never reach — and one parse/serialize pair reads and
writes it. `command` is appended and never re-parsed; a request nobody rewrote
is emitted as the argv it arrived in.
Four rules stop being implied:
- a private adb server travels in the addressing that owns it, so a per-call
`serverPort` cannot move a leased route onto another server;
- under a private server, globals that transport cannot restate are refused
rather than answered with addressing quietly left behind;
- a forwarding provider receives the caller's argv with only the scope's own
`-s` pair removed, so a readiness token survives the hop;
- one typed refusal answers every mismatch, over device, target, or server.
`provider-limrun` drops its structural copy of the invocation type and its own
argv projection, and hands an ADB failure the invocation it addressed. The root
host lowers a typed request in one function, which the test host now shares
instead of imitating.
Design trace and route table: #2617. Production: 12 files, +722/-265.
* refactor(android): refuse a caller-named adb server on a private transport
A `-P` naming another server used to be rewritten onto the port the transport holds, so a caller who
asked for 5037 could read a zero exit as an answer about 5037. One rule now covers every channel,
argv or option: name no port and the transport uses its own; name this one and it is accepted; name
another and the call is refused before dispatch.
The provider-forwarding branch checks the parsed argv as well, because a provider receives argv and
would hand the caller's `-P` to an adb it does not address. Ambient adb is untouched: with no
private server named, the caller's argv is what runs.
Each refusal is pinned at the process boundary — the fake adb records what it was asked, and the
refused requests appear nowhere in that log.
* test(android): reach the server rule through the provider-forwarding branch
A `-P` of `9_999` parses to no port at all, so the pair stayed an unowned global and the older
host-global refusal answered the call before the server rule ever saw it: the assertion passed
without reaching the check it was written to pin. The port now parses, the assertion names the
server refusal, and a port naming the server this lease holds is pinned on the same branch as what
the provider is handed.
Removing the server check from `requireManagedAndroidAdbAddressing` now fails four tests across the
provider branch, the device route, the reachability run, and the root host.
* docs(changelog): record the adb server refusal replacing the argv rewrite
Names the three surfaces it reaches, and what does not change: a request naming no server or the
server its route holds, and ambient adb.
* test(limrun): pin the tunnel addressing the Android cluster hands its host port
The live Limrun lane cannot run here, and these are the two call sites it would have validated, so
the shapes it checks are pinned where they are decided. The tunnel serial rides on the invocation's
target and never enters the command array the caller wrote; ending the tunnel is a server-level
command that selects no device and names the serial where adb expects to read it; and reader cleanup
leaves no serial addressable on the session.
* refactor(limrun): build adb invocations through the platform builders
The provider wrote an AndroidAdbTarget by hand, so a field added to that type
could drift without an error. The composition root now hands it
deviceAdbInvocation and hostAdbInvocation, both built with androidAdbInvocation
over androidAdbSerialTarget / the new androidAdbHostTarget, which is also what
parseAndroidAdbArgv reads an unaddressed argv as. The provider keeps the
addressing decision, not its syntax.
It cannot import the mechanics facet itself: ADR-0019 keeps a provider's eager
closure off concrete platform implementation, which
eager-closure-budgets.test.ts reports as soon as the edge appears.
0 commit comments