mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 11:07:42 +00:00
* feat(sidebar): main produces per-workspace activity facts in shadow mode * perf(sidebar): agent pings keep last-read surfaces; shadow counts comparisons * fix(sidebar): settle review findings in the activity-facts producer and shadow check * fix(sidebar): refresh on inventory verdict clears; resync agents only when tabs move * fix(sidebar): scope the shadow comparison by each row's owner, not the focused host * refactor(sidebar): name the shadow scope after what it keeps * fix(sidebar): classify sidebarInputs as host-owned in the operation ownership census
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import type { AgentStatusEntry } from './agent-status-types'
|
|
import {
|
|
parseAgentStatusPaneIdentity,
|
|
resolveAgentStatusWorktreeId
|
|
} from './agent-status-worktree-attribution'
|
|
|
|
function entry(overrides: Partial<AgentStatusEntry> = {}): AgentStatusEntry {
|
|
return {
|
|
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111',
|
|
state: 'working',
|
|
prompt: '',
|
|
updatedAt: 1,
|
|
stateStartedAt: 1,
|
|
stateHistory: [],
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
describe('agent status worktree attribution', () => {
|
|
it('uses the pane tab before a stale worktree stamp', () => {
|
|
expect(
|
|
resolveAgentStatusWorktreeId(
|
|
entry({ worktreeId: 'stale-worktree' }),
|
|
new Map([['tab-1', 'current-worktree']])
|
|
)
|
|
).toBe('current-worktree')
|
|
})
|
|
|
|
it('falls back to a parent pane tab for a pre-mirror worker', () => {
|
|
expect(
|
|
resolveAgentStatusWorktreeId(
|
|
entry({
|
|
paneKey: 'worker-tab:22222222-2222-4222-8222-222222222222',
|
|
orchestration: {
|
|
taskId: 'task-1',
|
|
dispatchId: 'dispatch-1',
|
|
parentPaneKey: 'parent-tab:1'
|
|
}
|
|
}),
|
|
new Map([['parent-tab', 'parent-worktree']])
|
|
)
|
|
).toBe('parent-worktree')
|
|
})
|
|
|
|
it('parses legacy numeric pane identities consistently', () => {
|
|
expect(parseAgentStatusPaneIdentity('tab-1:7')).toEqual({ tabId: 'tab-1', paneId: '7' })
|
|
})
|
|
})
|
|
|
|
it.each([
|
|
{ connectionId: 'host-a' },
|
|
{ paneKey: 'web-terminal-shared:11111111-1111-4111-8111-111111111111' }
|
|
])('keeps the remote owner when another workspace has the same tab ID: %o', (remote) => {
|
|
const row = entry({ worktreeId: 'host-a-workspace', ...remote })
|
|
const tabId = row.paneKey.split(':')[0]
|
|
expect(resolveAgentStatusWorktreeId(row, new Map([[tabId, 'host-b-workspace']]))).toBe(
|
|
'host-a-workspace'
|
|
)
|
|
})
|