From 6295bc9cb28dd0918d0ea5f38786277b7c4ed09e Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Mon, 7 Sep 2026 18:09:41 -0400 Subject: [PATCH] ci: keep root vitest off mobile sources and settle lint and format The packaging test and fixture read the embedded document names from the shared manifest contract instead of mobile/src, which the root CI job cannot load (no Expo toolchain). Merge two duplicate-module imports the focused plugin audit rejects, and format the files oxfmt --check flags. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- .../electron-builder-mobile-web-fixture.mjs | 14 +++++--------- config/scripts/package-mobile-web-rnw.test.ts | 10 +++++++--- docs/reference/mobile-hybrid-webview-devtools.md | 4 ++-- .../mobile-web-capability-execution-arms.ts | 1 - mobile/src/transport/rpc-client.ts | 1 - .../rpc/methods/mobile-web-file-open.test.ts | 14 ++++++-------- .../methods/native-chat-rpc-message-sanitizer.ts | 5 ++++- ...bile-web-operation-response-correlation.test.ts | 3 --- .../src/mobile-web-workspace-request-client.ts | 6 ++---- .../mobile-web/provider-review-diff-contract.ts | 6 ++---- 10 files changed, 28 insertions(+), 36 deletions(-) diff --git a/config/scripts/electron-builder-mobile-web-fixture.mjs b/config/scripts/electron-builder-mobile-web-fixture.mjs index cb9116015ce..604c4425cc2 100644 --- a/config/scripts/electron-builder-mobile-web-fixture.mjs +++ b/config/scripts/electron-builder-mobile-web-fixture.mjs @@ -1,16 +1,15 @@ import { createHash } from 'node:crypto' import { mkdir, writeFile } from 'node:fs/promises' import { join } from 'node:path' -import { MOBILE_WEB_MARKDOWN_EDITOR_PATH } from '../../mobile/src/components/markdown-editor-document' -import { - MOBILE_WEB_MERMAID_FRAME_PATH, - buildMobileWebMermaidFrameDocument -} from '../../mobile/src/components/pr-sidebar/mermaid-frame-document' import { + MOBILE_WEB_EMBEDDED_DOCUMENT_PATHS, MOBILE_WEB_MANIFEST_SCHEMA_VERSION, serializeMobileWebManifestForBuildId } from '../../src/shared/mobile-web/manifest-contract' +const [MOBILE_WEB_MARKDOWN_EDITOR_PATH, MOBILE_WEB_MERMAID_FRAME_PATH] = + MOBILE_WEB_EMBEDDED_DOCUMENT_PATHS + export async function createPackagedCliResourceFixture(resourcesDir) { const cliDir = join(resourcesDir, 'app.asar.unpacked', 'out', 'cli') await mkdir(join(cliDir, 'handlers'), { recursive: true }) @@ -40,10 +39,7 @@ export async function createMobileWebResourceFixture(resourcesDir) { 'utf8' ) const mermaidFrame = Buffer.from( - buildMobileWebMermaidFrameDocument({ - theme: { background: 'black', primary: 'gray', text: 'white', line: 'silver' }, - script: { src: `./${mermaidScript.path}` } - }), + ``, 'utf8' ) const markdownEditor = Buffer.from( diff --git a/config/scripts/package-mobile-web-rnw.test.ts b/config/scripts/package-mobile-web-rnw.test.ts index 0241d1196fa..8c8db29a2da 100644 --- a/config/scripts/package-mobile-web-rnw.test.ts +++ b/config/scripts/package-mobile-web-rnw.test.ts @@ -5,11 +5,15 @@ import { promisify } from 'node:util' import { afterEach, describe, expect, it } from 'vitest' import { MobileWebPackageAssets } from '../../src/main/runtime/rpc/mobile-web-package-assets' import { MOBILE_WEB_PACKAGE_BRIDGE_RANGE } from '../../src/shared/mobile-web/bridge-limits' -import { MOBILE_WEB_MARKDOWN_EDITOR_PATH } from '../../mobile/src/components/markdown-editor-document' -import { MobileWebManifestSchema } from '../../src/shared/mobile-web/manifest-contract' -import { MOBILE_WEB_MERMAID_FRAME_PATH } from '../../mobile/src/components/pr-sidebar/mermaid-frame-document' +import { + MOBILE_WEB_EMBEDDED_DOCUMENT_PATHS, + MobileWebManifestSchema +} from '../../src/shared/mobile-web/manifest-contract' const execFileAsync = promisify(execFile) +// Why: root vitest must not load mobile/ sources; CI's root job has no Expo toolchain. +const [MOBILE_WEB_MARKDOWN_EDITOR_PATH, MOBILE_WEB_MERMAID_FRAME_PATH] = + MOBILE_WEB_EMBEDDED_DOCUMENT_PATHS const temporaryRoots: string[] = [] afterEach(async () => { diff --git a/docs/reference/mobile-hybrid-webview-devtools.md b/docs/reference/mobile-hybrid-webview-devtools.md index 543df655e49..a736d3d14d2 100644 --- a/docs/reference/mobile-hybrid-webview-devtools.md +++ b/docs/reference/mobile-hybrid-webview-devtools.md @@ -110,8 +110,8 @@ is the CDP endpoint. Attach either way: -- **Chrome**: open `chrome://inspect`, add `127.0.0.1:` under *Discover network - targets*, then click *inspect* on the hosted target. +- **Chrome**: open `chrome://inspect`, add `127.0.0.1:` under _Discover network + targets_, then click _inspect_ on the hosted target. - **playwright-cli**: `playwright-cli attach --cdp http://127.0.0.1:`. Tear the forward down with `adb -s forward --remove tcp:`. diff --git a/mobile/src/mobile-web/mobile-web-capability-execution-arms.ts b/mobile/src/mobile-web/mobile-web-capability-execution-arms.ts index 6de252d4832..8935ab3b226 100644 --- a/mobile/src/mobile-web/mobile-web-capability-execution-arms.ts +++ b/mobile/src/mobile-web/mobile-web-capability-execution-arms.ts @@ -98,7 +98,6 @@ export const MOBILE_WEB_ONCE_CAPABILITY_ARMS: Partial { if (request.operation !== 'hostSubscribe') { throw new MobileWebBrokerError('unsupported_capability') diff --git a/mobile/src/transport/rpc-client.ts b/mobile/src/transport/rpc-client.ts index 2f854fea446..e8342233275 100644 --- a/mobile/src/transport/rpc-client.ts +++ b/mobile/src/transport/rpc-client.ts @@ -24,7 +24,6 @@ export type RpcRequestReply = | { ok: true; result: unknown } | { ok: false; error?: { code?: string; message?: string } } - type StreamingListener = (result: unknown) => void export type RpcClient = { diff --git a/src/main/runtime/rpc/methods/mobile-web-file-open.test.ts b/src/main/runtime/rpc/methods/mobile-web-file-open.test.ts index bee3859038c..aa495486bb1 100644 --- a/src/main/runtime/rpc/methods/mobile-web-file-open.test.ts +++ b/src/main/runtime/rpc/methods/mobile-web-file-open.test.ts @@ -7,14 +7,12 @@ function fixture(tabs: unknown[]) { const runtime = { openMobileFile: vi.fn().mockResolvedValue({ worktree: 'workspace', opened: true }), openMobileDiff: vi.fn().mockResolvedValue({ worktree: 'workspace', opened: true }), - listMobileSessionTabs: vi - .fn() - .mockResolvedValue({ - worktree: 'workspace', - publicationEpoch: 'e', - snapshotVersion: 1, - tabs - }), + listMobileSessionTabs: vi.fn().mockResolvedValue({ + worktree: 'workspace', + publicationEpoch: 'e', + snapshotVersion: 1, + tabs + }), activateMobileSessionTab: vi .fn() .mockResolvedValue({ worktree: 'workspace', activeTabId: 'tab-1', tabs }) diff --git a/src/main/runtime/rpc/methods/native-chat-rpc-message-sanitizer.ts b/src/main/runtime/rpc/methods/native-chat-rpc-message-sanitizer.ts index 59135272f63..cb38d110227 100644 --- a/src/main/runtime/rpc/methods/native-chat-rpc-message-sanitizer.ts +++ b/src/main/runtime/rpc/methods/native-chat-rpc-message-sanitizer.ts @@ -14,7 +14,10 @@ function sanitizeMessage( message: NativeChatMessage, clientKind: RpcContext['clientKind'] ): NativeChatMessage { - return { ...message, blocks: message.blocks.map((block) => sanitizeNativeChatRpcBlock(block, clientKind)) } + return { + ...message, + blocks: message.blocks.map((block) => sanitizeNativeChatRpcBlock(block, clientKind)) + } } export function sanitizeAppendForClient( diff --git a/src/mobile-web/src/mobile-web-operation-response-correlation.test.ts b/src/mobile-web/src/mobile-web-operation-response-correlation.test.ts index 480dff0af54..16a78f77722 100644 --- a/src/mobile-web/src/mobile-web-operation-response-correlation.test.ts +++ b/src/mobile-web/src/mobile-web-operation-response-correlation.test.ts @@ -146,9 +146,6 @@ function sessionSnapshot(overrides: Record = {}) { } } - - - function resetScope(overrides: Record = {}) { return { target: { runtime: 'host' as const, wslDistro: null }, diff --git a/src/mobile-web/src/mobile-web-workspace-request-client.ts b/src/mobile-web/src/mobile-web-workspace-request-client.ts index d120cae5fd1..e644cd1178c 100644 --- a/src/mobile-web/src/mobile-web-workspace-request-client.ts +++ b/src/mobile-web/src/mobile-web-workspace-request-client.ts @@ -1,6 +1,8 @@ import { + MobileWebWorkspaceActivationResultSchema, MobileWebWorkspaceSnapshotPayloadSchema, MobileWebWorkspaceSnapshotResultSchema, + MobileWebWorkspaceViewSettingsSchema, type MobileWebWorkspaceActivationPayload, type MobileWebWorkspaceActivationResult, type MobileWebWorkspaceRemovePayload, @@ -11,10 +13,6 @@ import { type MobileWebWorkspaceUpdateResult, type MobileWebWorkspaceViewSettings } from '../../shared/mobile-web/bridge-operation-contract' -import { - MobileWebWorkspaceActivationResultSchema, - MobileWebWorkspaceViewSettingsSchema -} from '../../shared/mobile-web/bridge-operation-contract' import { MobileWebBridgeClientError } from './mobile-web-bridge-client-error' import { requestMobileWebHost } from './mobile-web-host-request-client' import { diff --git a/src/shared/mobile-web/provider-review-diff-contract.ts b/src/shared/mobile-web/provider-review-diff-contract.ts index 1b22d7b0cae..b99145084fd 100644 --- a/src/shared/mobile-web/provider-review-diff-contract.ts +++ b/src/shared/mobile-web/provider-review-diff-contract.ts @@ -3,12 +3,10 @@ import { MobileWebRelativePathSchema, MobileWebWorkspaceIdSchema } from './bridge-operation-contract' -import { - MobileWebProviderReviewHostScope, - MobileWebProviderReviewPageScope -} from './provider-review-contract' import { MobileWebProviderReviewHeadSchema, + MobileWebProviderReviewHostScope, + MobileWebProviderReviewPageScope, MobileWebProviderReviewProviderSchema } from './provider-review-contract' import { isMobileWebSha256 } from './protocol-token-contract'