mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 19:34:29 +00:00
refactor(main): organize WSL discovery filesystem and execution owners (#37722)
* refactor(main): organize WSL discovery filesystem and execution owners * refactor(main): consolidate defining-owner path imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { normalizeGhAccountBinding } from '../../../../shared/github/account-binding'
|
||||
import { parseWslPath } from '../../../wsl'
|
||||
import { parseWslPath } from '../../../wsl/filesystem/unc-path-access'
|
||||
import { githubReadExecutionScope } from '../../github-read-execution-scope'
|
||||
import type { GitHubApiRepository } from '../../github-api-repository'
|
||||
import type { GhExecOptions } from '../github-exec-scope'
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as BackgroundDistroGate from '../../../wsl-background-distro-gate'
|
||||
import type * as BackgroundDistroGate from '../../../wsl/discovery/wsl-background-distro-gate'
|
||||
import {
|
||||
fakeSpawnDispatch,
|
||||
createFakeSpawnedChild
|
||||
} from '../../../../shared/__fixtures__/fake-spawned-child'
|
||||
import type * as WslModule from '../../../wsl'
|
||||
import type * as WslModule from '../../../wsl/discovery/distro-catalog'
|
||||
import { attachLogFixture, failedLogJob } from './check-job-log-test-fixture'
|
||||
import { startCheckJobLogDownload } from './check-job-log-download'
|
||||
import { prCheckLogTailCache } from './check-job-log-tails'
|
||||
import { setDefaultWslDistroOverride } from '../../../git/runner'
|
||||
const { spawnMock, distroMock } = vi.hoisted(() => ({ spawnMock: vi.fn(), distroMock: vi.fn() }))
|
||||
// The default-distro fallback asks whether the distro runs before it may start it (E9).
|
||||
vi.mock('../../../wsl-background-distro-gate', async (importOriginal) => ({
|
||||
vi.mock('../../../wsl/discovery/wsl-background-distro-gate', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof BackgroundDistroGate>()),
|
||||
readWslDistroRunningState: vi.fn(async () => 'running')
|
||||
}))
|
||||
|
||||
vi.mock('node:child_process', async (original) => ({ ...(await original()), spawn: spawnMock }))
|
||||
vi.mock('../../../wsl', async (original) => ({
|
||||
vi.mock('../../../wsl/discovery/distro-catalog', async (original) => ({
|
||||
...(await original<typeof WslModule>()),
|
||||
getDefaultWslDistro: distroMock
|
||||
}))
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
gitHubSshConfigHostAlias
|
||||
} from './github-remote-identity-parsing'
|
||||
import { resolveSshConfigHostname } from './github-ssh-host-alias-resolution'
|
||||
import { parseWslPath } from '../wsl'
|
||||
import { parseWslPath } from '../wsl/filesystem/unc-path-access'
|
||||
import { isStableMissingGitRemoteError } from '../git/stable-missing-git-remote-error'
|
||||
import { requireReachableGitRoute } from '../providers/execution-host-provider-dispatch'
|
||||
import { getConnectionExecutionHostId } from '../../shared/execution-host'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types'
|
||||
import { commandExecFileAsync } from '../git/runner'
|
||||
import { parseWslPath } from '../wsl'
|
||||
import { parseWslPath } from '../wsl/filesystem/unc-path-access'
|
||||
import { resolveWithSshG } from '../ssh/config/ssh-g-config-resolution'
|
||||
import {
|
||||
gitHubSshConfigHostAlias,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as WslUncAccessGateModule from '../wsl/wsl-unc-access-gate'
|
||||
import type * as WslUncAccessGateModule from '../wsl/filesystem/wsl-unc-access-gate'
|
||||
|
||||
const { coordinatorMocks, moduleMocks } = await vi.hoisted(async () => {
|
||||
const moduleMocks = await import('./pr-refresh-coordinator-test-mocks')
|
||||
@@ -18,7 +18,7 @@ vi.mock('./github-api-repository', () =>
|
||||
)
|
||||
vi.mock('./rate-limit', () => moduleMocks.rateLimitModuleMock(coordinatorMocks))
|
||||
vi.mock('../ipc/ui', () => moduleMocks.ipcUiModuleMock(coordinatorMocks))
|
||||
vi.mock('../wsl/wsl-unc-access-gate', async (importOriginal) => ({
|
||||
vi.mock('../wsl/filesystem/wsl-unc-access-gate', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof WslUncAccessGateModule>()),
|
||||
blockedWslDistroForPath: gate.blockedWslDistroForPath,
|
||||
wslDistroForPath: gate.wslDistroForPath
|
||||
@@ -50,7 +50,7 @@ describe('PR refresh for a stopped WSL distro (E9)', () => {
|
||||
|
||||
it("drains outside a user act that scheduled it, so a stopped distro's queue is not admitted", async () => {
|
||||
const { reportVisiblePRRefreshCandidates } = await import('./pr-refresh-coordinator')
|
||||
const { isWslUserActFor, runAsWslUserAct } = await import('../wsl/wsl-user-act-scope')
|
||||
const { isWslUserActFor, runAsWslUserAct } = await import('../wsl/discovery/wsl-user-act-scope')
|
||||
const drainedInsideAct: boolean[] = []
|
||||
gate.blockedWslDistroForPath.mockImplementation(async () => {
|
||||
drainedInsideAct.push(isWslUserActFor('Ubuntu'))
|
||||
|
||||
@@ -23,7 +23,7 @@ import { PRRefreshQueueDrainer, type PRRefreshRegistrationCheck } from './pr-ref
|
||||
import { prRefreshRateLimitPausedUntil } from './pr-refresh-rate-limit-gate'
|
||||
import { PRRefreshRetryState } from './pr-refresh-retry-state'
|
||||
import { PRRefreshVisibility } from './pr-refresh-visibility'
|
||||
import { blockedWslDistroForPath, wslDistroForPath } from '../wsl/wsl-unc-access-gate'
|
||||
import { blockedWslDistroForPath, wslDistroForPath } from '../wsl/filesystem/wsl-unc-access-gate'
|
||||
|
||||
const retry = new PRRefreshRetryState()
|
||||
const queue = new PRRefreshQueue((key) => retry.reset(key))
|
||||
|
||||
@@ -18,8 +18,8 @@ import type { PRRefreshEventPublisher } from './pr-refresh-event-publisher'
|
||||
import { type PRRefreshPacing, usesActiveRefreshPacing } from './pr-refresh-pacing'
|
||||
import type { PRRefreshQueue, PRRefreshQueueEntry } from './pr-refresh-queue'
|
||||
import { prRefreshRateLimitPausedUntil } from './pr-refresh-rate-limit-gate'
|
||||
import { blockedWslDistroForPath, wslDistroForPath } from '../wsl/wsl-unc-access-gate'
|
||||
import { outsideWslUserAct } from '../wsl/wsl-user-act-scope'
|
||||
import { blockedWslDistroForPath, wslDistroForPath } from '../wsl/filesystem/wsl-unc-access-gate'
|
||||
import { outsideWslUserAct } from '../wsl/discovery/wsl-user-act-scope'
|
||||
import type { PRRefreshRetryState } from './pr-refresh-retry-state'
|
||||
import type { PRRefreshVisibility } from './pr-refresh-visibility'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
guardWslUncPathAccess,
|
||||
WslDistroStoppedError,
|
||||
WslDistroUnverifiableError
|
||||
} from '../wsl/wsl-unc-access-gate'
|
||||
} from '../wsl/filesystem/wsl-unc-access-gate'
|
||||
|
||||
/**
|
||||
* Resolves a PR start point unless its repo's WSL distro is stopped (E9): a background push-target
|
||||
|
||||
Reference in New Issue
Block a user