mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
test: remove low-value renderer launch and Windows checks
This commit is contained in:
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
||||
public static class OrcaDesktopWin32 {
|
||||
public static readonly List<string> Calls = new List<string>();
|
||||
public static bool AllowActivation;
|
||||
public static bool Minimized;
|
||||
public static IntPtr Foreground;
|
||||
public static IntPtr Pending;
|
||||
public static int FocusReads;
|
||||
@@ -22,14 +21,13 @@ public static class OrcaDesktopWin32 {
|
||||
public static void Reset(bool allow) {
|
||||
Calls.Clear();
|
||||
AllowActivation = allow;
|
||||
Minimized = false;
|
||||
Foreground = new IntPtr(202);
|
||||
Pending = IntPtr.Zero;
|
||||
FocusReads = 0;
|
||||
WindowX = 100;
|
||||
}
|
||||
public static bool IsIconic(IntPtr hwnd) {
|
||||
return Minimized;
|
||||
return false;
|
||||
}
|
||||
public static bool ShowWindow(IntPtr hwnd, int command) {
|
||||
Calls.Add("restore");
|
||||
@@ -119,13 +117,4 @@ foreach ($case in @(
|
||||
$result = Invoke-OrcaOperation ([pscustomobject]@{ tool = "click"; app = "Fixture"; element = [pscustomobject]@{ index = 1 } })
|
||||
Assert-TestEqual $result.action.path "accessibility" "pattern click path"
|
||||
Assert-TestEqual ([OrcaDesktopWin32]::Calls.Count) 0 "pattern click bypasses activation and global input"
|
||||
[OrcaDesktopWin32]::Reset($true)
|
||||
Restore-OrcaWindow (Find-OrcaProcess)
|
||||
Assert-TestEqual (@([OrcaDesktopWin32]::Calls) -join ",") "activate" "non-minimized window skips SW_RESTORE"
|
||||
|
||||
[OrcaDesktopWin32]::Reset($true)
|
||||
[OrcaDesktopWin32]::Minimized = $true
|
||||
Restore-OrcaWindow (Find-OrcaProcess)
|
||||
Assert-TestEqual (@([OrcaDesktopWin32]::Calls) -join ",") "restore,activate" "minimized window runs SW_RESTORE"
|
||||
|
||||
Write-Output "windows-pointer-tests-ok"
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type {
|
||||
LinearIssueContextResult,
|
||||
LinearTeamMembersResult
|
||||
} from '../shared/linear/agent-access'
|
||||
import type { LinearIssueContextResult } from '../shared/linear/agent-access'
|
||||
import {
|
||||
formatLinearIssue,
|
||||
formatLinearMcpIssueList,
|
||||
formatLinearTeamMembers,
|
||||
printLinearMcpIssueListWarnings
|
||||
} from './linear-format'
|
||||
|
||||
@@ -127,20 +123,4 @@ describe('linear-format', () => {
|
||||
'warning: Acme unavailable for Linear: rate limited warning: fake'
|
||||
)
|
||||
})
|
||||
|
||||
it('pads member names by terminal columns so wide Hangul names keep the id column aligned', () => {
|
||||
const result: LinearTeamMembersResult = {
|
||||
team: { id: 'team-1', name: 'Engineering', key: 'ENG' },
|
||||
members: [
|
||||
{ id: 'user-0', displayName: '김철수' },
|
||||
{ id: 'user-1', displayName: 'Alice' }
|
||||
],
|
||||
meta: { workspaceId: 'workspace-1', returned: 2 }
|
||||
}
|
||||
|
||||
expect(formatLinearTeamMembers(result).split('\n')).toEqual([
|
||||
`김철수${' '.repeat(18)} user-0`,
|
||||
`Alice${' '.repeat(19)} user-1`
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ORCA_SCRUB_SAFE_PANE_ENV } from '../../../../shared/agent-hook-listener
|
||||
import type { AgentSessionJournalIdentity } from '../../../../shared/agent-session/journal/agent-session-journal-identity'
|
||||
import type { AgentSessionAccountHome } from '../../../../shared/agent-session/lifecycle/agent-session-account-home'
|
||||
import { LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
|
||||
import { acpLaunchSpecFor } from '../../../acp/launch/acp-launch-registry'
|
||||
import { agentSessionRecordFixture } from '../../../native-chat/agent-session-record-test-fixture'
|
||||
import { resolveProviderChildEnv } from '../../../provider-process/provider-process-launch'
|
||||
import {
|
||||
@@ -12,22 +11,10 @@ import {
|
||||
structuredWorkerIdentities
|
||||
} from '../../orchestration/terminal-authority/structured-sessions/structured-worker-identity'
|
||||
import {
|
||||
createAcpStructuredLaunchResolver,
|
||||
createClaudeStructuredLaunchResolver,
|
||||
createCodexStructuredLaunchResolver,
|
||||
createPiRpcLaunchResolver,
|
||||
TEST_SPAWN_TOKEN
|
||||
} from './structured-agent-launch-composition.test-support'
|
||||
|
||||
const { isWindowsProcessStartTimeAvailable } = vi.hoisted(() => ({
|
||||
isWindowsProcessStartTimeAvailable: vi.fn(() => true)
|
||||
}))
|
||||
|
||||
vi.mock('../../../windows/windows-process-table', async (importOriginal) => ({
|
||||
...(await importOriginal<object>()),
|
||||
isWindowsProcessStartTimeAvailable
|
||||
}))
|
||||
|
||||
afterEach(() => {
|
||||
structuredWorkerIdentities.clear()
|
||||
})
|
||||
@@ -82,70 +69,6 @@ function expectNoHostPaneIdentity(childEnv: NodeJS.ProcessEnv): void {
|
||||
}
|
||||
|
||||
describe('structured agent launch composition pane-identity stripping', () => {
|
||||
it('strips inherited host-pane identity across Claude, Codex, ACP, and Pi launches', async () => {
|
||||
const claudeLaunch = await createClaudeStructuredLaunchResolver({
|
||||
store: makeStore('00000000-0000-4000-8000-000000000001', 'claude', {
|
||||
variable: 'CLAUDE_CONFIG_DIR',
|
||||
path: '/home/work/.claude'
|
||||
}),
|
||||
resolveInheritedEnv: async () => ({ ...INHERITED_PANE_ENV }),
|
||||
resolveCommand: () => ({ command: '/usr/local/bin/claude', prefixArgs: [] }),
|
||||
resolveAuthPolicy: () => ({ account: 'system' }),
|
||||
hasTranscript: async () => false,
|
||||
resolveLaunchArgs: () => []
|
||||
})({ identity: makeIdentity('00000000-0000-4000-8000-000000000001', 'claude') })
|
||||
|
||||
const codexLaunch = await createCodexStructuredLaunchResolver({
|
||||
store: makeStore('00000000-0000-4000-8000-000000000002', 'codex', {
|
||||
variable: 'CODEX_HOME',
|
||||
path: '/home/work/.codex'
|
||||
}),
|
||||
resolveEnvironment: async () => ({ ...INHERITED_PANE_ENV }),
|
||||
resolveCommand: () => ({ command: '/usr/local/bin/codex', prefixArgs: [] }),
|
||||
resolveLaunchArgs: () => []
|
||||
})({
|
||||
identity: makeIdentity('00000000-0000-4000-8000-000000000002', 'codex'),
|
||||
spawnToken: TEST_SPAWN_TOKEN
|
||||
})
|
||||
|
||||
const grokSpec = acpLaunchSpecFor('grok')
|
||||
if (!grokSpec) {
|
||||
throw new Error('Missing Grok ACP launch spec')
|
||||
}
|
||||
const acpLaunch = await createAcpStructuredLaunchResolver(grokSpec, {
|
||||
store: makeStore('00000000-0000-4000-8000-000000000003', 'grok', {
|
||||
variable: 'GROK_HOME',
|
||||
path: '/home/work/.grok'
|
||||
}),
|
||||
resolveEnvironment: async () => ({ ...INHERITED_PANE_ENV }),
|
||||
inheritedEnv: INHERITED_PANE_ENV,
|
||||
readJournal: () => null,
|
||||
resolveCommand: () => '/usr/local/bin/grok',
|
||||
probeVersion: async () => ({ version: '1.0.0' })
|
||||
})({
|
||||
identity: makeIdentity('00000000-0000-4000-8000-000000000003', 'grok'),
|
||||
spawnToken: TEST_SPAWN_TOKEN
|
||||
})
|
||||
|
||||
const piLaunch = await createPiRpcLaunchResolver({
|
||||
store: makeStore('00000000-0000-4000-8000-000000000004', 'pi', {
|
||||
variable: 'PI_CODING_AGENT_DIR',
|
||||
path: '/home/work/.pi'
|
||||
}),
|
||||
resolveEnvironment: async () => ({ ...INHERITED_PANE_ENV }),
|
||||
resolveCommand: () => '/usr/local/bin/pi',
|
||||
probeVersion: async () => ({ version: '0.84.0' }),
|
||||
resolveFullAccess: () => true,
|
||||
ensureBackgroundWorkBridge: async () => null
|
||||
})(makeIdentity('00000000-0000-4000-8000-000000000004', 'pi'), TEST_SPAWN_TOKEN)
|
||||
|
||||
for (const launch of [claudeLaunch, codexLaunch, acpLaunch, piLaunch]) {
|
||||
const childEnv = resolveProviderChildEnv(launch, INHERITED_PANE_ENV)
|
||||
expectNoHostPaneIdentity(childEnv)
|
||||
expect(childEnv.ORCA_TERMINAL_HANDLE).toBeUndefined()
|
||||
}
|
||||
})
|
||||
|
||||
it("preserves a structured worker's own ORCA_TERMINAL_HANDLE while stripping host pane identity", async () => {
|
||||
const sessionId = '00000000-0000-4000-8000-000000000005'
|
||||
const workerHandle = mintStructuredWorkerHandle()
|
||||
|
||||
@@ -54,20 +54,6 @@ describe('installBrowserPasskeyRequestWatch', () => {
|
||||
expect(reports).toEqual([true, false])
|
||||
})
|
||||
|
||||
it('installs nothing in an insecure document, which has no credentials API', () => {
|
||||
Reflect.deleteProperty(globalThis, 'CredentialsContainer')
|
||||
const reports: boolean[] = []
|
||||
const cancel = installBrowserPasskeyRequestWatch((pending) => reports.push(pending))
|
||||
cancel()
|
||||
expect(reports).toEqual([])
|
||||
})
|
||||
|
||||
it('ignores conditional requests, which wait on autofill', () => {
|
||||
const { credentials, reports } = install()
|
||||
void credentials.get({ publicKey, mediation: 'conditional' })
|
||||
expect(reports).toEqual([])
|
||||
})
|
||||
|
||||
it("keeps the page's own abort signal working", async () => {
|
||||
const { credentials, reports } = install()
|
||||
const page = new AbortController()
|
||||
|
||||
+2
-19
@@ -1,17 +1,14 @@
|
||||
import { Editor, type JSONContent } from '@tiptap/core'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createRichMarkdownEditorCodec } from '../document/rich-markdown-source-transport'
|
||||
import { encodeRawMarkdownHtmlForRichEditor } from '../raw-source/raw-markdown-html'
|
||||
import { createRichMarkdownExtensions } from './rich-markdown-extensions'
|
||||
|
||||
function createEditor(content: JSONContent | string): Editor {
|
||||
function createEditor(content: JSONContent): Editor {
|
||||
const codec = createRichMarkdownEditorCodec()
|
||||
return new Editor({
|
||||
element: null,
|
||||
extensions: createRichMarkdownExtensions({ codec }),
|
||||
content:
|
||||
typeof content === 'string' ? encodeRawMarkdownHtmlForRichEditor(content, codec) : content,
|
||||
...(typeof content === 'string' ? { contentType: 'markdown' as const } : {})
|
||||
content
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,20 +34,6 @@ describe('typed prose entities', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it.each(['a < b && c, F&B > R, © & <i>', '> quote', '<kbd>x</kbd>'])(
|
||||
'reopens %j unchanged',
|
||||
(text) => {
|
||||
const editor = createEditor(paragraph(text))
|
||||
const reopened = createEditor(editor.getMarkdown())
|
||||
try {
|
||||
expect(reopened.getJSON()).toEqual(editor.getJSON())
|
||||
} finally {
|
||||
editor.destroy()
|
||||
reopened.destroy()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it('leaves entity text inside a code span alone', () => {
|
||||
const editor = createEditor(paragraph('& <b> > x', [{ type: 'code' }]))
|
||||
try {
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { MessageRow } from './NativeChatMessageRow'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
describe('MessageRow sent image prompt markers', () => {
|
||||
it('draws and copies a user message without the [Image #N] its send wrote mid-sentence', async () => {
|
||||
const writeClipboardText = vi.fn().mockResolvedValue(undefined)
|
||||
Object.assign(window, { api: { ui: { writeClipboardText } } })
|
||||
|
||||
render(
|
||||
<TooltipProvider>
|
||||
<MessageRow
|
||||
message={{
|
||||
id: 'message',
|
||||
role: 'user',
|
||||
timestamp: 0,
|
||||
source: 'transcript',
|
||||
blocks: [
|
||||
{ type: 'text', text: 'Compare this [Image #1] with `[Image #1]`' },
|
||||
{ type: 'image-ref', path: '/tmp/screenshot.png', alt: 'Screenshot' }
|
||||
]
|
||||
}}
|
||||
expandSignal={false}
|
||||
onScrollMessageToTop={vi.fn()}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
)
|
||||
expect(screen.getByText('[Image #1]').tagName).toBe('CODE')
|
||||
expect(screen.getByText(/Compare this\s+with/)).toBeTruthy()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Copy message' }))
|
||||
await waitFor(() => {
|
||||
expect(writeClipboardText).toHaveBeenCalledWith('Compare this with `[Image #1]`')
|
||||
})
|
||||
})
|
||||
|
||||
it('omits the copy button when a user message has only its sent [Image #1] marker and image', () => {
|
||||
render(
|
||||
<TooltipProvider>
|
||||
<MessageRow
|
||||
message={{
|
||||
id: 'image-only',
|
||||
role: 'user',
|
||||
timestamp: 0,
|
||||
source: 'transcript',
|
||||
blocks: [
|
||||
{ type: 'text', text: '[Image #1]' },
|
||||
{ type: 'image-ref', path: '/tmp/screenshot.png', alt: 'Screenshot' }
|
||||
]
|
||||
}}
|
||||
expandSignal={false}
|
||||
onScrollMessageToTop={vi.fn()}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
)
|
||||
expect(screen.queryByText(/\[Image #1\]/)).toBeNull()
|
||||
expect(screen.queryByRole('button', { name: 'Copy message' })).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user