refactor(mobile): reach the narrow port type without naming the port module

The previous commit named `UnvalidatedRpcRequestPort` by importing the port
module, and that fails the boundary ratchet: it counts an import of
`unvalidated-rpc-request-port` as reach, so all six unlisted files became
offenders and the history panel went from 1 reference to 2.

Main's `Pick<RpcClient, 'sendRequest'>` fails it for the same reason, by a
different rule: a bare `'sendRequest'` string literal is counted too. That is
why the migration widened these signatures in the first place, so the review
finding's premise that it was done for no cause is wrong. Only the full
`RpcClient` scored zero.

Re-export the port type from `rpc-client` instead. An export declaration with no
module specifier is not counted, the seven signatures still say they need one
sender rather than a whole client, and the inventory does not move. Holding a
client already carries the same reach, so nothing new is opened.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
Jinwoo-H
2026-09-14 21:18:14 -04:00
parent 35aa6db3b7
commit 92e679f587
8 changed files with 10 additions and 7 deletions
@@ -16,7 +16,7 @@ import { ChevronLeft, RefreshCw } from 'lucide-react-native'
import { colors } from '../theme/mobile-theme'
import { useHostClient } from '../transport/client-context'
import type { RpcSuccess } from '../transport/types'
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import { readMobileRuntimeHostPlatform } from '../transport/mobile-runtime-host-platform'
import { getWorktreeLabel } from '../session/worktree-label'
import {
@@ -1,5 +1,5 @@
import type { RuntimeSpeechSetupState } from '../../../src/shared/runtime-types'
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import type { RpcResponse } from '../transport/types'
import { interpretOrThrowRefusalMessage } from '../transport/rpc-refusal-message'
import { LogicalClientCutoverError } from '../transport/stable-logical-rpc-client'
@@ -13,7 +13,7 @@ import type {
MobilePushRegisterResult
} from '../../../src/shared/mobile-push-contract'
import { NOTIFICATIONS_REMOTE_PUSH_RUNTIME_CAPABILITY } from '../../../src/shared/protocol-version'
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import { startRuntimeCapabilityProbe } from '../transport/runtime-capability-probe'
import { pushRouteRegister, pushRouteUnregister } from './mobile-push-registration-operations'
import {
@@ -1,4 +1,4 @@
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import {
fetchDictationSetup,
setDictationConfig,
@@ -1,5 +1,5 @@
import { isTerminalQueryReply } from '../../../src/shared/terminal-query-reply'
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import { terminalInputSend } from './mobile-terminal-operations'
type TerminalSubscriptionRegistry = {
@@ -2,7 +2,7 @@ import { reportWorkerTerminalUserInput } from './worker-terminal-takeover-report
import { getTerminalLiveAccessoryRawSendTarget } from './terminal-live-accessory-raw-send-target'
import { buildTerminalSendParams, TERMINAL_INPUT_SEND_OPTIONS } from './terminal-send-request'
import { terminalInputSend } from './mobile-terminal-operations'
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import type { ConnectionState } from '../transport/types'
type TerminalLiveAccessoryRawSendArgs = {
@@ -1,4 +1,4 @@
import type { UnvalidatedRpcRequestPort } from '../transport/unvalidated-rpc-request-port'
import type { UnvalidatedRpcRequestPort } from '../transport/rpc-client'
import { workerTerminalTakeoverReport } from './mobile-terminal-operations'
type ReportClient = UnvalidatedRpcRequestPort
+3
View File
@@ -6,6 +6,9 @@ import type { UnvalidatedRpcRequestPort } from './unvalidated-rpc-request-port'
// Re-export shim: the options type moved to the port module with the sender it belongs to,
// and re-exporting is what keeps that move from touching every importer.
export type { SendRequestOptions } from './unvalidated-rpc-request-port'
// Re-exported so a caller that only sends can say so without naming the port module, which the
// boundary ratchet counts as reach. Holding a client already carries the same ability.
export type { UnvalidatedRpcRequestPort }
type SubscribeOptions = {
onBinaryFrame?: (frame: BrowserScreencastFrame) => void