fix(workspaces): hide false repo error for remote servers (#11050)
This commit is contained in:
@@ -140,6 +140,7 @@ import { useFolderWorkspaceComposerPathStatus } from '@/components/sidebar/folde
|
||||
import { submitFolderWorkspaceCreate } from '@/components/sidebar/folder-workspace-composer-submit'
|
||||
import { buildExecutionHostRegistry } from '../../../shared/execution-host-registry'
|
||||
import {
|
||||
getRepoExecutionHostId,
|
||||
normalizeExecutionHostId,
|
||||
parseExecutionHostId,
|
||||
type ExecutionHostId
|
||||
@@ -826,6 +827,7 @@ export function useComposerState(options: UseComposerStateOptions): UseComposerS
|
||||
repoId: selectedRecipeRepoId,
|
||||
repoIsGit: selectedRepoIsGit,
|
||||
repoConnectionId: selectedRecipeRepoConnectionId,
|
||||
repoExecutionHostId: selectedRepo ? getRepoExecutionHostId(selectedRepo) : null,
|
||||
projectGroupTarget: isProjectGroupTarget,
|
||||
initialRecipeId: initialEphemeralVmRecipeId
|
||||
})
|
||||
|
||||
@@ -59,17 +59,20 @@ function installApi(listRecipes: ReturnType<typeof vi.fn>): {
|
||||
function Harness({
|
||||
repoId,
|
||||
initialRecipeId,
|
||||
enabled = true
|
||||
enabled = true,
|
||||
repoExecutionHostId = 'local'
|
||||
}: {
|
||||
repoId: string
|
||||
initialRecipeId?: string
|
||||
enabled?: boolean
|
||||
repoExecutionHostId?: 'local' | `runtime:${string}`
|
||||
}): React.JSX.Element {
|
||||
const state = useEphemeralVmRecipeOptions({
|
||||
enabled,
|
||||
repoId,
|
||||
repoIsGit: true,
|
||||
repoConnectionId: null,
|
||||
repoExecutionHostId,
|
||||
projectGroupTarget: false,
|
||||
initialRecipeId
|
||||
})
|
||||
@@ -78,6 +81,7 @@ function Harness({
|
||||
<span data-testid="repo">{repoId}</span>
|
||||
<span data-testid="recipes">{state.recipes.map((recipe) => recipe.id).join(',')}</span>
|
||||
<span data-testid="selected">{state.selectedRecipeId ?? 'none'}</span>
|
||||
<span data-testid="error">{state.error ?? 'none'}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -145,4 +149,22 @@ describe('useEphemeralVmRecipeOptions', () => {
|
||||
|
||||
expect(listRecipes).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not send a paired-runtime repo id to local recipe discovery', async () => {
|
||||
const listRecipes = vi.fn().mockResolvedValue({
|
||||
status: 'error',
|
||||
repoPath: null,
|
||||
diagnostics: [],
|
||||
recipes: [],
|
||||
message: 'Repo not found: repo-runtime'
|
||||
})
|
||||
installApi(listRecipes)
|
||||
|
||||
const { container } = await render(
|
||||
<Harness repoId="repo-runtime" repoExecutionHostId="runtime:windows-2" />
|
||||
)
|
||||
|
||||
expect(listRecipes).not.toHaveBeenCalled()
|
||||
expect(container.querySelector('[data-testid="error"]')?.textContent).toBe('none')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host'
|
||||
import type { OrcaVmRecipe } from '../../../shared/types'
|
||||
|
||||
type EphemeralVmRecipeOptionsArgs = {
|
||||
@@ -6,6 +7,7 @@ type EphemeralVmRecipeOptionsArgs = {
|
||||
repoId: string | null
|
||||
repoIsGit: boolean
|
||||
repoConnectionId: string | null
|
||||
repoExecutionHostId: ExecutionHostId | null
|
||||
projectGroupTarget: boolean
|
||||
initialRecipeId?: string
|
||||
}
|
||||
@@ -25,6 +27,7 @@ export function useEphemeralVmRecipeOptions(args: EphemeralVmRecipeOptionsArgs):
|
||||
Boolean(args.repoId) &&
|
||||
args.repoIsGit &&
|
||||
!args.repoConnectionId &&
|
||||
args.repoExecutionHostId === LOCAL_EXECUTION_HOST_ID &&
|
||||
!args.projectGroupTarget
|
||||
|
||||
const load = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user