mirror of
https://github.com/stablyai/orca.git
synced 2026-11-05 03:27:44 +00:00
perf(worktrees): fetch the base while the host's create picks a name (#26007)
* perf(worktrees): look up a branch's PR only after a name collision on the host's create The host's create (agent.launch, worktree.create, the phone and the CLI) called gh pr list for every create, a 1-3 s network round trip, while the desktop create probes only after a branch collision. A branch with an open PR exists on the remote, so the branch-conflict check already moves past it. * test(worktrees): pin first-name PR lookup skip on the host's create The runtime service specs still expected a PR lookup for a free first name. Update them to the desktop-parity behavior: no lookup without a branch collision, and a free push-target name is kept. Pin the exact suffixed name, and that a later name with a PR is skipped. * perf(worktrees): overlap the host create's base fetch with naming Keep the first-name PR lookup (restores main's naming) and take it off the critical path instead: start the base-ref refresh before naming and await it after, as the desktop create does, so the lookup and the fetch run concurrently. A refresh rejection while naming fails stays handled. * test(worktrees): pin the overlapped origin fetch on the host's create Cover the best-effort fetch origin path: it runs while the first-name PR lookup is pending, and its rejection while naming fails stays handled.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as GitHubClient from '../github/client'
|
||||
|
||||
const getPRForBranchMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('../github/client', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof GitHubClient>()),
|
||||
getPRForBranch: getPRForBranchMock
|
||||
}))
|
||||
|
||||
import { getLocalGitHubPrForBranch } from './runtime-worktree-create-git'
|
||||
|
||||
beforeEach(() => {
|
||||
getPRForBranchMock.mockReset()
|
||||
getPRForBranchMock.mockResolvedValue(null)
|
||||
})
|
||||
|
||||
describe('getLocalGitHubPrForBranch', () => {
|
||||
it('routes the PR lookup through the WSL distro', async () => {
|
||||
await getLocalGitHubPrForBranch('/repo', 'app', { wslDistro: 'Ubuntu' })
|
||||
|
||||
expect(getPRForBranchMock).toHaveBeenCalledWith('/repo', 'app', null, null, null, {
|
||||
localGitExecOptions: { wslDistro: 'Ubuntu' }
|
||||
})
|
||||
})
|
||||
|
||||
it('uses the plain lookup without project git options', async () => {
|
||||
await getLocalGitHubPrForBranch('/repo', 'app', {})
|
||||
|
||||
expect(getPRForBranchMock).toHaveBeenCalledWith('/repo', 'app')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user