From f508a1a47e651f3b39194a9d130cee8fcab69520 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 24 Oct 2026 11:39:56 +0800 Subject: [PATCH] refactor(native): remove unreachable command routing branches --- src/native/CommandRunner.ts | 22 ++++++++++------------ src/native/NativeMacOSProvider.ts | 29 +---------------------------- 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/src/native/CommandRunner.ts b/src/native/CommandRunner.ts index 696cc08f33..3c7590efe8 100644 --- a/src/native/CommandRunner.ts +++ b/src/native/CommandRunner.ts @@ -223,18 +223,16 @@ export class XcrunCommandRunner implements NativeCommandRunner { this.launcher, ); if (!captured.ok) return err(this.#retainCleanupOwner(captured.error)); - return captured.ok - ? ok({ - ...captured.value, - tool, - executable: resolved.value.path, - executableSha256: resolved.value.sha256, - toolVersion: null, - versionReason: - "Tool exposes no uniform stable version flag; executable SHA-256 is a prelaunch file sample and does not prove atomic OS image binding.", - arguments: [...arguments_], - }) - : captured; + return ok({ + ...captured.value, + tool, + executable: resolved.value.path, + executableSha256: resolved.value.sha256, + toolVersion: null, + versionReason: + "Tool exposes no uniform stable version flag; executable SHA-256 is a prelaunch file sample and does not prove atomic OS image binding.", + arguments: [...arguments_], + }); } async #retryCleanup(): Promise { diff --git a/src/native/NativeMacOSProvider.ts b/src/native/NativeMacOSProvider.ts index 1a0d8a3ab5..5a3b3efee1 100644 --- a/src/native/NativeMacOSProvider.ts +++ b/src/native/NativeMacOSProvider.ts @@ -352,7 +352,7 @@ class NativeMacOSClient implements AnalysisClient { return this.#observeNativeUi(operation, parameters, options?.signal); } const pending = Promise.resolve().then(() => - this.#dispatch(operation, parameters, options?.signal), + this.#dispatchCommand(operation, parameters, options?.signal), ); this.#pendingCommandOperations.add(pending); try { @@ -572,33 +572,6 @@ class NativeMacOSClient implements AnalysisClient { return new NativeUiCleanupError(failures, operation, partialObservation); } - #dispatch( - operation: NativeToolName, - parameters: Readonly>, - signal?: AbortSignal, - ): Promise> { - switch (operation) { - case "observe_native_ui": - case "capture_native_ui_scenario": - case "observe_native_calls": - return Promise.resolve( - err( - new AnalysisCapabilityUnavailableError( - IDENTITY.id, - operation, - "UI observation uses its explicit authority boundary", - ), - ), - ); - case "inspect_macho": - case "inspect_signature": - case "inspect_plist": - case "list_architectures": - case "demangle_swift": - return this.#dispatchCommand(operation, parameters, signal); - } - } - #dispatchCommand( operation: | "inspect_macho"