Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

test(cli): test:core's coverage gate passes on main again (omp transcript paths, three services' edges) (#2373)

harness-for-autonomous[bot]5522f27fb17a
diff --git a/cli/src/core/transcripts/attach.spec.ts b/cli/src/core/transcripts/attach.spec.ts
index d44d82aef..fa669a718 100644
--- a/cli/src/core/transcripts/attach.spec.ts
+++ b/cli/src/core/transcripts/attach.spec.ts
@@ -57,6 +57,7 @@ vi.mock('../../engines/amp/normalizer.js', async (real) => ({ ...await real<obje
vi.mock('../../engines/grok/normalizer.js', async (real) => ({ ...await real<object>(), GrokNormalizer: fakes.normalizer('grok') }))
vi.mock('../../engines/agy/normalizer.js', async (real) => ({ ...await real<object>(), AgyNormalizer: fakes.normalizer('agy') }))
vi.mock('../../engines/pi/normalizer.js', async (real) => ({ ...await real<object>(), PiNormalizer: fakes.normalizer('pi') }))
+vi.mock('../../engines/omp/normalizer.js', async (real) => ({ ...await real<object>(), OmpNormalizer: fakes.normalizer('omp') }))
vi.mock('../../engines/commandcode/normalizer.js', async (real) => ({ ...await real<object>(), CommandCodeNormalizer: fakes.normalizer('commandcode') }))
vi.mock('../../engines/copilot/normalizer.js', async (real) => ({
...await real<object>(),
@@ -921,7 +922,7 @@ describe('attaching a session', () => {
const maps: Record<string, Map<string, unknown>> = {
cursor: run.normalizers.cursorNormalizers, muse: run.normalizers.museNormalizers, amp: run.normalizers.ampNormalizers,
grok: run.normalizers.grokNormalizers, agy: run.normalizers.agyNormalizers, copilot: run.normalizers.copilotNormalizers,
- pi: run.normalizers.piNormalizers, commandcode: run.normalizers.commandcodeNormalizers,
+ pi: run.normalizers.piNormalizers, omp: run.normalizers.ompNormalizers, commandcode: run.normalizers.commandcodeNormalizers,
}
for (const engine of Object.keys(maps)) {
await run.attach.attachSession(session(engine, transcript([{}])))
diff --git a/cli/src/core/transcripts/history.spec.ts b/cli/src/core/transcripts/history.spec.ts
index eb9ef3144..8e2d2c732 100644
--- a/cli/src/core/transcripts/history.spec.ts
+++ b/cli/src/core/transcripts/history.spec.ts
@@ -64,6 +64,7 @@ vi.mock('../../engines/grok/normalizer.js', async (real) => ({ ...await real<obj
vi.mock('../../engines/agy/normalizer.js', async (real) => ({ ...await real<object>(), agyMessagesToEvents: vi.fn(fake.replay('agy')) }))
vi.mock('../../engines/copilot/normalizer.js', async (real) => ({ ...await real<object>(), copilotMessagesToEvents: vi.fn(fake.replay('copilot')) }))
vi.mock('../../engines/pi/normalizer.js', async (real) => ({ ...await real<object>(), piMessagesToEvents: vi.fn(fake.replay('pi')), windowPiLines: vi.fn(fake.windowOf('pi')) }))
+vi.mock('../../engines/omp/normalizer.js', async (real) => ({ ...await real<object>(), ompMessagesToEvents: vi.fn(fake.replay('omp')), windowOmpLines: vi.fn(fake.windowOf('omp')) }))
vi.mock('../../engines/commandcode/normalizer.js', async (real) => ({ ...await real<object>(), commandcodeMessagesToEvents: vi.fn(fake.replay('commandcode')), windowCommandCodeLines: vi.fn(fake.windowOf('commandcode')) }))
vi.mock('../../engines/cursor/normalizer.js', async (real) => ({
...await real<object>(),
@@ -413,7 +414,7 @@ describe('the other file engines: read from the end, bounded', () => {
it.each([
['cursor', 'cursor'], ['muse', 'muse'], ['amp', 'amp'], ['grok', 'grok'], ['agy', 'agy'], ['copilot', 'copilot'],
- ['pi', 'pi'], ['commandcode', 'commandcode'],
+ ['pi', 'pi'], ['omp', 'omp'], ['commandcode', 'commandcode'],
])('%s: the whole transcript, through its own replay', async (engine, from) => {
vi.spyOn(console, 'warn').mockImplementation(() => {})
const file = transcript(lines)
@@ -457,7 +458,8 @@ describe('the other file engines: read from the end, bounded', () => {
})
it.each([
- ['cursor', 'cursor', 'cursor'], ['pi', 'pi', 'pi'], ['commandcode', 'commandcode', 'commandcode'],
+ ['cursor', 'cursor', 'cursor'], ['pi', 'pi', 'pi'], ['omp', 'omp', 'omp'],
+ ['commandcode', 'commandcode', 'commandcode'],
])('%s: the newest page, the page before it, and a cursor it cannot find, through its own window', async (engine, window, from) => {
const s = session(engine, { transcriptPath: transcript(lines) })
const { sessionGet } = setup(s)
diff --git a/cli/src/core/transcripts/ingest.spec.ts b/cli/src/core/transcripts/ingest.spec.ts
index 2bcfaed69..28dcee0fc 100644
--- a/cli/src/core/transcripts/ingest.spec.ts
+++ b/cli/src/core/transcripts/ingest.spec.ts
@@ -8,6 +8,7 @@ import { CopilotNormalizer } from '../../engines/copilot/normalizer.js'
import { CursorNormalizer } from '../../engines/cursor/normalizer.js'
import { GrokNormalizer } from '../../engines/grok/normalizer.js'
import { MuseNormalizer } from '../../engines/muse/normalizer.js'
+import { OmpNormalizer } from '../../engines/omp/normalizer.js'
import { PiNormalizer } from '../../engines/pi/normalizer.js'
import type { RegisteredSession } from '../../lib/registry.js'
import type { HistoryEvent, LineEvent, RewrittenEvent, Watcher } from '../../watcher/watcher.js'
@@ -147,13 +148,15 @@ describe('ingesting a transcript line', () => {
it('creates each file engine\'s normalizer on the session\'s first line, and keeps it', () => {
const engines = {
cursor: CursorNormalizer, muse: MuseNormalizer, amp: AmpNormalizer, grok: GrokNormalizer,
- agy: AgyNormalizer, copilot: CopilotNormalizer, pi: PiNormalizer, commandcode: CommandCodeNormalizer,
+ agy: AgyNormalizer, copilot: CopilotNormalizer, pi: PiNormalizer, omp: OmpNormalizer,
+ commandcode: CommandCodeNormalizer,
} as const
const run = setup(Object.fromEntries(Object.keys(engines).map((engine) => [engine, engine])))
const maps = {
cursor: run.normalizers.cursorNormalizers, muse: run.normalizers.museNormalizers,
amp: run.normalizers.ampNormalizers, grok: run.normalizers.grokNormalizers, agy: run.normalizers.agyNormalizers,
- copilot: run.normalizers.copilotNormalizers, pi: run.normalizers.piNormalizers, commandcode: run.normalizers.commandcodeNormalizers,
+ copilot: run.normalizers.copilotNormalizers, pi: run.normalizers.piNormalizers, omp: run.normalizers.ompNormalizers,
+ commandcode: run.normalizers.commandcodeNormalizers,
} as Record<keyof typeof engines, Map<string, unknown>>
for (const [engine, Normalizer] of Object.entries(engines) as Array<[keyof typeof engines, new (...args: never[]) => unknown]>) {
expect(run.ingest.ingestLine(line(engine, engine)), engine).toEqual(expect.any(Array))
@@ -165,7 +168,7 @@ describe('ingesting a transcript line', () => {
})
it('reads no events from a file engine\'s lines while its code is unavailable, and makes no normalizer', () => {
- const engines = ['cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'commandcode']
+ const engines = ['cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'omp', 'commandcode']
const run = setup(Object.fromEntries(engines.map((engine) => [engine, engine])))
vi.mocked(engineNow).mockReturnValue(null)
for (const engine of engines) {
diff --git a/cli/src/core/transcripts/lastTurn.spec.ts b/cli/src/core/transcripts/lastTurn.spec.ts
index 307f17d61..e122ccb02 100644
--- a/cli/src/core/transcripts/lastTurn.spec.ts
+++ b/cli/src/core/transcripts/lastTurn.spec.ts
@@ -38,6 +38,7 @@ vi.mock('../../engines/grok/normalizer.js', () => ({ lastGrokTurnText: vi.fn((li
vi.mock('../../engines/agy/normalizer.js', () => ({ lastAgyTurnText: vi.fn((lines: string[]) => ({ text: `agy: ${lines[0]}` })) }))
vi.mock('../../engines/copilot/normalizer.js', () => ({ lastCopilotTurnText: vi.fn((lines: string[]) => ({ text: `copilot: ${lines[0]}` })) }))
vi.mock('../../engines/pi/normalizer.js', () => ({ lastPiTurnText: vi.fn((lines: string[]) => ({ text: `pi: ${lines[0]}` })) }))
+vi.mock('../../engines/omp/normalizer.js', () => ({ lastOmpTurnText: vi.fn((lines: string[]) => ({ text: `omp: ${lines[0]}` })) }))
vi.mock('../../engines/commandcode/normalizer.js', () => ({ lastCommandCodeTurnText: vi.fn((lines: string[]) => ({ text: `commandcode: ${lines[0]}` })) }))
const session = (engine: string, transcriptPath?: string): RegisteredSession =>
@@ -70,7 +71,7 @@ describe('the last turn of each engine', () => {
})
it('is nothing for an engine whose code could not be loaded', async () => {
- const engines = ['opencode', 'kilo', 'hermes', 'devin', 'cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'commandcode']
+ const engines = ['opencode', 'kilo', 'hermes', 'devin', 'cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'omp', 'commandcode']
const read = await reader(engines.map((engine) => session(engine, `/t/${engine}.jsonl`)))
vi.mocked(loadEngine).mockResolvedValue(null as never)
try {
@@ -79,7 +80,7 @@ describe('the last turn of each engine', () => {
})
it('is read backward for Claude Code, from the rollout for Codex, and from the whole transcript for the rest', async () => {
- const engines = ['cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'commandcode']
+ const engines = ['cursor', 'muse', 'amp', 'grok', 'agy', 'copilot', 'pi', 'omp', 'commandcode']
const read = await reader([
session('claude', '/t/claude.jsonl'), session('codex', '/t/codex.jsonl'), session('terminal', '/t/shell.log'),
...engines.map((engine) => session(engine, `/t/${engine}.jsonl`)),
diff --git a/cli/src/services/machineAddonsProcess.spec.ts b/cli/src/services/machineAddonsProcess.spec.ts
index 8b8f45f09..77862eaf3 100644
--- a/cli/src/services/machineAddonsProcess.spec.ts
+++ b/cli/src/services/machineAddonsProcess.spec.ts
@@ -49,6 +49,30 @@ describe('the add-ons of a device that is this machine, in their own process', (
expect(await ask(PUBLISH, LOCAL)).toMatchObject({ result: { topics: 1 } })
})
+ it('keeps no machine id from a core that went before it answered, and asks the next core again', async () => {
+ const t = setup()
+ const ask = t.wire().requests.machine_addon!
+ let answer!: (address: unknown) => void
+ const gone = vi.fn(() => new Promise((resolve) => { answer = resolve }))
+ t.wire().onConnected!({ query: gone } as never)
+ t.wire().onDisconnected!()
+ // The core that went answers late, with an address that would otherwise be taken.
+ answer({ command: 'harness', port: 1, machineId: 'm_stale' })
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(await ask(PUBLISH, LOCAL)).toMatchObject({ error: { code: 'UNAVAILABLE' } })
+ // A core whose answer fails leaves the id unknown, never a stuck read: a request
+ // in flight shares the read, and the next asks again.
+ const failing = vi.fn(async () => { throw new Error('query failed') })
+ t.wire().onConnected!({ query: failing } as never)
+ expect(await ask(PUBLISH, LOCAL)).toMatchObject({ error: { code: 'UNAVAILABLE' } })
+ expect(failing).toHaveBeenCalledTimes(1)
+ expect(await ask(PUBLISH, LOCAL)).toMatchObject({ error: { code: 'UNAVAILABLE' } })
+ expect(failing).toHaveBeenCalledTimes(2)
+ t.wire().onConnected!({ query: t.query } as never)
+ expect(await ask(PUBLISH, LOCAL)).toMatchObject({ result: { topics: 1 } })
+ expect(await ask({ op: 'state' }, LOCAL)).toMatchObject({ result: { devices: [{ deviceId: 'm_account' }] } })
+ })
+
it('runs as a real service by default, answering every request the core routes to it', () => {
runMachineAddonsService({ dataDir: '/data', socketPath: '/data/daemon-1.sock', machineId: 'm', token: 't' })
const options = vi.mocked(runServiceProcess).mock.calls.at(-1)![0]
diff --git a/cli/src/services/osDevice.spec.ts b/cli/src/services/osDevice.spec.ts
index 7b31476c5..e219c3576 100644
--- a/cli/src/services/osDevice.spec.ts
+++ b/cli/src/services/osDevice.spec.ts
@@ -2,14 +2,25 @@ import { EventEmitter } from 'node:events'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { encryptDownFrame, encryptRpcResult } from '../lib/e2ee/applicationFrames.js'
import { fakeCore } from '../testing/fakeCore.js'
+import { computerUseAvailable } from '../agentClient/computerUse.js'
+import { env } from '../config/env.js'
+import { MACHINE_MCP_FILE } from '../lib/machineMcp.js'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
import {
- activeSsid, CHECK_NOW, CMDLINE, deviceCodeOf, execBounded, GH, githubDeviceSignIn, githubLoginOf, joinRequest, LIVE_UPDATE, MAX_OUTPUT, nmcliFields, OS_DEVICE_REQUESTS, SETUP, SETUP_RESULT, spawnDetached,
+ activeSsid, CHECK_NOW, CMDLINE, deviceCodeOf, execBounded, GH, GITHUB_SIGN_IN_MS, githubDeviceSignIn, githubLoginOf, joinRequest, LIVE_UPDATE, MAX_OUTPUT, nmcliFields, OS_DEVICE_REQUESTS, SETUP, SETUP_RESULT, spawnDetached,
startOsDevice, UPDATE_BUSY_MS, updateOf, wifiNetworks, type OsDeviceDeps,
} from './osDevice.js'
-// Nothing real is ever run: the defaults' child_process is this fake.
-const child = vi.hoisted(() => ({ execFile: vi.fn(), spawn: vi.fn() }))
+// Nothing real is ever run: the defaults' child_process is this fake. OpenCode's version is never found, so
+// computer use's default leaves OpenCode's own config alone (agentClient/computerUse.ts applyOpencode).
+const child = vi.hoisted(() => ({ execFile: vi.fn(), spawn: vi.fn(), execFileSync: vi.fn(() => { throw new Error('no opencode here') }) }))
vi.mock('node:child_process', () => child)
+// Harness OS's computer-use tools are files under /usr/lib/harness-os, on no test machine: a test may say they are there.
+vi.mock('../agentClient/computerUse.js', async (real) => {
+ const actual = await real<typeof import('../agentClient/computerUse.js')>()
+ return { ...actual, computerUseAvailable: vi.fn(actual.computerUseAvailable) }
+})
const OWNER = { local: false, owner: true }
const STATUS = JSON.stringify({
@@ -224,6 +235,23 @@ describe('the Harness OS computer, managed from the phone', () => {
expect(await tools(false).ask({ action: 'computer_use', state: 'on' })).toEqual({ error: 'UNSUPPORTED_OS' })
expect(await tools().ask({ action: 'computer_use', state: 'on' }, { local: false, owner: false })).toEqual({ error: 'OWNER_REQUIRED' })
})
+
+ it('by default, says and turns them in this machine\'s mcp-servers.json, where harness computer-use does', async () => {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ vi.mocked(computerUseAvailable).mockReturnValue(true)
+ try {
+ // The test setup's throwaway data folder (vitest.setup.ts), never this computer's.
+ const servers = () => Object.keys(JSON.parse(readFileSync(join(env.ADAPTER_DATA_DIR, MACHINE_MCP_FILE), 'utf8')).servers)
+ const { ask } = service()
+ expect(await ask({ action: 'computer_use' })).toEqual({ on: false })
+ expect(await ask({ action: 'computer_use', state: 'on' })).toEqual({ on: true })
+ expect(servers()).toEqual(expect.arrayContaining(['playwright', 'desktop']))
+ expect(await ask({ action: 'computer_use' })).toEqual({ on: true })
+ expect(await ask({ action: 'computer_use', state: 'off' })).toEqual({ on: false })
+ expect(servers()).toEqual([])
+ expect(await ask({ action: 'computer_use' })).toEqual({ on: false })
+ } finally { vi.mocked(computerUseAvailable).mockReset() }
+ })
})
describe('checking for updates now, from the phone', () => {
@@ -418,6 +446,22 @@ describe('the Harness OS computer, managed from the phone', () => {
expect(await ask({ action: 'github' })).toEqual({ login: 'octo' })
})
+ it('stays signed in when git cannot be set up to use the account, and says so in the log', async () => {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {})
+ const { ask, exec, login, signInAs } = github()
+ const base = exec.getMockImplementation()!
+ exec.mockImplementation(async (file, args) => {
+ if (args[1] === 'setup-git') throw new Error('gh: git not found')
+ return base(file, args)
+ })
+ await ask({ action: 'github', state: 'sign_in' })
+ signInAs('octo')
+ login.end()
+ await vi.waitFor(() => expect(error).toHaveBeenCalledWith('[os-device] gh auth setup-git failed:', 'gh: git not found'))
+ expect(await ask({ action: 'github' })).toEqual({ login: 'octo' })
+ })
+
it('says why a sign-in ended without signing in, until the next one', async () => {
vi.spyOn(console, 'log').mockImplementation(() => {})
const { ask, login } = github()
@@ -438,6 +482,28 @@ describe('the Harness OS computer, managed from the phone', () => {
vi.useRealTimers()
})
+ it('forgets a sign-in it was signed out of: its late end neither shows an error nor ends the next one', async () => {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ const [first, second, third] = [signIn(), signIn(), signIn({ code: 'EF56-GH78', url: 'https://github.com/login/device' })]
+ const githubSignIn = vi.fn().mockReturnValueOnce(first.run).mockReturnValueOnce(second.run).mockReturnValueOnce(third.run)
+ const { ask } = github({ githubSignIn })
+ const settled = () => new Promise((resolve) => setTimeout(resolve, 0))
+ // Signed out while it waited: the gh it stopped ends with an error, which is not the phone's to show.
+ await ask({ action: 'github', state: 'sign_in' })
+ expect(await ask({ action: 'github', state: 'sign_out' })).toEqual({ login: null })
+ first.end(new Error('signal: killed'))
+ await settled()
+ expect(await ask({ action: 'github' })).toEqual({ login: null })
+ // Stopped gh ending after the next sign-in started: neither its error nor its end is the new one's.
+ await ask({ action: 'github', state: 'sign_in' })
+ await ask({ action: 'github', state: 'sign_out' })
+ const waiting = { login: null, signingIn: { code: 'EF56-GH78', url: 'https://github.com/login/device' } }
+ expect(await ask({ action: 'github', state: 'sign_in' })).toEqual(waiting)
+ second.end(new Error('signal: killed'))
+ await settled()
+ expect(await ask({ action: 'github' })).toEqual(waiting)
+ })
+
it('signs out of the account it uses, and stops a sign-in waiting', async () => {
vi.spyOn(console, 'log').mockImplementation(() => {})
const { ask, exec, login, signInAs } = github()
@@ -507,6 +573,44 @@ describe('the Harness OS computer, managed from the phone', () => {
expect(githubSignIn).not.toHaveBeenCalled()
})
+ it('says the GitHub CLI could not be put back when the setup gives no reason', async () => {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ const { ask, githubSignIn, done } = withoutGh(async () => '{"installed": false}')
+ await ask({ action: 'github', state: 'sign_in' })
+ await done
+ await vi.waitFor(async () => expect(await ask({ action: 'github' }))
+ .toEqual({ login: null, missing: true, signInError: 'The GitHub CLI could not be installed.' }))
+ expect(githubSignIn).not.toHaveBeenCalled()
+ })
+
+ it('signs in once the GitHub CLI is back even when its sign-in cannot be read', async () => {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ const { ask, exec, githubSignIn, done } = withoutGh(async () => '{"installed": true}')
+ const base = exec.getMockImplementation()!
+ exec.mockImplementation(async (file, args, options) => {
+ if (file === GH && args[1] === 'status') throw new Error('gh: config unreadable')
+ return base(file, args, options)
+ })
+ await ask({ action: 'github', state: 'sign_in' })
+ await done
+ await vi.waitFor(() => expect(githubSignIn).toHaveBeenCalledTimes(1))
+ })
+
+ it('says why, once the GitHub CLI is back, its sign-in showed no code', async () => {
+ vi.useFakeTimers()
+ try {
+ vi.spyOn(console, 'log').mockImplementation(() => {})
+ const stop = vi.fn()
+ const { ask, githubSignIn, done } = withoutGh(async () => '{"installed": true}')
+ githubSignIn.mockReturnValue({ code: new Promise(() => {}), done: new Promise(() => {}), stop } as never)
+ await ask({ action: 'github', state: 'sign_in' })
+ await done
+ await vi.advanceTimersByTimeAsync(15_000)
+ expect(stop).toHaveBeenCalled()
+ expect(await ask({ action: 'github' })).toEqual({ login: null, signInError: 'gh auth login did not show a code' })
+ } finally { vi.useRealTimers() }
+ })
+
it('asks for an update on an OS from before install-gh, whose sudo refuses it', async () => {
vi.spyOn(console, 'log').mockImplementation(() => {})
vi.spyOn(console, 'error').mockImplementation(() => {})
@@ -614,4 +718,38 @@ describe('the defaults that run commands', () => {
githubDeviceSignIn().stop()
expect(stopped.kill).toHaveBeenCalledWith('SIGKILL')
})
+
+ it('ends a device sign-in gh could not start, or that printed nothing, with why', async () => {
+ const missing = ghProcess()
+ const run = githubDeviceSignIn()
+ missing.emit('error', new Error('spawn gh ENOENT'))
+ await expect(run.code).rejects.toThrow('spawn gh ENOENT')
+ await expect(run.done).rejects.toThrow('spawn gh ENOENT')
+ const silent = ghProcess()
+ const quiet = githubDeviceSignIn()
+ silent.emit('close', 1)
+ await expect(quiet.done).rejects.toThrow('gh auth login exited 1')
+ })
+
+ it('kills a device sign-in nobody finished in time', () => {
+ vi.useFakeTimers()
+ try {
+ const proc = ghProcess()
+ githubDeviceSignIn()
+ vi.advanceTimersByTime(GITHUB_SIGN_IN_MS - 1)
+ expect(proc.kill).not.toHaveBeenCalled()
+ vi.advanceTimersByTime(1)
+ expect(proc.kill).toHaveBeenCalledWith('SIGKILL')
+ } finally { vi.useRealTimers() }
+ })
+
+ it('keeps no more of what gh prints than MAX_OUTPUT', async () => {
+ const proc = ghProcess()
+ const run = githubDeviceSignIn()
+ proc.stdout.emit('data', Buffer.from('x'.repeat(MAX_OUTPUT)))
+ // Past the bound, even a code is not read: a gh that floods its output never grows this process.
+ proc.stdout.emit('data', Buffer.from('\n! First copy your one-time code: B4B9-2B70\n'))
+ proc.emit('close', 1)
+ await expect(run.code).rejects.toThrow('x'.repeat(200))
+ })
})
diff --git a/cli/src/services/process.spec.ts b/cli/src/services/process.spec.ts
index b553bd729..aee41bcc4 100644
--- a/cli/src/services/process.spec.ts
+++ b/cli/src/services/process.spec.ts
@@ -230,13 +230,24 @@ describe('a service in its own process', () => {
// A guest's session, whose guest it is: never anything a payload says.
socket().say({ type: 'session_search', payload: { requestId: 'r9', guest: '[email protected]' }, asker: { local: false, owner: false, guest: '[email protected]' } })
socket().say({ type: 'session_search', payload: { requestId: 'r10', guest: '[email protected]' }, asker: { local: false, owner: false, guest: 7 } })
- await vi.waitFor(() => expect(asked).toHaveLength(10))
+ // Another of the owner's machines, as the core said it: never one a payload names, and none when malformed.
+ const remote = { local: false, owner: true }
+ socket().say({ type: 'session_search', payload: { requestId: 'r11', machine: { machineId: 'm_payload', label: 'Theirs' } }, asker: { ...remote, machine: { machineId: 'm_desk', label: 'Desk' } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r12' }, asker: { ...remote, machine: { machineId: 'm_desk', label: null } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r13' }, asker: { ...remote, machine: { machineId: '', label: 'Desk' } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r14' }, asker: { ...remote, machine: { machineId: 7, label: 'Desk' } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r15' }, asker: { ...remote, machine: { machineId: 'm_desk', label: 7 } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r16' }, asker: { ...remote, machine: { machineId: 'm_desk' } } })
+ socket().say({ type: 'session_search', payload: { requestId: 'r17', machine: { machineId: 'm_payload', label: null } }, asker: { ...remote, machine: null } })
+ await vi.waitFor(() => expect(asked).toHaveLength(17))
expect(asked).toEqual([
{ local: true, owner: true }, { local: false, owner: false }, { local: false, owner: false },
{ local: true, owner: true, connection: 'local:1', requestId: 'cmd-1' }, { local: true, owner: true },
{ local: false, owner: true, accountOwner: false }, { local: false, owner: true, accountOwner: true },
{ local: false, owner: true },
{ local: false, owner: false, guest: '[email protected]' }, { local: false, owner: false },
+ { ...remote, machine: { machineId: 'm_desk', label: 'Desk' } }, { ...remote, machine: { machineId: 'm_desk', label: null } },
+ remote, remote, remote, remote, remote,
])
})