mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
* Refuse unsupported SSH project setup before local API dispatch * fix(projects): keep the desktop's SSH refusal copy and drop a re-export The desktop's own project-setup IPC is not an Orca server, so it keeps saying the SSH connection is not connected; the renderer now refuses SSH setup before reaching it. Callers import the shared refusal message directly instead of through the controller. Adds a headless paired e2e that sets up a project on the server's SSH host from a web client. Refs #33124 * fix(projects): give the server refusal only for a paired server's SSH host A desktop's own SSH host keeps its 'not connected' copy; the server refusal shows on a web client, or for a target only a paired server lists. Refs #33124 * test(e2e): read the added SSH target from the RPC result * test(e2e): pass a typed SSH execution host id * test(e2e): give the paired SSH project-setup timeout bump its reason --------- Co-authored-by: Mohith S <smohith58@gmail.com>
66 lines
2.6 KiB
TypeScript
66 lines
2.6 KiB
TypeScript
/**
|
||
* A paired client cannot set up a project on an SSH host its headless server owns: the server
|
||
* reaches that host's runtime over its own tunnel, which the client has no route to. Adding or
|
||
* cloning there says so plainly instead of failing with a TypeError or "not connected" (#33124).
|
||
*/
|
||
import { expect, test } from './helpers/orca-app'
|
||
import { launchHeadlessPairedRuntimeHost } from './helpers/headless-paired-runtime-host'
|
||
import { launchPairedWebClient } from './helpers/paired-electron-client'
|
||
import { toSshExecutionHostId } from '../../src/shared/execution-host'
|
||
|
||
const REFUSAL = "This Orca server can't add projects on its SSH hosts."
|
||
|
||
test('a paired client refuses project setup on its server’s SSH host with a clear reason', async () => {
|
||
// Boots a headless server and a paired Electron client before the refusal is observable.
|
||
test.setTimeout(180_000)
|
||
const host = await launchHeadlessPairedRuntimeHost()
|
||
try {
|
||
const sshTarget = await host.client.call<{ target: { id: string } }>('ssh.addTarget', {
|
||
target: { label: 'Recipe VM', host: '127.0.0.1', port: 1, username: 'dev' }
|
||
})
|
||
const client = await launchPairedWebClient(host.app, host.offer, { waitForWorkspace: false })
|
||
try {
|
||
await expect
|
||
.poll(() => client.page.evaluate(() => Boolean(window.__store)), { timeout: 30_000 })
|
||
.toBe(true)
|
||
const errors = await client.page.evaluate(async (hostId) => {
|
||
const messages: string[] = []
|
||
const original = console.error
|
||
console.error = (...args: unknown[]) => {
|
||
messages.push(args.map(String).join(' '))
|
||
original(...args)
|
||
}
|
||
try {
|
||
const state = window.__store!.getState()
|
||
const added = await state.setupProjectExistingFolder({
|
||
projectId: 'project-on-b',
|
||
hostId,
|
||
path: '/home/dev/repo',
|
||
kind: 'git'
|
||
})
|
||
const cloned = await state.setupProjectClone({
|
||
projectId: 'project-on-b',
|
||
hostId,
|
||
url: 'https://example.com/repo.git',
|
||
destination: '/home/dev'
|
||
})
|
||
return { added, cloned, messages }
|
||
} finally {
|
||
console.error = original
|
||
}
|
||
}, toSshExecutionHostId(sshTarget.result.target.id))
|
||
|
||
expect(errors.added).toBeNull()
|
||
expect(errors.cloned).toBeNull()
|
||
expect(errors.messages).toHaveLength(2)
|
||
for (const message of errors.messages) {
|
||
expect(message).toContain(REFUSAL)
|
||
}
|
||
} finally {
|
||
await client.dispose()
|
||
}
|
||
} finally {
|
||
await host.dispose()
|
||
}
|
||
})
|