mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
test(cloud): V3-01 a failed sign-in read after restart waits as unread; card row agentNotStarted label/tone/rank
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
cloudCardStateDetail,
|
||||
cloudCardUsageLine,
|
||||
cloudCardAttentionLabel,
|
||||
cloudCardAttentionTone,
|
||||
mostUrgentAttention,
|
||||
pickWorkspaceAgentSignIn,
|
||||
signInAttention
|
||||
@@ -120,3 +121,22 @@ describe('card attention for a running agent’s lapsed sign-in (n15)', () => {
|
||||
expect(row([])).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('a launch put back after a restart that waits for Start (V3-01)', () => {
|
||||
const notStarted = { kind: 'agentNotStarted' as const, agent: 'Claude', tabId: 't' }
|
||||
|
||||
it('reads "hasn’t started" in neutral colours, never "isn’t set up" or a warning', () => {
|
||||
expect(cloudCardAttentionLabel(notStarted, t)).toBe('Claude hasn’t started')
|
||||
expect(cloudCardAttentionTone(notStarted).text).toBe('text-foreground')
|
||||
expect(cloudCardAttentionTone(notStarted).dot).toContain('bg-muted-foreground')
|
||||
expect(
|
||||
cloudCardAttentionTone({ kind: 'agentNotSetUp', agent: 'Claude', tabId: 't' }).text
|
||||
).toBe('text-status-warning-text')
|
||||
})
|
||||
|
||||
it('ranks below an agent that can’t start, above commits and pushes being off', () => {
|
||||
const expired = { kind: 'agentExpired' as const, agent: 'Claude', tabId: 't' }
|
||||
expect(mostUrgentAttention([notStarted, expired])).toBe(expired)
|
||||
expect(mostUrgentAttention([{ kind: 'gitSetupOff' }, notStarted])).toBe(notStarted)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -9,10 +9,13 @@ import type { CreateWebRuntimeSessionTerminalOnHostArgs } from '@/runtime/hosted
|
||||
const mocks = vi.hoisted(() => {
|
||||
const state: {
|
||||
coverage: 'notSetUp' | 'covered' | 'expired'
|
||||
/** 'loading' with a failing read: Orca couldn't check the sign-in. */
|
||||
load: 'ready' | 'loading'
|
||||
closed: string[]
|
||||
listeners: Set<() => void>
|
||||
} = {
|
||||
coverage: 'notSetUp',
|
||||
load: 'ready',
|
||||
closed: [],
|
||||
listeners: new Set()
|
||||
}
|
||||
@@ -24,8 +27,13 @@ vi.mock('./orca-cloud-environment-id', () => ({
|
||||
isOrcaCloudExecutionHostId: () => true
|
||||
}))
|
||||
vi.mock('./orca-cloud-agent-accounts-store', () => ({
|
||||
readOrcaCloudAgentAccounts: () => ({ load: { kind: 'ready' }, keyKinds: {} }),
|
||||
ensureFreshOrcaCloudAgentAccounts: async () => ({ load: { kind: 'ready' }, keyKinds: {} }),
|
||||
readOrcaCloudAgentAccounts: () => ({ load: { kind: mocks.load }, keyKinds: {} }),
|
||||
ensureFreshOrcaCloudAgentAccounts: async () => {
|
||||
if (mocks.load === 'loading') {
|
||||
throw new Error('read failed')
|
||||
}
|
||||
return { load: { kind: 'ready' }, keyKinds: {} }
|
||||
},
|
||||
isOrcaCloudAgentAccountsFresh: () => true,
|
||||
subscribeOrcaCloudAgentAccounts: (listener: () => void) => {
|
||||
mocks.listeners.add(listener)
|
||||
@@ -83,6 +91,7 @@ beforeEach(() => {
|
||||
localStorage.clear()
|
||||
mocks.coverage = 'notSetUp'
|
||||
mocks.closed = []
|
||||
mocks.load = 'ready'
|
||||
mocks.listeners.clear()
|
||||
resetHeldCloudLaunchResumeForTest()
|
||||
useAppStore.setState({ activeOrcaProfileId: 'profile-a' })
|
||||
@@ -187,6 +196,21 @@ describe('after a restart', () => {
|
||||
expect(create).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('a sign-in read that fails after restart waits as unread, never "not set up"', async () => {
|
||||
mocks.load = 'loading'
|
||||
remember()
|
||||
setTabs([TAB])
|
||||
const create = vi.fn(async () => created('host-agent'))
|
||||
resumeHeldCloudLaunches(ENV, { create, waitMs: 5_000 })
|
||||
await flush()
|
||||
await flush()
|
||||
expect(readCloudAgentHold(cloudTabHoldKey(TAB))).toMatchObject({
|
||||
reason: 'awaitingStart',
|
||||
awaiting: 'unread'
|
||||
})
|
||||
expect(create).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('restored and expired: a Renew turns it awaitingStart and starts nothing', async () => {
|
||||
mocks.coverage = 'expired'
|
||||
remember()
|
||||
|
||||
Reference in New Issue
Block a user