mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 00:02:29 +00:00
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
This commit is contained in:
@@ -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}` }
|
||||
}),
|
||||
`<!doctype html><html><body><script src="./${mermaidScript.path}"></script></body></html>`,
|
||||
'utf8'
|
||||
)
|
||||
const markdownEditor = Buffer.from(
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -110,8 +110,8 @@ is the CDP endpoint.
|
||||
|
||||
Attach either way:
|
||||
|
||||
- **Chrome**: open `chrome://inspect`, add `127.0.0.1:<port>` under *Discover network
|
||||
targets*, then click *inspect* on the hosted target.
|
||||
- **Chrome**: open `chrome://inspect`, add `127.0.0.1:<port>` under _Discover network
|
||||
targets_, then click _inspect_ on the hosted target.
|
||||
- **playwright-cli**: `playwright-cli attach --cdp http://127.0.0.1:<port>`.
|
||||
|
||||
Tear the forward down with `adb -s <serial> forward --remove tcp:<port>`.
|
||||
|
||||
@@ -98,7 +98,6 @@ export const MOBILE_WEB_ONCE_CAPABILITY_ARMS: Partial<Record<MobileWebBridgeCapa
|
||||
speech: executeSpeech
|
||||
}
|
||||
|
||||
|
||||
async function subscribeWorkspace(args: Deps, request: SubscriptionRequest): Promise<unknown> {
|
||||
if (request.operation !== 'hostSubscribe') {
|
||||
throw new MobileWebBrokerError('unsupported_capability')
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -146,9 +146,6 @@ function sessionSnapshot(overrides: Record<string, unknown> = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function resetScope(overrides: Record<string, unknown> = {}) {
|
||||
return {
|
||||
target: { runtime: 'host' as const, wslDistro: null },
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user