test(mobile): pin that a refused tab close still prunes, and drop two leftovers

The refused-body case had no test after the round-5 revert; reintroducing the defect
passed the suite. Also removes the stream types stranded when the terminal subscribe
adapter was deleted, and a truncated field the directory result type no longer declares.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
Jinwoo-H
2026-09-09 13:19:31 -04:00
parent 59e5e6e0d4
commit bcba08b3e4
3 changed files with 12 additions and 55 deletions
@@ -16,8 +16,7 @@ export function nativeHostFileExplorerOperations(client: RpcClient): HostFileExp
if (response.ok) {
return {
kind: 'directory',
entries: response.result as MobileDirEntry[],
truncated: false
entries: response.result as MobileDirEntry[]
}
}
// Why: desktops that predate the files.readDir mobile allowlist entry still serve the
@@ -1,56 +1,3 @@
import type { TerminalOscLinkRange } from '../../../src/shared/terminal-osc-link-ranges'
export type HostSessionTerminalData = string | Uint8Array
export type HostSessionTerminalStreamEvent =
| {
type: 'subscribed'
cols?: number
rows?: number
}
| {
type: 'scrollback'
cols: number
rows: number
serialized: HostSessionTerminalData
preserveScroll?: boolean
throughSequence?: number
displayMode?: 'auto' | 'desktop' | 'phone'
oscLinks?: TerminalOscLinkRange[]
seq?: number
}
| {
type: 'data'
chunk: HostSessionTerminalData
throughSequence?: number
seq?: number
}
| {
type: 'resized'
cols: number
rows: number
serialized?: HostSessionTerminalData
throughSequence?: number
displayMode?: 'auto' | 'desktop' | 'phone'
oscLinks?: TerminalOscLinkRange[]
seq?: number
}
| {
type: 'metadata'
displayMode?: 'auto' | 'desktop' | 'phone'
cwd?: string
}
| { type: 'end' | 'error' }
export type HostSessionTerminalSubscribeArgs = {
workspaceId: string
terminalId: string
clientId: string | null
viewport: { cols: number; rows: number } | null | undefined
visible: boolean
capabilities: { terminalBinaryStream: 1; mobileInputLeaseOnly?: 1 }
}
export type HostSessionTerminalOperations = {
sendInput(
terminalId: string,
@@ -42,6 +42,17 @@ describe('native host session tab operations', () => {
await expect(operations.close('workspace-1', 'tab-1')).resolves.toBe(true)
})
it('prunes a close the host refused, as main did', async () => {
const operations = nativeHostSessionTabOperations({
sendRequest: vi.fn().mockResolvedValue({
ok: true,
result: { closed: true, refused: true, refusalReason: 'live-host-pty' }
})
} as unknown as RpcClient)
await expect(operations.close('workspace-1', 'tab-1')).resolves.toBe(true)
})
it('reports a close the host refused at the transport', async () => {
const operations = nativeHostSessionTabOperations({
sendRequest: vi.fn().mockResolvedValue({ ok: false, error: { code: 'x', message: 'no' } })