mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 16:02:55 +00:00
Report pending setup state in workspace target resolution
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -155,6 +155,32 @@ describe('project-host workspace target resolution', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('reports setup-not-ready when the selected host has pending setup metadata', () => {
|
||||
const repo = makeRepo('orca')
|
||||
const projects = [makeProject('github:stablyai/orca', ['orca'])]
|
||||
const projectHostSetups = [
|
||||
makeSetup('orca', 'github:stablyai/orca', 'local', 'orca'),
|
||||
makeSetup('gpu-pending', 'github:stablyai/orca', 'runtime:gpu', '', {
|
||||
path: '',
|
||||
setupState: 'setting-up',
|
||||
setupMethod: 'provisioned'
|
||||
})
|
||||
]
|
||||
|
||||
expect(
|
||||
resolveWorkspaceCreationTarget({
|
||||
eligibleRepos: [repo],
|
||||
projects,
|
||||
projectHostSetups,
|
||||
projectId: 'github:stablyai/orca',
|
||||
hostId: 'runtime:gpu'
|
||||
})
|
||||
).toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'setup-not-ready'
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unavailable when an explicit setup is not ready', () => {
|
||||
const repo = makeRepo('orca')
|
||||
const projects = [makeProject('github:stablyai/orca', ['orca'])]
|
||||
|
||||
@@ -142,6 +142,12 @@ export function resolveWorkspaceCreationTarget(
|
||||
}
|
||||
|
||||
if (projectId && hostId) {
|
||||
const hostSetup = setups.find(
|
||||
(setup) => setup.projectId === projectId && setup.hostId === hostId
|
||||
)
|
||||
if (hostSetup && !isReadySetup(hostSetup)) {
|
||||
return { status: 'unavailable', reason: 'setup-not-ready' }
|
||||
}
|
||||
const target = findReadySetupTarget(
|
||||
setups,
|
||||
repoById,
|
||||
|
||||
Reference in New Issue
Block a user