Add project Windows runtime selection (#5519)

* Add project Windows runtime selection

* Fix project Windows runtime selection

Co-authored-by: Orca <help@stably.ai>

* fix: preserve WSL shell variables

---------

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Neil <neil@stably.ai>
This commit is contained in:
slashdevcorpse
2026-06-17 16:08:14 -07:00
committed by GitHub
co-authored by Orca Jinwoo-H Neil
parent 25d2053b25
commit 0ec3882cb8
333 changed files with 21039 additions and 5507 deletions
+76 -3
View File
@@ -35,11 +35,17 @@ const {
rateLimitGuardMock: vi.fn<() => RateLimitGuardResult>(() => ({ blocked: false })),
noteRateLimitSpendMock: vi.fn(),
ghRepoExecOptionsMock: vi.fn((context) =>
context.connectionId ? {} : { cwd: context.repoPath }
context.connectionId
? {}
: {
cwd: context.repoPath,
...(context.wslDistro ? { wslDistro: context.wslDistro } : {})
}
),
githubRepoContextMock: vi.fn((repoPath, connectionId) => ({
githubRepoContextMock: vi.fn((repoPath, connectionId, localGitOptions) => ({
repoPath,
connectionId: connectionId ?? null
connectionId: connectionId ?? null,
...localGitOptions
})),
getSshGitProviderMock: vi.fn(),
acquireMock: vi.fn(),
@@ -1218,6 +1224,73 @@ describe('getPRForBranch', () => {
})
})
it('routes local WSL branch status and conflict summary git probes through the selected distro', async () => {
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'acme', repo: 'widgets' })
ghExecFileAsyncMock.mockResolvedValueOnce({
stdout: JSON.stringify([
{
number: 42,
title: 'Fix PR discovery',
state: 'open',
html_url: 'https://github.com/acme/widgets/pull/42',
updated_at: '2026-06-16T00:00:00Z',
draft: false,
mergeable_state: 'dirty',
base: { ref: 'main', sha: 'base-oid' },
head: { ref: 'feature/test', sha: 'head-oid' }
}
])
})
gitExecFileAsyncMock
.mockResolvedValueOnce({ stdout: '' })
.mockResolvedValueOnce({ stdout: 'latest-base-oid\n' })
.mockResolvedValueOnce({ stdout: 'merge-base-oid\n' })
.mockResolvedValueOnce({ stdout: '2\n' })
.mockResolvedValueOnce({ stdout: 'result-tree-oid\u0000src/conflict.ts\u0000' })
const pr = await getPRForBranch('/repo-root', 'feature/test', null, null, null, {
localGitExecOptions: { wslDistro: 'Ubuntu' }
})
expect(pr?.conflictSummary?.files).toEqual(['src/conflict.ts'])
expect(resolvePRRepositoryCandidatesMock).toHaveBeenCalledWith('/repo-root', null, {
wslDistro: 'Ubuntu'
})
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(
expect.any(Array),
expect.objectContaining({
cwd: '/repo-root',
wslDistro: 'Ubuntu'
})
)
expect(gitExecFileAsyncMock).toHaveBeenNthCalledWith(
1,
['fetch', '--quiet', 'origin', 'main'],
{
cwd: '/repo-root',
timeout: 10_000,
wslDistro: 'Ubuntu'
}
)
expect(gitExecFileAsyncMock).toHaveBeenLastCalledWith(
[
'merge-tree',
'--write-tree',
'--name-only',
'-z',
'--no-messages',
'--merge-base',
'merge-base-oid',
'head-oid',
'latest-base-oid'
],
{
cwd: '/repo-root',
wslDistro: 'Ubuntu'
}
)
})
it('treats GitHub DIRTY merge state as conflicting when mergeable is still unknown', async () => {
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'acme', repo: 'widgets' })
ghExecFileAsyncMock