…provider scope
request-handler-chain.ts threaded a platform-concrete androidAdbExecutor
parameter through the generic RequestHandlerChainParams, flattened out of
request-router.ts's already-existing generic per-request provider-injection
mechanism (RequestPlatformProviderScope, built by
withRequestPlatformProviderScope in request-platform-providers.ts) and passed
down as a separately named chain-level slot.
RequestHandlerChainParams now carries the neutral providerScope:
RequestPlatformProviderScope instead of a platform-named field. The session
route (the sole in-chain consumer) reads params.providerScope.androidAdbExecutor
when building handleSessionCommands' own params, which is unchanged.
request-router.ts passes the whole resolved providerScope straight through
instead of extracting androidAdbExecutor out of it first. The generic chain
signature no longer names any platform.
## Why this is behavior-neutral
- The exact same RequestPlatformProviderScope object (and its
androidAdbExecutor field, resolved the same way by
withRequestPlatformProviderScope) now reaches the session handler; only the
path it travels through RequestHandlerChainParams changed, not its value or
resolution.
- session.ts, session-doctor.ts, session-doctor-android.ts,
session-native-perf.ts, and session-observability.ts — everything
downstream of handleSessionCommands — are untouched.
- Full provider-integration coverage (android-lifecycle.test.ts's "Android
Settings flow uses scripted ADB provider", doctor.test.ts,
android-recording.test.ts, etc.) exercises the real end-to-end wiring
through the daemon route and passes unchanged.
## Validation
- New wiring-equivalence test
(request-handler-chain-provider-scope.test.ts) mocks handleSessionCommands
and proves the exact androidAdbExecutor function reference passed into
providerScope reaches it unchanged for a session-routed request, and that
an empty provider scope forwards undefined (as before).
- pnpm exec tsc -p tsconfig.json — clean
- pnpm check:layering — 136/136 structural tests pass
- pnpm check:affected --run — 80 test files / 337 tests passed (including
the full provider-integration suite), plus format, lint, layering,
build/declarations, and vitest-related checks
Part of #1739 (wave 0).
What changed
src/daemon/request-handler-chain.tsthreaded a platform-concreteandroidAdbExecutor?: AndroidAdbExecutorparameter through the genericRequestHandlerChainParams. That value was already produced by the daemon'sexisting generic per-request provider-injection mechanism —
RequestPlatformProviderScope, built bywithRequestPlatformProviderScopeinrequest-platform-providers.ts— butrequest-router.tsflattened it out(
androidAdbExecutor: providerScope.androidAdbExecutor) into a separatelynamed chain-level slot before calling
runRequestHandlerChain.This PR:
RequestHandlerChainParams.androidAdbExecutorwithproviderScope: RequestPlatformProviderScope.runSessionHandler, the sole in-chain consumer)to read
params.providerScope.androidAdbExecutorwhen buildinghandleSessionCommands' own params — which is otherwise unchanged.request-router.tsto pass the whole resolvedproviderScopethrough instead of extracting
androidAdbExecutorout of it first.The generic chain signature no longer names any platform.
Why this is behavior-neutral
RequestPlatformProviderScopeobject — and itsandroidAdbExecutorfield, resolved the same way bywithRequestPlatformProviderScope— now reaches the session handler; onlythe path it travels through
RequestHandlerChainParamschanged, not itsvalue or how it's resolved.
handleSessionCommands(session.ts,session-doctor.ts,session-doctor-android.ts,session-native-perf.ts,session-observability.ts) is untouched.end-to-end through the daemon route (
android-lifecycle.test.ts's "AndroidSettings flow uses scripted ADB provider",
doctor.test.ts,android-recording.test.ts, etc.) passes unchanged.I did not find a case where this DI slot could not be absorbed without
changing production behavior — the value flowing through
RequestHandlerChainParamswas always exactlyproviderScope.androidAdbExecutor,so this stayed pure wiring.
Validation
request-handler-chain-provider-scope.test.ts):mocks
handleSessionCommandsand proves (a) the exactandroidAdbExecutorfunction reference passed into
providerScopereaches it unchanged for asession-routed request, and (b) an empty provider scope still forwards
undefined(as before).pnpm exec tsc -p tsconfig.json— cleanpnpm check:layering— 136/136 structural tests passpnpm check:affected --run— 80 test files / 337 tests passed (includingthe full provider-integration suite:
android-lifecycle,doctor,android-recording,record-trace-android-liveness, etc.), plus format,lint, layering, and build/declarations checks
Part of #1739 (wave 0).