mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
refactor(managed-server): move orcad activation into src/main/managed-server/activation/ (#30320)
First slice of the desktop side of managed orcad leaving src/main/ssh. git mv plus import and path-literal rewrites; host-lane workflow filters and the cross-host prefix list gain the new folder.
This commit is contained in:
@@ -13,6 +13,7 @@ on:
|
||||
- 'src/main/ssh/remote-*'
|
||||
- 'src/main/ssh/*runtime*'
|
||||
- 'src/main/ssh/orcad-*'
|
||||
- 'src/main/managed-server/**'
|
||||
- 'src/main/orcad/orcad-artifact-materializer.ts'
|
||||
- 'src/main/orcad/orcad-host-unavailable.ts'
|
||||
- 'src/main/node-runtime/**'
|
||||
|
||||
@@ -11,6 +11,7 @@ on:
|
||||
- 'src/main/ssh/remote-*'
|
||||
- 'src/main/ssh/*runtime*'
|
||||
- 'src/main/ssh/orcad-*'
|
||||
- 'src/main/managed-server/**'
|
||||
- 'src/main/orcad/orcad-artifact-materializer.ts'
|
||||
- 'src/main/orcad/orcad-host-unavailable.ts'
|
||||
- 'src/main/node-runtime/**'
|
||||
|
||||
@@ -14,7 +14,9 @@ on:
|
||||
- 'src/main/wsl/wsl-orcad-real-distro-lane.test.ts'
|
||||
# This lane executes only the real distro test above.
|
||||
- 'src/main/ssh/orcad-*'
|
||||
- 'src/main/managed-server/**'
|
||||
- '!src/main/ssh/orcad-*.test.ts'
|
||||
- '!src/main/managed-server/**/*.test.ts'
|
||||
- 'src/main/ssh/remote-install-transport.ts'
|
||||
# orcad-entry runs this on every boot of the orcad the lane launches in the distro.
|
||||
- 'src/main/orcad/orcad-wsl-*'
|
||||
|
||||
@@ -5586,13 +5586,13 @@
|
||||
"src/main/ssh/legacy-relay/legacy-relay-endpoints.test.ts": 173,
|
||||
"src/main/ssh/legacy-relay/legacy-relay-target-bridge.test.ts": 74,
|
||||
"src/main/ssh/managed-server-fence-recheck.test.ts": 484,
|
||||
"src/main/ssh/orcad-activation-crash-recovery.test.ts": 1032,
|
||||
"src/main/ssh/orcad-activation-fence-generation.test.ts": 826,
|
||||
"src/main/ssh/orcad-activation-fence-hold.test.ts": 397,
|
||||
"src/main/ssh/orcad-activation-gate.test.ts": 40,
|
||||
"src/main/managed-server/activation/orcad-activation-crash-recovery.test.ts": 1032,
|
||||
"src/main/managed-server/activation/orcad-activation-fence-generation.test.ts": 826,
|
||||
"src/main/managed-server/activation/orcad-activation-fence-hold.test.ts": 397,
|
||||
"src/main/managed-server/activation/orcad-activation-gate.test.ts": 40,
|
||||
"src/main/ssh/orcad-activation-outcome-log.test.ts": 40,
|
||||
"src/main/ssh/orcad-activation-record.test.ts": 245,
|
||||
"src/main/ssh/orcad-activation-transaction.test.ts": 451,
|
||||
"src/main/managed-server/activation/orcad-activation-record.test.ts": 245,
|
||||
"src/main/managed-server/activation/orcad-activation-transaction.test.ts": 451,
|
||||
"src/main/ssh/orcad-decommission-released-peer-recovery.test.ts": 266,
|
||||
"src/main/ssh/orcad-decommission-transaction.test.ts": 309,
|
||||
"src/main/ssh/orcad-deployment-target.test.ts": 263,
|
||||
|
||||
@@ -19,6 +19,7 @@ const BUILD_PREFIXES = [
|
||||
// A remote target's OS does not identify the client platform that builds its commands.
|
||||
const CROSS_HOST_PREFIXES = [
|
||||
'src/main/ssh/',
|
||||
'src/main/managed-server/',
|
||||
'src/main/node-runtime/',
|
||||
'src/main/orcad/orcad-artifact-materializer.ts',
|
||||
'src/main/orcad/orcad-host-unavailable.ts',
|
||||
|
||||
+27
-25
@@ -1,8 +1,8 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as ExecCommandModule from './remote-exec-command'
|
||||
import type * as RecordFile from './orcad-remote-record-file'
|
||||
import type * as InstallLock from './remote-install-lock'
|
||||
import type * as VersionedInstall from './remote-versioned-install'
|
||||
import type * as ExecCommandModule from '../../ssh/remote-exec-command'
|
||||
import type * as RecordFile from '../../ssh/orcad-remote-record-file'
|
||||
import type * as InstallLock from '../../ssh/remote-install-lock'
|
||||
import type * as VersionedInstall from '../../ssh/remote-versioned-install'
|
||||
import type * as Crypto from 'node:crypto'
|
||||
|
||||
const uuid = vi.hoisted((): { fixed: string | null } => ({ fixed: null }))
|
||||
@@ -11,44 +11,44 @@ vi.mock('node:crypto', async (importOriginal) => {
|
||||
return { ...actual, randomUUID: () => uuid.fixed ?? actual.randomUUID() }
|
||||
})
|
||||
|
||||
vi.mock('./remote-exec-command', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/remote-exec-command', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof ExecCommandModule>()),
|
||||
execCommand: vi.fn()
|
||||
}))
|
||||
vi.mock('./ssh-connection-utils', () => ({
|
||||
vi.mock('../../ssh/ssh-connection-utils', () => ({
|
||||
shellEscape: (s: string) => `'${s}'`
|
||||
}))
|
||||
vi.mock('./remote-install-lock', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/remote-install-lock', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof InstallLock>()),
|
||||
acquireInstallLock: vi.fn()
|
||||
}))
|
||||
vi.mock('./orcad-remote-record-file', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/orcad-remote-record-file', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RecordFile>()),
|
||||
writeAtomicOrcadRemoteRecord: vi.fn()
|
||||
}))
|
||||
vi.mock('./remote-versioned-install', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/remote-versioned-install', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof VersionedInstall>()),
|
||||
readLocalFullVersion: () => '0.2.0+bb01'
|
||||
}))
|
||||
vi.mock('./orcad-remote-install', () => ({ installOrcadBundle: vi.fn() }))
|
||||
vi.mock('./orcad-remote-preflight', () => ({
|
||||
vi.mock('../../ssh/orcad-remote-install', () => ({ installOrcadBundle: vi.fn() }))
|
||||
vi.mock('../../ssh/orcad-remote-preflight', () => ({
|
||||
preflightInstalledOrcad: vi.fn()
|
||||
}))
|
||||
vi.mock('./orcad-local-build-hash', () => ({
|
||||
vi.mock('../../ssh/orcad-local-build-hash', () => ({
|
||||
computeLocalOrcadBuildHash: () => 'abc123def4567890'
|
||||
}))
|
||||
|
||||
import { execCommand } from './remote-exec-command'
|
||||
import { acquireInstallLock } from './remote-install-lock'
|
||||
import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { deployOrcad } from './orcad-remote-deploy'
|
||||
import { rollbackOrcad } from './orcad-remote-rollback'
|
||||
import { execCommand } from '../../ssh/remote-exec-command'
|
||||
import { acquireInstallLock } from '../../ssh/remote-install-lock'
|
||||
import { writeAtomicOrcadRemoteRecord } from '../../ssh/orcad-remote-record-file'
|
||||
import { deployOrcad } from '../../ssh/orcad-remote-deploy'
|
||||
import { rollbackOrcad } from '../../ssh/orcad-remote-rollback'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { wakeStoppedManagedOrcad } from './orcad-managed-wake'
|
||||
import { planManagedOrcadAutoUpdate } from './orcad-managed-auto-update'
|
||||
import { wakeStoppedManagedOrcad } from '../../ssh/orcad-managed-wake'
|
||||
import { planManagedOrcadAutoUpdate } from '../../ssh/orcad-managed-auto-update'
|
||||
import { parseOrcadActivationRecord } from './orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { getRemoteHostPlatform } from '../../ssh/ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from '../../ssh/orcad-host-transport'
|
||||
import {
|
||||
BUILD_HASH,
|
||||
FakeOrcadHost,
|
||||
@@ -110,8 +110,9 @@ beforeEach(() => {
|
||||
vi.mocked(execCommand).mockImplementation(async (_conn, command) => host.exec(command))
|
||||
vi.mocked(acquireInstallLock).mockImplementation(async (_conn, dir, _host, options) => {
|
||||
if (!host.acquireFence(options)) {
|
||||
const { RemoteInstallLockBusyError } =
|
||||
await vi.importActual<typeof InstallLock>('./remote-install-lock')
|
||||
const { RemoteInstallLockBusyError } = await vi.importActual<typeof InstallLock>(
|
||||
'../../ssh/remote-install-lock'
|
||||
)
|
||||
throw new RemoteInstallLockBusyError(dir, 0)
|
||||
}
|
||||
})
|
||||
@@ -363,8 +364,9 @@ describe('recovery refusals keep the fence', () => {
|
||||
host.crashAt = null
|
||||
const journal = host.journal
|
||||
expect(journal).not.toBeNull()
|
||||
const { RemoteInstallLockBusyError } =
|
||||
await vi.importActual<typeof InstallLock>('./remote-install-lock')
|
||||
const { RemoteInstallLockBusyError } = await vi.importActual<typeof InstallLock>(
|
||||
'../../ssh/remote-install-lock'
|
||||
)
|
||||
vi.mocked(acquireInstallLock).mockRejectedValueOnce(new RemoteInstallLockBusyError('/l', 0))
|
||||
expect(await recoverInterruptedOrcadActivation({ ...slot })).toMatchObject({
|
||||
outcome: 'pending'
|
||||
+7
-7
@@ -11,18 +11,18 @@ import {
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as ExecCommandModule from './remote-exec-command'
|
||||
import type * as ExecCommandModule from '../../ssh/remote-exec-command'
|
||||
|
||||
// Every remote command runs in a real local shell, so the host-side checks are the real ones.
|
||||
const shell = vi.hoisted((): { env: NodeJS.ProcessEnv | undefined } => ({ env: undefined }))
|
||||
vi.mock('./remote-exec-command', async (importOriginal) => {
|
||||
vi.mock('../../ssh/remote-exec-command', async (importOriginal) => {
|
||||
const { runProcess } = await import('@orca/process-host')
|
||||
return {
|
||||
...(await importOriginal<typeof ExecCommandModule>()),
|
||||
execCommand: async (_conn: unknown, command: string) => {
|
||||
const result = await runProcess({ program: '/bin/sh', args: ['-c', command], env: shell.env })
|
||||
if (result.code !== 0) {
|
||||
const { sshCommandExitError } = await import('./remote-exec-command')
|
||||
const { sshCommandExitError } = await import('../../ssh/remote-exec-command')
|
||||
throw sshCommandExitError(command, result.code ?? 1, result.stdout)
|
||||
}
|
||||
return result.stdout
|
||||
@@ -32,11 +32,11 @@ vi.mock('./remote-exec-command', async (importOriginal) => {
|
||||
|
||||
const { withOrcadActivationLock } = await import('./orcad-activation-lock')
|
||||
const { orcadActivationFenceRefusal } = await import('./orcad-activation-fence-hold')
|
||||
const { execOrcadRemote } = await import('./orcad-remote-runtime-control')
|
||||
const { execOrcadRemote } = await import('../../ssh/orcad-remote-runtime-control')
|
||||
const { OrcadFenceLostError, runWithOrcadFence } = await import('./orcad-activation-fence-scope')
|
||||
const { execOrcadStateMutation } = await import('./orcad-state-mutation-exec')
|
||||
const { clearOrcadStateSnapshotMembersCommand } = await import('./orcad-state-snapshot')
|
||||
const { getRemoteHostPlatform } = await import('./ssh-remote-platform')
|
||||
const { execOrcadStateMutation } = await import('../../ssh/orcad-state-mutation-exec')
|
||||
const { clearOrcadStateSnapshotMembersCommand } = await import('../../ssh/orcad-state-snapshot')
|
||||
const { getRemoteHostPlatform } = await import('../../ssh/ssh-remote-platform')
|
||||
|
||||
const homes: string[] = []
|
||||
afterEach(() => {
|
||||
+1
-1
@@ -6,7 +6,7 @@ const mocks = vi.hoisted(() => ({
|
||||
fence: vi.fn(),
|
||||
takeover: vi.fn()
|
||||
}))
|
||||
vi.mock('./remote-install-lock', () => ({
|
||||
vi.mock('../../ssh/remote-install-lock', () => ({
|
||||
isRelayInstallLockStale: mocks.stale,
|
||||
RELAY_INSTALL_LOCK_NAME: '.install-lock'
|
||||
}))
|
||||
+3
-3
@@ -11,9 +11,9 @@ import {
|
||||
} from './orcad-activation-lock'
|
||||
import { readOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { orcadActivationFenceLockDir } from './orcad-activation-transaction'
|
||||
import { isRelayInstallLockStale } from './remote-install-lock'
|
||||
import { findExitedOwnLockToken } from './orcad-exited-own-lock'
|
||||
import { orcadRemoteBaseDir } from './orcad-remote-windows-node'
|
||||
import { isRelayInstallLockStale } from '../../ssh/remote-install-lock'
|
||||
import { findExitedOwnLockToken } from '../../ssh/orcad-exited-own-lock'
|
||||
import { orcadRemoteBaseDir } from '../../ssh/orcad-remote-windows-node'
|
||||
|
||||
export const ORCAD_ACTIVATION_FENCE_BUSY_CODE = 'orcad_activation_fence_busy'
|
||||
const ORCAD_ACTIVATION_RECOVERY_REQUIRED_CODE = 'orcad_activation_recovery_required'
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
* launching, mutating state, or deleting the successor's fence and journal.
|
||||
*/
|
||||
import { AsyncLocalStorage } from 'node:async_hooks'
|
||||
import { shellEscape } from './ssh-connection-utils'
|
||||
import { isSshCommandExitError } from './remote-exec-command'
|
||||
import { shellEscape } from '../../ssh/ssh-connection-utils'
|
||||
import { isSshCommandExitError } from '../../ssh/remote-exec-command'
|
||||
|
||||
export const ORCAD_FENCE_OWNER_FILENAME = '.orca-fence-owner'
|
||||
export const ORCAD_FENCE_LOST_MARKER = '__ORCAD_FENCE_LOST__'
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { evaluateOrcadActivation } from './orcad-activation-gate'
|
||||
import { classifyOrcadHostUnavailable } from '../orcad/orcad-host-unavailable'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { OrcadHealth, TerminalDaemonHealth } from '../orcad/orcad-health'
|
||||
import { classifyOrcadHostUnavailable } from '../../orcad/orcad-host-unavailable'
|
||||
import type { ServeReadiness } from '../../server/serve-readiness'
|
||||
import type { OrcadHealth, TerminalDaemonHealth } from '../../orcad/orcad-health'
|
||||
|
||||
const EXPECTED = { buildHash: 'abc123def4567890', fullVersion: '0.2.0+bb01' }
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
* version is still active; nothing was lost. Activating on a bad verdict is what loses
|
||||
* things.
|
||||
*/
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { ServeReadiness } from '../../server/serve-readiness'
|
||||
|
||||
type OrcadActivationRejectCode =
|
||||
| 'orcad_activation_no_readiness'
|
||||
+2
-2
@@ -9,8 +9,8 @@ import {
|
||||
withActivatedVersion,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
import { isSnapshotCaptureCommand } from './orcad-snapshot-capture-command'
|
||||
import { sshCommandExitError } from './remote-exec-command'
|
||||
import { isSnapshotCaptureCommand } from '../../ssh/orcad-snapshot-capture-command'
|
||||
import { sshCommandExitError } from '../../ssh/remote-exec-command'
|
||||
|
||||
export const OLD = '0.1.0+aa01'
|
||||
export const NEW = '0.2.0+bb01'
|
||||
+9
-9
@@ -11,24 +11,24 @@ import {
|
||||
execOrcadRemote,
|
||||
withoutAbortSignal,
|
||||
type OrcadRemoteExecTarget
|
||||
} from './orcad-remote-runtime-control'
|
||||
import { isUnconfirmedSshCommandTermination } from './remote-exec-command'
|
||||
import { acquireInstallLock, RemoteInstallLockBusyError } from './remote-install-lock'
|
||||
} from '../../ssh/orcad-remote-runtime-control'
|
||||
import { isUnconfirmedSshCommandTermination } from '../../ssh/remote-exec-command'
|
||||
import { acquireInstallLock, RemoteInstallLockBusyError } from '../../ssh/remote-install-lock'
|
||||
import {
|
||||
orphanInstallLockCommand,
|
||||
probeInstallLockExistsCommand
|
||||
} from './remote-install-lock-commands'
|
||||
import { shellEscape } from './ssh-connection-utils'
|
||||
} from '../../ssh/remote-install-lock-commands'
|
||||
import { shellEscape } from '../../ssh/ssh-connection-utils'
|
||||
import {
|
||||
ORCAD_FENCE_OWNER_FILENAME,
|
||||
posixOrcadFenceOwnedTest,
|
||||
runWithOrcadFence,
|
||||
type OrcadFence
|
||||
} from './orcad-activation-fence-scope'
|
||||
import { orcadRemoteBaseDir, orcadWindowsHomeOpCommand } from './orcad-remote-windows-node'
|
||||
import { forgetHeldOrcadFence, rememberHeldOrcadFence } from './orcad-held-fence-tokens'
|
||||
import { exitedOwnLockProof } from './orcad-exited-own-lock'
|
||||
import { isWindowsRemoteHost } from './ssh-remote-platform'
|
||||
import { orcadRemoteBaseDir, orcadWindowsHomeOpCommand } from '../../ssh/orcad-remote-windows-node'
|
||||
import { forgetHeldOrcadFence, rememberHeldOrcadFence } from '../../ssh/orcad-held-fence-tokens'
|
||||
import { exitedOwnLockProof } from '../../ssh/orcad-exited-own-lock'
|
||||
import { isWindowsRemoteHost } from '../../ssh/ssh-remote-platform'
|
||||
import {
|
||||
orcadActivationFenceLockDir,
|
||||
orcadActivationTransactionPath,
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* The app log line for an update or rollback that did not go through. Status keeps only the
|
||||
* latest deferral, so without this the first refusal's code and reason are lost (BUG-17).
|
||||
*/
|
||||
import { errorMessage } from '../../shared/error-message'
|
||||
import { errorMessage } from '../../../shared/error-message'
|
||||
|
||||
type Unsettled = { outcome: string; code?: string; reason?: string }
|
||||
|
||||
+4
-4
@@ -5,8 +5,8 @@
|
||||
* unreadable record must fail loudly in both: treating "I cannot parse this" as "nothing is
|
||||
* activated" would deploy over a live install and lose its rollback target.
|
||||
*/
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { RELAY_REMOTE_DIR } from './remote-frame-protocol'
|
||||
import type { OrcadHostTransport } from '../../ssh/orcad-host-transport'
|
||||
import { RELAY_REMOTE_DIR } from '../../ssh/remote-frame-protocol'
|
||||
import {
|
||||
ORCAD_ACTIVATION_FILENAME,
|
||||
emptyOrcadActivationRecord,
|
||||
@@ -15,11 +15,11 @@ import {
|
||||
type OrcadActivationReadResult,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
import { joinRemotePath, type RemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { joinRemotePath, type RemoteHostPlatform } from '../../ssh/ssh-remote-platform'
|
||||
import {
|
||||
readBoundedOrcadRemoteRecord,
|
||||
writeAtomicOrcadRemoteRecord
|
||||
} from './orcad-remote-record-file'
|
||||
} from '../../ssh/orcad-remote-record-file'
|
||||
|
||||
const ORCAD_ACTIVATION_RECORD_MAX_BYTES = 64 * 1024
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
* It lives beside the version dirs (`~/.orca-remote/orcad-active.json`), not inside one,
|
||||
* because it has to outlive whichever version GC removes.
|
||||
*/
|
||||
import { remoteInstallDirName, ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { remoteInstallDirName, ORCAD_INSTALL_MODEL } from '../../ssh/remote-install-model'
|
||||
|
||||
export const ORCAD_ACTIVATION_FILENAME = 'orcad-active.json'
|
||||
export const ORCAD_ACTIVATION_SCHEMA_VERSION = 1
|
||||
+8
-8
@@ -3,7 +3,7 @@
|
||||
* unverifiable failure left fenced. Either way the host ends serving exactly the slot its
|
||||
* activation record names, or the fence stays for an operator.
|
||||
*/
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { ServeReadiness } from '../../server/serve-readiness'
|
||||
import {
|
||||
planOrcadTransactionRecovery,
|
||||
type OrcadActivationTransaction
|
||||
@@ -17,16 +17,16 @@ import {
|
||||
orcadActivationFenceExists,
|
||||
withStaleOrcadActivationRecoveryLock
|
||||
} from './orcad-activation-lock'
|
||||
import { RemoteInstallLockBusyError } from './remote-install-lock'
|
||||
import { ensureOrcadSlotServing, resolveOrcadSlotIdentity } from './orcad-recovery-slot'
|
||||
import { reconcileOrcadDecommission } from './orcad-decommission-recovery'
|
||||
import { RemoteInstallLockBusyError } from '../../ssh/remote-install-lock'
|
||||
import { ensureOrcadSlotServing, resolveOrcadSlotIdentity } from '../../ssh/orcad-recovery-slot'
|
||||
import { reconcileOrcadDecommission } from '../../ssh/orcad-decommission-recovery'
|
||||
import {
|
||||
recoverOrcadIncumbent,
|
||||
type OrcadIncumbentRecoveryOptions
|
||||
} from './orcad-incumbent-recovery'
|
||||
import type { OrcadManagedRefusal } from '../../shared/orcad-managed-runtime'
|
||||
import { resumeInterruptedOrcadCandidate } from './orcad-interrupted-candidate-resume'
|
||||
import { errorMessage } from '../../shared/error-message'
|
||||
} from '../../ssh/orcad-incumbent-recovery'
|
||||
import type { OrcadManagedRefusal } from '../../../shared/orcad-managed-runtime'
|
||||
import { resumeInterruptedOrcadCandidate } from '../../ssh/orcad-interrupted-candidate-resume'
|
||||
import { errorMessage } from '../../../shared/error-message'
|
||||
|
||||
export type OrcadActivationRecoveryResult =
|
||||
| { outcome: 'none' }
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import { z } from 'zod'
|
||||
import { OrcadManagedStopRequestSchema } from '../../shared/orcad-stop-request'
|
||||
import { OrcadManagedStopRequestSchema } from '../../../shared/orcad-stop-request'
|
||||
import {
|
||||
ORCAD_INSTALL_MODEL,
|
||||
remoteInstallDirName,
|
||||
remoteInstallVersionDirRegex
|
||||
} from './remote-install-model'
|
||||
} from '../../ssh/remote-install-model'
|
||||
|
||||
export const ORCAD_ACTIVATION_TRANSACTION_SCHEMA_VERSION = 1
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import {
|
||||
import {
|
||||
readBoundedOrcadRemoteRecord,
|
||||
writeAtomicOrcadRemoteRecord
|
||||
} from './orcad-remote-record-file'
|
||||
import type { OrcadRemoteExecTarget } from './orcad-remote-runtime-control'
|
||||
} from '../../ssh/orcad-remote-record-file'
|
||||
import type { OrcadRemoteExecTarget } from '../../ssh/orcad-remote-runtime-control'
|
||||
import { currentOrcadFence } from './orcad-activation-fence-scope'
|
||||
|
||||
const ORCAD_ACTIVATION_TRANSACTION_MAX_BYTES = 64 * 1024
|
||||
+7
-7
@@ -1,18 +1,18 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type * as ExecCommandModule from './remote-exec-command'
|
||||
import type * as InstallLock from './remote-install-lock'
|
||||
import type * as ExecCommandModule from '../../ssh/remote-exec-command'
|
||||
import type * as InstallLock from '../../ssh/remote-install-lock'
|
||||
|
||||
vi.mock('./remote-exec-command', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/remote-exec-command', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof ExecCommandModule>()),
|
||||
execCommand: vi.fn().mockResolvedValue('')
|
||||
}))
|
||||
vi.mock('./remote-install-lock', async (importOriginal) => ({
|
||||
vi.mock('../../ssh/remote-install-lock', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof InstallLock>()),
|
||||
acquireInstallLock: vi.fn().mockResolvedValue(undefined)
|
||||
}))
|
||||
|
||||
import { execCommand } from './remote-exec-command'
|
||||
import { acquireInstallLock, RemoteInstallLockBusyError } from './remote-install-lock'
|
||||
import { execCommand } from '../../ssh/remote-exec-command'
|
||||
import { acquireInstallLock, RemoteInstallLockBusyError } from '../../ssh/remote-install-lock'
|
||||
import {
|
||||
parseOrcadActivationTransaction,
|
||||
planOrcadTransactionRecovery,
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
} from './orcad-activation-lock'
|
||||
import { FakeOrcadHost, NEW, OLD } from './orcad-activation-host-test-harness'
|
||||
import { withRolledBackVersion } from './orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { getRemoteHostPlatform } from '../../ssh/ssh-remote-platform'
|
||||
|
||||
const T = new Date('2026-02-02T00:00:00.000Z')
|
||||
const ID = '7f1c2a7e-6c1b-4a8e-9f0e-0a1b2c3d4e5f'
|
||||
+5
-5
@@ -22,11 +22,11 @@ import {
|
||||
planOrcadDecommissionRecovery,
|
||||
type OrcadDecommissionRecoveryPlan,
|
||||
type OrcadDecommissionTransaction
|
||||
} from './orcad-decommission-transaction'
|
||||
import { errorMessage } from '../../shared/error-message'
|
||||
import { RELAY_INSTALL_LOCK_NAME } from '../../shared/relay-install-lock-name'
|
||||
import { RELAY_REMOTE_DIR } from './remote-frame-protocol'
|
||||
import { joinRemotePath, type RemoteHostPlatform } from './ssh-remote-platform'
|
||||
} from '../../ssh/orcad-decommission-transaction'
|
||||
import { errorMessage } from '../../../shared/error-message'
|
||||
import { RELAY_INSTALL_LOCK_NAME } from '../../../shared/relay-install-lock-name'
|
||||
import { RELAY_REMOTE_DIR } from '../../ssh/remote-frame-protocol'
|
||||
import { joinRemotePath, type RemoteHostPlatform } from '../../ssh/ssh-remote-platform'
|
||||
|
||||
export const ORCAD_ACTIVATION_TRANSACTION_FILENAME = 'transaction.json'
|
||||
export const ORCAD_ACTIVATION_TRANSACTION_DIRNAME = '.orcad-activation-transaction'
|
||||
@@ -41,7 +41,10 @@ import {
|
||||
getOrcaProfileStateDatabaseFile
|
||||
} from '../orca-profiles/profile-storage-paths'
|
||||
import type { SshConnection } from '../ssh/ssh-connection'
|
||||
import { emptyOrcadActivationRecord, orcadGcPinnedDirNames } from '../ssh/orcad-activation-record'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
orcadGcPinnedDirNames
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { gcOldOrcadVersions } from '../ssh/orcad-remote-gc'
|
||||
import { ORCAD_PID_FILENAME, ORCAD_READINESS_FILENAME } from '../ssh/orcad-remote-host-support'
|
||||
import { orcadLaunchCommand, parseOrcadReadinessOutput } from '../ssh/orcad-remote-launch'
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type ManagedServerUpdateDeps
|
||||
} from './managed-server-update-check'
|
||||
import type { ManagedOrcadAutoUpdateOutcome } from './orcad-managed-auto-update'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from './orcad-activation-fence-hold'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
|
||||
// The retry decision is read under the host's lifecycle lock, so the stub's last call answers it.
|
||||
const failedBeforeOf = (autoUpdate: ManagedServerUpdateDeps['autoUpdate']) =>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { SshManagedServerUpdateNote, SshTarget } from '../../shared/ssh-types'
|
||||
import type { ManagedOrcadAutoUpdateOutcome } from './orcad-managed-auto-update'
|
||||
import type { HostServerUpdateReason } from './ssh-host-server-connect-events'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from './orcad-activation-fence-hold'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
|
||||
export type ManagedServerUpdateDeps = {
|
||||
/** Runs the Managed servers update when the host is behind this app; `onUpdating` fires first. */
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/** Proving that the orcad an activation record names is the one actually serving. */
|
||||
import { evaluateOrcadActivation, type OrcadActivationExpectation } from './orcad-activation-gate'
|
||||
import {
|
||||
evaluateOrcadActivation,
|
||||
type OrcadActivationExpectation
|
||||
} from '../managed-server/activation/orcad-activation-gate'
|
||||
import {
|
||||
orcadLivenessProbeCommand,
|
||||
parseOrcadLiveness,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { evaluateOrcadActivation, type OrcadActivationVerdict } from './orcad-activation-gate'
|
||||
import { orcadActivationTransactionRoot } from './orcad-activation-transaction'
|
||||
import {
|
||||
evaluateOrcadActivation,
|
||||
type OrcadActivationVerdict
|
||||
} from '../managed-server/activation/orcad-activation-gate'
|
||||
import { orcadActivationTransactionRoot } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import type { OrcadReadinessParse } from './orcad-remote-launch'
|
||||
import {
|
||||
launchOrcadAndAwaitReadiness,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Recovering an interrupted decommission from its journal entry; see orcad-decommission-transaction. */
|
||||
import { writeOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import type { OrcadActivationRecoveryResult } from './orcad-activation-recovery'
|
||||
import { writeOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import type { OrcadActivationRecoveryResult } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import type { OrcadDecommissionRecoveryPlan } from './orcad-decommission-transaction'
|
||||
import { settleOrcadDecommissionStop } from './orcad-decommission-stop'
|
||||
import {
|
||||
|
||||
@@ -8,18 +8,22 @@ import {
|
||||
coreOrcadActivationRecord,
|
||||
serializeOrcadActivationRecord,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
parseOrcadActivationTransaction,
|
||||
serializeOrcadActivationTransaction
|
||||
} from './orcad-activation-transaction'
|
||||
} from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
createOrcadDecommissionTransaction,
|
||||
withOrcadDecommissionProcessExited,
|
||||
withOrcadDecommissionStopDispatched,
|
||||
type OrcadDecommissionTransaction
|
||||
} from './orcad-decommission-transaction'
|
||||
import { FakeOrcadHost, NEW, OLD } from './orcad-activation-host-test-harness'
|
||||
import {
|
||||
FakeOrcadHost,
|
||||
NEW,
|
||||
OLD
|
||||
} from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import { compareAppVersions } from '../../shared/app-version'
|
||||
import type { OrcadManagedStopRequest } from '../../shared/orcad-stop-request'
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ import {
|
||||
parseOrcadActivationTransaction,
|
||||
planOrcadTransactionRecovery,
|
||||
serializeOrcadActivationTransaction
|
||||
} from './orcad-activation-transaction'
|
||||
} from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
committedOrcadDecommissionRecord,
|
||||
createOrcadDecommissionTransaction,
|
||||
withOrcadDecommissionProcessExited,
|
||||
withOrcadDecommissionStopDispatched
|
||||
} from './orcad-decommission-transaction'
|
||||
import { FakeOrcadHost, NEW } from './orcad-activation-host-test-harness'
|
||||
import { FakeOrcadHost, NEW } from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import type { OrcadManagedStopRequest } from '../../shared/orcad-stop-request'
|
||||
|
||||
const T = new Date('2026-02-02T00:00:00.000Z')
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
withDeactivatedVersion,
|
||||
withDeactivatedVersionCommitted,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
import { ORCAD_ACTIVATION_TRANSACTION_SCHEMA_VERSION } from './orcad-activation-transaction-schema'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { ORCAD_ACTIVATION_TRANSACTION_SCHEMA_VERSION } from '../managed-server/activation/orcad-activation-transaction-schema'
|
||||
import type { OrcadManagedStopRequest } from '../../shared/orcad-stop-request'
|
||||
|
||||
export type OrcadDecommissionTransaction = {
|
||||
|
||||
@@ -29,7 +29,7 @@ const { initOrcadHeldFenceTokenFile, ORCAD_HELD_FENCE_TOKENS_FILE_NAME } =
|
||||
const { tryStealInstallLockCommand } = await import('./remote-install-lock-commands')
|
||||
const { serializedStateMutationCommand } = await import('./orcad-state-snapshot')
|
||||
const { ORCAD_FENCE_LOST_EXIT, ORCAD_FENCE_LOST_MARKER } =
|
||||
await import('./orcad-activation-fence-scope')
|
||||
await import('../managed-server/activation/orcad-activation-fence-scope')
|
||||
const { getRemoteHostPlatform } = await import('./ssh-remote-platform')
|
||||
|
||||
const OWNER = '.orca-fence-owner'
|
||||
|
||||
@@ -30,8 +30,10 @@ vi.mock('./remote-exec-command', async (importOriginal) => {
|
||||
}
|
||||
})
|
||||
|
||||
const { orcadActivationFenceRefusal } = await import('./orcad-activation-fence-hold')
|
||||
const { withOrcadActivationLock } = await import('./orcad-activation-lock')
|
||||
const { orcadActivationFenceRefusal } =
|
||||
await import('../managed-server/activation/orcad-activation-fence-hold')
|
||||
const { withOrcadActivationLock } =
|
||||
await import('../managed-server/activation/orcad-activation-lock')
|
||||
const { initOrcadHeldFenceTokenFile, ORCAD_HELD_FENCE_TOKENS_FILE_NAME } =
|
||||
await import('./orcad-held-fence-tokens')
|
||||
const { getRemoteHostPlatform } = await import('./ssh-remote-platform')
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import {
|
||||
ORCAD_FENCE_OWNER_FILENAME,
|
||||
posixOrcadFenceOwnedTest
|
||||
} from './orcad-activation-fence-scope'
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import {
|
||||
forgetHeldOrcadFence,
|
||||
orcadFenceTokensHeldByExitedProcesses
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
isOrcadFenceLost,
|
||||
posixOrcadFenceGuard,
|
||||
runWithOrcadFence
|
||||
} from './orcad-activation-fence-scope'
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { isUnconfirmedSshCommandTermination, sshCommandExitError } from './remote-exec-command'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
* A held fence without a journal, or a journal this client cannot read, means a transaction
|
||||
* this client cannot see into, so GC keeps everything rather than guess.
|
||||
*/
|
||||
import { orcadInstallDirNames } from './orcad-activation-record'
|
||||
import type { OrcadActivationTransaction } from './orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { orcadActivationFenceExists } from './orcad-activation-lock'
|
||||
import { orcadInstallDirNames } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { orcadActivationFenceExists } from '../managed-server/activation/orcad-activation-lock'
|
||||
import { isUnconfirmedSshCommandTermination } from './remote-exec-command'
|
||||
import type { OrcadRemoteExecTarget } from './orcad-remote-runtime-control'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* state a newer Orca's orcad may already have migrated.
|
||||
*/
|
||||
import { compareAppVersions } from '../../shared/app-version'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
|
||||
export type OrcadHostVersionRefusal = 'host-newer'
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import { execOrcadStateMutation } from './orcad-state-mutation-exec'
|
||||
import { orcadRemoteBaseDir } from './orcad-remote-windows-node'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { RELAY_REMOTE_DIR } from './remote-frame-protocol'
|
||||
import { ORCAD_STATE_SNAPSHOT_DIR } from './orcad-activation-record'
|
||||
import type { OrcadSnapshotVerdict } from './orcad-activation-transaction'
|
||||
import { ORCAD_STATE_SNAPSHOT_DIR } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadSnapshotVerdict } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
clearOrcadStateSnapshotMembersCommand,
|
||||
compareOrcadStateSnapshotCommand,
|
||||
|
||||
@@ -13,11 +13,11 @@ import {
|
||||
withActivatedVersion,
|
||||
type OrcadActivationRecord,
|
||||
type OrcadStateSnapshot
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
readOrcadActivationRecord,
|
||||
writeOrcadActivationRecord
|
||||
} from './orcad-activation-record-store'
|
||||
} from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { launchAndJudgeOrcadSlot } from './orcad-candidate-launch-verdict'
|
||||
import { planOrcadUpdate } from './orcad-update-plan'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
@@ -31,15 +31,15 @@ import {
|
||||
import { joinRemotePath } from './ssh-remote-platform'
|
||||
import { computeLocalOrcadBuildHash } from './orcad-local-build-hash'
|
||||
import { preflightInstalledOrcad } from './orcad-remote-preflight'
|
||||
import type { OrcadActivationLockControl } from './orcad-activation-lock'
|
||||
import type { OrcadActivateTransaction } from './orcad-activation-transaction'
|
||||
import type { OrcadActivationLockControl } from '../managed-server/activation/orcad-activation-lock'
|
||||
import type { OrcadActivateTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
createOrcadActivationTransaction,
|
||||
withOrcadActivationCandidateReady,
|
||||
withOrcadActivationIncumbentStopped,
|
||||
withOrcadActivationSnapshot
|
||||
} from './orcad-activation-transaction-transitions'
|
||||
import { writeOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
} from '../managed-server/activation/orcad-activation-transaction-transitions'
|
||||
import { writeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { execOrcadRemoteOr, withoutAbortSignal } from './orcad-remote-runtime-control'
|
||||
import { execOrcadStateMutationOr } from './orcad-state-mutation-exec'
|
||||
import {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
* leave the host serving nothing until an operator accepts losing that state (P1-A).
|
||||
*/
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { withActivatedVersion } from './orcad-activation-record'
|
||||
import { writeOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import type { OrcadActivateTransaction } from './orcad-activation-transaction'
|
||||
import { writeOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { withOrcadActivationCandidateReady } from './orcad-activation-transaction-transitions'
|
||||
import { withActivatedVersion } from '../managed-server/activation/orcad-activation-record'
|
||||
import { writeOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import type { OrcadActivateTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { writeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { withOrcadActivationCandidateReady } from '../managed-server/activation/orcad-activation-transaction-transitions'
|
||||
import { OrcadActiveReadinessError } from './orcad-active-readiness'
|
||||
import { orcadLivenessProvenExited } from './orcad-remote-launch'
|
||||
import {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { shellEscape } from './ssh-connection-utils'
|
||||
import { RELAY_REMOTE_DIR } from './remote-frame-protocol'
|
||||
import { ORCAD_ACTIVATION_FILENAME } from './orcad-activation-record'
|
||||
import { ORCAD_ACTIVATION_FILENAME } from '../managed-server/activation/orcad-activation-record'
|
||||
import { parseDarwinPlatformUuid } from '../persistence/profile-state/profile-state-access-identity'
|
||||
import {
|
||||
joinRemotePath,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { emptyOrcadActivationRecord, type OrcadActivationRecord } from './orcad-activation-record'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
type OrcadActivationRecord
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { OrcadHostUnsupportedError } from '../orcad/orcad-host-unavailable'
|
||||
|
||||
const mocks = vi.hoisted(() => {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* terminals, and a rejected candidate is restored through the activation journal, so the old
|
||||
* version keeps serving. A host a newer Orca activated is never downgraded.
|
||||
*/
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
refuseOrcadHostDowngrade,
|
||||
type OrcadHostVersionRefusal
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
OrcadHostUnsupportedError
|
||||
} from '../orcad/orcad-host-unavailable'
|
||||
import { findIncompleteManagedOrcadMigration } from './orcad-managed-migration-status'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from './orcad-activation-fence-hold'
|
||||
import { ORCAD_ACTIVATION_FENCE_BUSY_CODE } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
import { resolveLinkedOrcadContext } from './orcad-managed-runtime-context'
|
||||
import { runManagedOrcadUpdate, withManagedOrcadLifecycle } from './orcad-runtime-maintenance'
|
||||
import type { OrcadUpdateDeferCode } from './orcad-update-plan'
|
||||
|
||||
@@ -58,11 +58,11 @@ vi.mock('./orcad-remote-context', () => ({
|
||||
})
|
||||
}))
|
||||
vi.mock('./orcad-ssh-host-transport', () => ({ sshOrcadHostTransport: (c: unknown) => c }))
|
||||
vi.mock('./orcad-activation-lock', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-lock', () => ({
|
||||
withOrcadActivationLock: (_slot: unknown, run: (lock: unknown) => Promise<unknown>) =>
|
||||
run({ retain: mocks.retain })
|
||||
}))
|
||||
vi.mock('./orcad-activation-record-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: async () => ({ active: mocks.active.current })
|
||||
}))
|
||||
vi.mock('./orcad-managed-remote-stop', () => ({
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
*/
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import type { OrcadManagedRestartResult } from '../../shared/orcad-managed-runtime'
|
||||
import { withOrcadActivationLock, type OrcadActivationLockControl } from './orcad-activation-lock'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import {
|
||||
withOrcadActivationLock,
|
||||
type OrcadActivationLockControl
|
||||
} from '../managed-server/activation/orcad-activation-lock'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import {
|
||||
orcadLaunchSshSessionProbeCommand,
|
||||
parseOrcadLaunchSshSession,
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { computeLocalOrcadBuildHash } from './orcad-local-build-hash'
|
||||
import { sshOrcadHostTransport } from './orcad-ssh-host-transport'
|
||||
import type { OrcadHostTarget } from './orcad-host-transport'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { refuseOrcadHostDowngrade } from './orcad-host-version-admission'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
import { probeActiveOrcadReadiness } from './orcad-active-readiness'
|
||||
|
||||
@@ -8,7 +8,9 @@ const { gcMock, readRecordMock } = vi.hoisted(() => ({
|
||||
}))
|
||||
|
||||
vi.mock('./orcad-remote-gc', () => ({ gcOldOrcadVersions: gcMock }))
|
||||
vi.mock('./orcad-activation-record-store', () => ({ readOrcadActivationRecord: readRecordMock }))
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: readRecordMock
|
||||
}))
|
||||
|
||||
import { provenLiveDaemonVersion, pruneManagedOrcadVersions } from './orcad-managed-version-gc'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import type { NodeRuntimeTarget } from '../../shared/node-runtime-pin'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { orcadSlotDir, type OrcadSlotOptions } from './orcad-recovery-slot'
|
||||
import { gcOldOrcadVersions } from './orcad-remote-gc'
|
||||
import { nodeRuntimeStorePins } from './pinned-runtime-host-target'
|
||||
|
||||
@@ -17,7 +17,7 @@ import { acquireInstallLock, RemoteInstallLockBusyError } from './remote-install
|
||||
import { wakeStoppedManagedOrcad } from './orcad-managed-wake'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { FakeOrcadHost, OLD } from './orcad-activation-host-test-harness'
|
||||
import { FakeOrcadHost, OLD } from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import {
|
||||
ORCAD_E2E_IDLE_TIMEOUT_ENV,
|
||||
ORCAD_MANAGED_ACTIVATION_ROOT_ENV
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
* that stopped itself after idling. A stopped server is just "not running": it is neither a
|
||||
* failure nor evidence about terminals, which the daemon owns and which outlive orcad.
|
||||
*/
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from './orcad-activation-fence-scope'
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import {
|
||||
orcadActivationFenceExists,
|
||||
releaseOrcadActivationFence,
|
||||
withOrcadActivationLock
|
||||
} from './orcad-activation-lock'
|
||||
} from '../managed-server/activation/orcad-activation-lock'
|
||||
import { orcadLivenessProvenExited } from './orcad-remote-launch'
|
||||
import { readBoundedOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { orcadActivationFenceLockDir } from './orcad-activation-transaction'
|
||||
import { orcadActivationFenceLockDir } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { joinRemotePath } from './ssh-remote-platform'
|
||||
|
||||
import { readOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { readOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import {
|
||||
ORCAD_RECOVERY_UNVERIFIABLE_CODE,
|
||||
recoverInterruptedOrcadActivation
|
||||
} from './orcad-activation-recovery'
|
||||
} from '../managed-server/activation/orcad-activation-recovery'
|
||||
import {
|
||||
ensureOrcadSlotServing,
|
||||
orcadSlotDir,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* that could not answer is `unverifiable` — never a reason to start a second slot.
|
||||
*/
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { OrcadActivationExpectation } from './orcad-activation-gate'
|
||||
import type { OrcadActivationExpectation } from '../managed-server/activation/orcad-activation-gate'
|
||||
import { ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { computeRemoteInstallDir } from './remote-versioned-install'
|
||||
import { readRemoteOrcadBuildHash } from './orcad-remote-build-hash'
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
type OrcadStopOutcome
|
||||
} from './orcad-remote-process-control'
|
||||
import { execOrcadRemote, type OrcadRemoteExecTarget } from './orcad-remote-runtime-control'
|
||||
import { orcadActivationTransactionRoot } from './orcad-activation-transaction'
|
||||
import { orcadActivationTransactionRoot } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
initialOrcadActivationAdmissionCommand,
|
||||
parseInitialOrcadActivationAdmission
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Everything a managed-orcad operation needs to know about one host (SSH or WSL) before it acts. */
|
||||
import type { NodeRuntimeTarget } from '../../shared/node-runtime-pin'
|
||||
import type { SshTarget } from '../../shared/ssh-types'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { resolveOrcadRuntimeTarget } from './orcad-runtime-target'
|
||||
import { prepareWindowsOrcadHost } from './orcad-windows-host-preparation'
|
||||
import {
|
||||
|
||||
@@ -21,11 +21,15 @@ import { execCommand } from './remote-exec-command'
|
||||
import { acquireInstallLock } from './remote-install-lock'
|
||||
import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { decommissionRemoteOrcad } from './orcad-remote-decommission'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { parseOrcadActivationRecord } from './orcad-activation-record'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { parseOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
import { FakeOrcadHost, OLD, type CrashMode } from './orcad-activation-host-test-harness'
|
||||
import {
|
||||
FakeOrcadHost,
|
||||
OLD,
|
||||
type CrashMode
|
||||
} from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
|
||||
let host = new FakeOrcadHost()
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
* fence. Windows runs the same steps: the request is a staged file and exit proof is orcad's own.
|
||||
*/
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
readOrcadActivationRecord,
|
||||
writeOrcadActivationRecord
|
||||
} from './orcad-activation-record-store'
|
||||
import { sameOrcadActivationRecord } from './orcad-activation-transaction'
|
||||
import { writeOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { withOrcadActivationLock } from './orcad-activation-lock'
|
||||
import { orcadActivationFenceRefusal } from './orcad-activation-fence-hold'
|
||||
} from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { sameOrcadActivationRecord } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { writeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { withOrcadActivationLock } from '../managed-server/activation/orcad-activation-lock'
|
||||
import { orcadActivationFenceRefusal } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
import {
|
||||
committedOrcadDecommissionRecord,
|
||||
createOrcadDecommissionTransaction,
|
||||
|
||||
@@ -49,14 +49,14 @@ import {
|
||||
withActivatedVersion,
|
||||
withDeactivatedVersionCommitted,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { ORCAD_ACTIVATION_POLICY_REFUSED_CODE } from './orcad-installed-activation'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { isReadinessRead } from './orcad-activation-host-test-harness'
|
||||
import { isReadinessRead } from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import { isSnapshotCaptureCommand } from './orcad-snapshot-capture-command'
|
||||
import { NODE_RUNTIME_PIN } from '../../shared/node-runtime-pin'
|
||||
import { serializeOrcadActivationTransaction } from './orcad-activation-transaction'
|
||||
import { createOrcadActivationTransaction } from './orcad-activation-transaction-transitions'
|
||||
import { serializeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { createOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-transitions'
|
||||
|
||||
const mockExec = vi.mocked(execCommand)
|
||||
const NEW_VERSION = '0.2.0+bb0100000000'
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* Every activation runs under the host's activation fence and journal
|
||||
* (`orcad-activation-lock.ts`), so an interrupted one is recoverable to exactly one slot.
|
||||
*/
|
||||
import { logOrcadActivationOutcome } from './orcad-activation-outcome-log'
|
||||
import { logOrcadActivationOutcome } from '../managed-server/activation/orcad-activation-outcome-log'
|
||||
import { join } from 'node:path'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { computeRemoteInstallDir, readLocalFullVersion } from './remote-versioned-install'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationVerdict } from './orcad-activation-gate'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadActivationVerdict } from '../managed-server/activation/orcad-activation-gate'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
import type { RemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { installOrcadBundle } from './orcad-remote-install'
|
||||
@@ -28,9 +28,9 @@ import {
|
||||
orcadActivationFenceExists,
|
||||
resolveOrcadActivationReadinessTimeout,
|
||||
withOrcadActivationLock
|
||||
} from './orcad-activation-lock'
|
||||
} from '../managed-server/activation/orcad-activation-lock'
|
||||
import { activateInstalledOrcad } from './orcad-installed-activation'
|
||||
import { orcadActivationFenceRefusal } from './orcad-activation-fence-hold'
|
||||
import { orcadActivationFenceRefusal } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
|
||||
export type OrcadDeployOptions = {
|
||||
conn: OrcadHostTransport
|
||||
|
||||
@@ -23,9 +23,9 @@ vi.mock('./remote-install-lock', () => ({
|
||||
|
||||
import { execCommand } from './remote-exec-command'
|
||||
import { gcOldOrcadVersions } from './orcad-remote-gc'
|
||||
import { emptyOrcadActivationRecord } from './orcad-activation-record'
|
||||
import { serializeOrcadActivationTransaction } from './orcad-activation-transaction'
|
||||
import { createOrcadActivationTransaction } from './orcad-activation-transaction-transitions'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { serializeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { createOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-transitions'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { execCommand, isUnconfirmedSshCommandTermination } from './remote-exec-command'
|
||||
import { ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { gcOldRemoteInstallVersions } from './remote-install-gc'
|
||||
import { orcadGcPinnedDirNames, type OrcadActivationRecord } from './orcad-activation-record'
|
||||
import {
|
||||
orcadGcPinnedDirNames,
|
||||
type OrcadActivationRecord
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
ORCAD_NEVER_LAUNCHED,
|
||||
orcadLivenessAnswerBlocksGc,
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { joinRemotePath, type RemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { acquireInstallLock } from './remote-install-lock'
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from './orcad-activation-fence-scope'
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { forgetHeldOrcadFence, rememberHeldOrcadFence } from './orcad-held-fence-tokens'
|
||||
import { exitedOwnLockProof } from './orcad-exited-own-lock'
|
||||
import { orcadWindowsBaseDir } from './orcad-remote-windows-node'
|
||||
|
||||
@@ -53,7 +53,7 @@ vi.mock('./remote-versioned-install', async (importOriginal) => ({
|
||||
import { execCommand } from './remote-exec-command'
|
||||
import { deployOrcad, type OrcadDeployOptions } from './orcad-remote-deploy'
|
||||
import { rollbackOrcad } from './orcad-remote-rollback'
|
||||
import { emptyOrcadActivationRecord } from './orcad-activation-record'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { NODE_RUNTIME_PIN } from '../../shared/node-runtime-pin'
|
||||
|
||||
@@ -24,8 +24,8 @@ import {
|
||||
import {
|
||||
readOrcadActivationRecord,
|
||||
writeOrcadActivationRecord
|
||||
} from './orcad-activation-record-store'
|
||||
import { emptyOrcadActivationRecord } from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { readRemoteOrcadBuildHash } from './orcad-remote-build-hash'
|
||||
import {
|
||||
launchOrcadSlotAndAwaitReadiness,
|
||||
|
||||
@@ -55,9 +55,12 @@ vi.mock('./orcad-rollback-terminal-barrier', async (importOriginal) => ({
|
||||
import { execCommand } from './remote-exec-command'
|
||||
import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { rollbackOrcad, type OrcadRollbackOptions } from './orcad-remote-rollback'
|
||||
import { emptyOrcadActivationRecord, type OrcadActivationRecord } from './orcad-activation-record'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
type OrcadActivationRecord
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import { isReadinessRead } from './orcad-activation-host-test-harness'
|
||||
import { isReadinessRead } from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import { isSnapshotCaptureCommand } from './orcad-snapshot-capture-command'
|
||||
|
||||
const mockExec = vi.mocked(execCommand)
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
* before restoring would let the old build migrate the new build's state. The rescue copy of
|
||||
* the newer state, and the journal under the activation fence, make each step undoable.
|
||||
*/
|
||||
import { logOrcadActivationOutcome } from './orcad-activation-outcome-log'
|
||||
import { logOrcadActivationOutcome } from '../managed-server/activation/orcad-activation-outcome-log'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
import type { OrcadActivationVerdict } from './orcad-activation-gate'
|
||||
import type { OrcadActivationVerdict } from '../managed-server/activation/orcad-activation-gate'
|
||||
import type { OrcadDaemonProtocolFacts } from './orcad-daemon-protocol-crossing'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { sameOrcadActivationRecord } from './orcad-activation-transaction'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { sameOrcadActivationRecord } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import type { RemoteHostPlatform } from './ssh-remote-platform'
|
||||
import {
|
||||
resolveOrcadActivationReadinessTimeout,
|
||||
withOrcadActivationLock
|
||||
} from './orcad-activation-lock'
|
||||
import { orcadActivationFenceRefusal } from './orcad-activation-fence-hold'
|
||||
} from '../managed-server/activation/orcad-activation-lock'
|
||||
import { orcadActivationFenceRefusal } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
import { ORCAD_STARTUP_READINESS_TIMEOUT_MS } from '../../shared/orcad-profile-preflight'
|
||||
import { rollbackOrcadLocked } from './orcad-rollback-transition'
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
isOrcadFenceLost,
|
||||
OrcadFenceLostError,
|
||||
posixOrcadFenceGuard
|
||||
} from './orcad-activation-fence-scope'
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { orcadWindowsHomeOpCommand } from './orcad-remote-windows-node'
|
||||
import { ORCAD_WINDOWS_FENCE_ARG } from './orcad-windows-host-fence-ops'
|
||||
import { isWindowsRemoteHost, type RemoteHostPlatform } from './ssh-remote-platform'
|
||||
|
||||
@@ -30,7 +30,10 @@ import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { gcOldRemoteInstallVersions } from './remote-install-gc'
|
||||
import { decommissionRemoteOrcad } from './orcad-remote-decommission'
|
||||
import { gcOldOrcadVersions } from './orcad-remote-gc'
|
||||
import { emptyOrcadActivationRecord, withActivatedVersion } from './orcad-activation-record'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
withActivatedVersion
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
|
||||
const mockExec = vi.mocked(execCommand)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* `powershell.exe -Command`, which both shells pass through intact. Anything else is refused
|
||||
* rather than encoded (docs/reference/windows-edr-posture.md).
|
||||
*/
|
||||
import { currentOrcadFence } from './orcad-activation-fence-scope'
|
||||
import { currentOrcadFence } from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { ORCAD_WINDOWS_FENCE_ARG } from './orcad-windows-host-fence-ops'
|
||||
import {
|
||||
ORCAD_NODE_RUNTIME_DIR_PREFIX,
|
||||
|
||||
@@ -3,8 +3,8 @@ import { orcadRemoteBaseDir } from './orcad-remote-windows-node'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import type { OrcadRollbackOptions, OrcadRollbackResult } from './orcad-remote-rollback'
|
||||
import { isUnconfirmedSshCommandTermination } from './remote-exec-command'
|
||||
import { withRolledBackVersion } from './orcad-activation-record'
|
||||
import { writeOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { withRolledBackVersion } from '../managed-server/activation/orcad-activation-record'
|
||||
import { writeOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { launchAndJudgeOrcadSlot } from './orcad-candidate-launch-verdict'
|
||||
import { assessOrcadRollback } from './orcad-update-plan'
|
||||
import { ORCAD_LOG_FILENAME } from './orcad-remote-host-support'
|
||||
@@ -20,17 +20,17 @@ import {
|
||||
restoreOrcadStateSnapshotCommand
|
||||
} from './orcad-state-snapshot'
|
||||
import { joinRemotePath } from './ssh-remote-platform'
|
||||
import type { OrcadActivationLockControl } from './orcad-activation-lock'
|
||||
import type { OrcadActivationLockControl } from '../managed-server/activation/orcad-activation-lock'
|
||||
import {
|
||||
rollbackStartingState,
|
||||
type OrcadRollbackTransaction
|
||||
} from './orcad-activation-transaction'
|
||||
} from '../managed-server/activation/orcad-activation-transaction'
|
||||
import {
|
||||
createOrcadRollbackTransaction,
|
||||
withOrcadRollbackPhase,
|
||||
withOrcadRollbackRescue
|
||||
} from './orcad-activation-transaction-transitions'
|
||||
import { writeOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
} from '../managed-server/activation/orcad-activation-transaction-transitions'
|
||||
import { writeOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { execOrcadRemoteOr, withoutAbortSignal } from './orcad-remote-runtime-control'
|
||||
import { execOrcadStateMutationOr } from './orcad-state-mutation-exec'
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadSlotOptions } from './orcad-recovery-slot'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
|
||||
@@ -11,12 +11,14 @@ const mocks = vi.hoisted(() => ({
|
||||
fenceRefusal: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./orcad-activation-fence-hold', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-fence-hold', () => ({
|
||||
orcadActivationFenceRefusal: mocks.fenceRefusal
|
||||
}))
|
||||
|
||||
vi.mock('./orcad-managed-wake', () => ({ wakeStoppedManagedOrcad: mocks.wake }))
|
||||
vi.mock('./orcad-activation-record-store', () => ({ readOrcadActivationRecord: mocks.readRecord }))
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: mocks.readRecord
|
||||
}))
|
||||
vi.mock('./orcad-remote-build-hash', () => ({ readRemoteOrcadBuildHash: async () => 'hash' }))
|
||||
vi.mock('./orcad-active-readiness', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { OrcadManagedDeferral } from '../../shared/orcad-managed-runtime'
|
||||
import { orcadActivationFenceRefusal } from './orcad-activation-fence-hold'
|
||||
import { orcadActivationFenceRefusal } from '../managed-server/activation/orcad-activation-fence-hold'
|
||||
import { OrcadActiveReadinessError, probeActiveOrcadReadiness } from './orcad-active-readiness'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { wakeStoppedManagedOrcad } from './orcad-managed-wake'
|
||||
import { resolveOrcadSlotIdentity, type OrcadSlotOptions } from './orcad-recovery-slot'
|
||||
|
||||
|
||||
@@ -36,11 +36,13 @@ vi.mock('./ssh-target-registry', () => ({
|
||||
vi.mock('./orcad-remote-context', () => ({ resolveOrcadRemoteContext: mocks.resolveContext }))
|
||||
vi.mock('./orcad-terminal-census-client', () => ({ collectManagedTerminalCensus: mocks.census }))
|
||||
vi.mock('./orcad-remote-decommission', () => ({ decommissionRemoteOrcad: mocks.decommission }))
|
||||
vi.mock('./orcad-activation-recovery', () => ({ recoverInterruptedOrcadActivation: mocks.recover }))
|
||||
vi.mock('./orcad-activation-transaction-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-recovery', () => ({
|
||||
recoverInterruptedOrcadActivation: mocks.recover
|
||||
}))
|
||||
vi.mock('../managed-server/activation/orcad-activation-transaction-store', () => ({
|
||||
readOrcadActivationTransaction: async () => mocks.state.transaction
|
||||
}))
|
||||
vi.mock('./orcad-activation-lock', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-lock', () => ({
|
||||
withStaleOrcadActivationRecoveryLock: async (
|
||||
_options: unknown,
|
||||
run: (lock: { retain: () => void }) => Promise<unknown>
|
||||
|
||||
@@ -13,9 +13,9 @@ import type {
|
||||
KnownRuntimeEnvironment,
|
||||
OrcadSshDeploymentLink
|
||||
} from '../../shared/runtime-environments'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { withStaleOrcadActivationRecoveryLock } from './orcad-activation-lock'
|
||||
import { readOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { withStaleOrcadActivationRecoveryLock } from '../managed-server/activation/orcad-activation-lock'
|
||||
import { readOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { reconcileOrcadDecommission } from './orcad-decommission-recovery'
|
||||
import { cancelRemoteOrcadManagedStop } from './orcad-managed-remote-stop'
|
||||
import {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
withDeactivatedVersion,
|
||||
withDeactivatedVersionCommitted,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { ORCAD_ACTIVATION_POLICY_REFUSED_CODE } from './orcad-installed-activation'
|
||||
import type { OrcadDeployOptions } from './orcad-remote-deploy'
|
||||
|
||||
@@ -46,9 +46,13 @@ vi.mock('./ssh-target-registry', () => ({
|
||||
getSshTargetRegistryStore: () => mocks.state.store
|
||||
}))
|
||||
vi.mock('./orcad-remote-context', () => ({ resolveOrcadRemoteContext: mocks.resolveContext }))
|
||||
vi.mock('./orcad-activation-recovery', () => ({ recoverInterruptedOrcadActivation: mocks.recover }))
|
||||
vi.mock('./orcad-activation-record-store', () => ({ readOrcadActivationRecord: mocks.readRecord }))
|
||||
vi.mock('./orcad-activation-transaction-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-recovery', () => ({
|
||||
recoverInterruptedOrcadActivation: mocks.recover
|
||||
}))
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: mocks.readRecord
|
||||
}))
|
||||
vi.mock('../managed-server/activation/orcad-activation-transaction-store', () => ({
|
||||
readOrcadActivationTransaction: mocks.readTransaction
|
||||
}))
|
||||
vi.mock('./orcad-remote-deploy', () => ({ deployOrcad: mocks.deploy }))
|
||||
@@ -56,7 +60,7 @@ vi.mock('../orcad/orcad-artifact-materializer', () => ({
|
||||
materializeOrcadArtifact: async () => '/local/orcad'
|
||||
}))
|
||||
vi.mock('./orcad-managed-wake', () => ({ wakeStoppedManagedOrcad: mocks.wake }))
|
||||
vi.mock('./orcad-activation-fence-hold', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-fence-hold', () => ({
|
||||
orcadActivationFenceRefusal: mocks.fenceRefusal
|
||||
}))
|
||||
vi.mock('./orcad-remote-build-hash', () => ({
|
||||
|
||||
@@ -22,9 +22,9 @@ import {
|
||||
ensureOrcadManagedTunnel,
|
||||
startOrcadManagedTunnel
|
||||
} from './orcad-managed-tunnel'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { wakeAlreadyActiveOrcad } from './orcad-already-active-wake'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { resolveOrcadRemoteContext, type OrcadRemoteContext } from './orcad-remote-context'
|
||||
import { deployOrcad } from './orcad-remote-deploy'
|
||||
import {
|
||||
|
||||
@@ -37,7 +37,9 @@ vi.mock('./orcad-remote-context', () => ({ resolveOrcadRemoteContext: mocks.reso
|
||||
vi.mock('./orcad-terminal-census-client', () => ({ collectManagedTerminalCensus: mocks.census }))
|
||||
vi.mock('./orcad-remote-deploy', () => ({ deployOrcad: mocks.deploy }))
|
||||
vi.mock('./orcad-remote-rollback', () => ({ rollbackOrcad: mocks.rollback }))
|
||||
vi.mock('./orcad-activation-recovery', () => ({ recoverInterruptedOrcadActivation: mocks.recover }))
|
||||
vi.mock('../managed-server/activation/orcad-activation-recovery', () => ({
|
||||
recoverInterruptedOrcadActivation: mocks.recover
|
||||
}))
|
||||
vi.mock('./orcad-active-readiness', () => ({ probeActiveOrcadReadiness: mocks.probe }))
|
||||
vi.mock('./orcad-remote-build-hash', () => ({ readRemoteOrcadBuildHash: mocks.buildHash }))
|
||||
vi.mock('../orcad/orcad-artifact-materializer', () => ({
|
||||
@@ -52,7 +54,7 @@ vi.mock('./orcad-managed-wake', () => ({ wakeStoppedManagedOrcad: mocks.wake }))
|
||||
vi.mock('./orcad-managed-migration-status', () => ({
|
||||
findIncompleteManagedOrcadMigration: mocks.pendingMigration
|
||||
}))
|
||||
vi.mock('./orcad-activation-transaction-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-transaction-store', () => ({
|
||||
readOrcadActivationTransaction: async () => null
|
||||
}))
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
} from '../../shared/orcad-managed-runtime'
|
||||
import { runTargetLifecycle } from '../ipc/ssh-target-lifecycle-queue'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { probeActiveOrcadReadiness } from './orcad-active-readiness'
|
||||
import { materializeOrcadArtifact } from '../orcad/orcad-artifact-materializer'
|
||||
import { CURRENT_ORCAD_DAEMON_PROTOCOL } from './orcad-daemon-protocol-crossing'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { OrcadManagedRuntimeStatus } from '../../shared/orcad-managed-runtime'
|
||||
import { runTargetLifecycle } from '../ipc/ssh-target-lifecycle-queue'
|
||||
import type { OrcadActivationTransaction } from './orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from './orcad-activation-transaction-store'
|
||||
import type { OrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import {
|
||||
requireManagedOrcadEnvironment,
|
||||
resolveLinkedOrcadContext
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
} from './orcad-state-snapshot-members'
|
||||
import type { OrcadRemoteExecTarget } from './orcad-remote-runtime-control'
|
||||
import { execCommand, isUnconfirmedSshCommandTermination } from './remote-exec-command'
|
||||
import { isOrcadFenceLost, OrcadFenceLostError } from './orcad-activation-fence-scope'
|
||||
import {
|
||||
isOrcadFenceLost,
|
||||
OrcadFenceLostError
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
|
||||
// Longer than the host's own deadline, so the host kills the work before the client gives up.
|
||||
export const ORCAD_STATE_MUTATION_CLIENT_TIMEOUT_MS =
|
||||
|
||||
@@ -16,9 +16,9 @@ import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { runProcess, spawnProcess } from '@orca/process-host'
|
||||
import { RELAY_INSTALL_LOCK_NAME } from '../../shared/relay-install-lock-name'
|
||||
import { ORCAD_ACTIVATION_TRANSACTION_DIRNAME } from './orcad-activation-transaction'
|
||||
import { ORCAD_ACTIVATION_TRANSACTION_DIRNAME } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { serializedStateMutationCommand } from './orcad-state-snapshot'
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from './orcad-activation-fence-scope'
|
||||
import { ORCAD_FENCE_OWNER_FILENAME } from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { tryStealInstallLockCommand } from './remote-install-lock-commands'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
|
||||
|
||||
@@ -42,10 +42,15 @@ import { acquireInstallLock } from './remote-install-lock'
|
||||
import { writeAtomicOrcadRemoteRecord } from './orcad-remote-record-file'
|
||||
import { deployOrcad } from './orcad-remote-deploy'
|
||||
import { rollbackOrcad } from './orcad-remote-rollback'
|
||||
import { recoverInterruptedOrcadActivation } from './orcad-activation-recovery'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadHostTransport } from './orcad-host-transport'
|
||||
import { BUILD_HASH, FakeOrcadHost, NEW, OLD } from './orcad-activation-host-test-harness'
|
||||
import {
|
||||
BUILD_HASH,
|
||||
FakeOrcadHost,
|
||||
NEW,
|
||||
OLD
|
||||
} from '../managed-server/activation/orcad-activation-host-test-harness'
|
||||
import { isSnapshotCaptureCommand } from './orcad-snapshot-capture-command'
|
||||
|
||||
let host = new FakeOrcadHost()
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
posixOrcadFenceGuard,
|
||||
posixOrcadFenceOwnedTest,
|
||||
type OrcadFence
|
||||
} from './orcad-activation-fence-scope'
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { shellEscape } from './ssh-connection-utils'
|
||||
import { isWindowsRemoteHost, joinRemotePath, type RemoteHostPlatform } from './ssh-remote-platform'
|
||||
import type { OrcadWindowsHostStateOp } from './orcad-windows-host-state-ops'
|
||||
|
||||
@@ -4,7 +4,10 @@ import {
|
||||
createEnvironmentFromPairingOffer,
|
||||
type KnownRuntimeEnvironment
|
||||
} from '../../shared/runtime-environments'
|
||||
import { emptyOrcadActivationRecord, type OrcadActivationRecord } from './orcad-activation-record'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
type OrcadActivationRecord
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
|
||||
const mocks = vi.hoisted(() => ({ send: vi.fn(), ensure: vi.fn(), verify: vi.fn() }))
|
||||
vi.mock('../../shared/remote-runtime-client', () => ({
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
type OrcadTerminalCensus
|
||||
} from '../../shared/orcad-terminal-census'
|
||||
import { sendRemoteRuntimeRequestWithStatusPreflight } from '../../shared/remote-runtime-client'
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { ensureOrcadManagedTunnel } from './orcad-managed-tunnel'
|
||||
import { verifyOrcadManagedServing } from './orcad-managed-serving-verify'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** The incumbent slot across a journaled activation or rollback: stop it, then put it back. */
|
||||
import type { OrcadActivationLockControl } from './orcad-activation-lock'
|
||||
import type { OrcadSnapshotVerdict } from './orcad-activation-transaction'
|
||||
import type { OrcadActivationLockControl } from '../managed-server/activation/orcad-activation-lock'
|
||||
import type { OrcadSnapshotVerdict } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { orcadStopFreedTheHost } from './orcad-remote-process-control'
|
||||
import { withoutAbortSignal } from './orcad-remote-runtime-control'
|
||||
import {
|
||||
|
||||
@@ -11,12 +11,12 @@ import { findOrcadMigrationSourceCutoverForTarget } from './orcad-migration-cuto
|
||||
import { releaseUndeployedMigrationFence } from './orcad-migration-source-fence'
|
||||
import { closeOrcadManagedTunnel } from './orcad-managed-tunnel'
|
||||
import type { SshTargetOrcadClaims } from './ssh-target-orcad-claims'
|
||||
import { withOrcadActivationLock } from './orcad-activation-lock'
|
||||
import { withDeactivatedVersionCommitted } from './orcad-activation-record'
|
||||
import { withOrcadActivationLock } from '../managed-server/activation/orcad-activation-lock'
|
||||
import { withDeactivatedVersionCommitted } from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
readOrcadActivationRecord,
|
||||
writeOrcadActivationRecord
|
||||
} from './orcad-activation-record-store'
|
||||
} from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { managedOrcadSlot } from './orcad-managed-runtime-context'
|
||||
import { resolveOrcadRemoteContext } from './orcad-remote-context'
|
||||
import { orcadStopFreedTheHost } from './orcad-remote-process-control'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { emptyOrcadActivationRecord } from './orcad-activation-record'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
|
||||
const mocks = vi.hoisted(() => {
|
||||
const record: { active: string | null } = { active: '1.0.0+a' }
|
||||
@@ -32,10 +32,10 @@ vi.mock('./orcad-remote-context', () => ({
|
||||
userDataDir: '/home/u/.orca'
|
||||
})
|
||||
}))
|
||||
vi.mock('./orcad-activation-lock', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-lock', () => ({
|
||||
withOrcadActivationLock: async (_options: unknown, run: () => Promise<unknown>) => run()
|
||||
}))
|
||||
vi.mock('./orcad-activation-record-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: async () => ({
|
||||
...emptyOrcadActivationRecord(),
|
||||
active: mocks.record.active
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
emptyOrcadActivationRecord,
|
||||
type OrcadActivationRecord,
|
||||
type OrcadStateSnapshot
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
|
||||
const PROTOCOL = { protocolVersion: 3, previousProtocolVersions: [1, 2] }
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* has no answer that can be computed. That is why rollback is defined against a
|
||||
* pre-activation snapshot rather than against a version comparison.
|
||||
*/
|
||||
import type { OrcadActivationRecord } from './orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadTerminalCensus } from '../../shared/orcad-terminal-census'
|
||||
import {
|
||||
assessOrcadLiveDaemonCrossing,
|
||||
|
||||
@@ -12,7 +12,10 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { runProcess, spawnProcess } from '@orca/process-host'
|
||||
import { ORCAD_FENCE_LOST_EXIT, ORCAD_FENCE_LOST_MARKER } from './orcad-activation-fence-scope'
|
||||
import {
|
||||
ORCAD_FENCE_LOST_EXIT,
|
||||
ORCAD_FENCE_LOST_MARKER
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { ORCAD_WINDOWS_HOST_SCRIPT } from './orcad-windows-host-script'
|
||||
|
||||
const dirs: string[] = []
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
ORCAD_FENCE_LOST_EXIT,
|
||||
ORCAD_FENCE_LOST_MARKER,
|
||||
ORCAD_FENCE_OWNER_FILENAME
|
||||
} from './orcad-activation-fence-scope'
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import { ORCAD_EXITED_OWN_LOCK_QUIET_SECONDS } from './orcad-state-snapshot-members'
|
||||
|
||||
export const ORCAD_WINDOWS_FENCE_ARG = '--fence'
|
||||
|
||||
@@ -23,7 +23,7 @@ import { deployOrcad } from './orcad-remote-deploy'
|
||||
import { orcadLivenessProbeCommand, parseOrcadLiveness } from './orcad-remote-launch'
|
||||
import { orcadSlotDir, type OrcadSlotOptions } from './orcad-recovery-slot'
|
||||
import { decommissionRemoteOrcad } from './orcad-remote-decommission'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { gcOldOrcadVersions } from './orcad-remote-gc'
|
||||
import { execOrcadRemote } from './orcad-remote-runtime-control'
|
||||
import { orcadWindowsNodeCommandLine } from './orcad-remote-windows-node'
|
||||
|
||||
@@ -12,7 +12,10 @@ import { PRIMARY_RUNTIME_METADATA_FILE } from '../../shared/runtime-bootstrap'
|
||||
import { ORCAD_LOCK_FILE_NAME } from '../orcad/orcad-instance-lock'
|
||||
import { ORCAD_WINDOWS_PROCESS_TREE_FILENAME } from '../../shared/orcad-artifacts'
|
||||
import { ORCAD_INSTALL_MODEL } from './remote-install-model'
|
||||
import { ORCAD_FENCE_LOST_EXIT, ORCAD_FENCE_LOST_MARKER } from './orcad-activation-fence-scope'
|
||||
import {
|
||||
ORCAD_FENCE_LOST_EXIT,
|
||||
ORCAD_FENCE_LOST_MARKER
|
||||
} from '../managed-server/activation/orcad-activation-fence-scope'
|
||||
import {
|
||||
ORCAD_SNAPSHOT_MEMBERS,
|
||||
ORCAD_STATE_MUTATION_BUSY,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
withDeactivatedVersion,
|
||||
withDeactivatedVersionCommitted,
|
||||
type OrcadActivationRecord
|
||||
} from './orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import { planManagedOrcadAutoUpdate } from './orcad-managed-auto-update'
|
||||
import { compareAppVersions } from '../../shared/app-version'
|
||||
import {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { NODE_RUNTIME_ASSETS, pinnedNodeRuntimeAsset } from '../../shared/node-r
|
||||
import { ORCAD_MANAGED_REMOTE_PORT } from '../../shared/orcad-managed-runtime'
|
||||
import { ORCAD_RUNTIMES_DIRNAME } from '../../shared/orcad-artifacts'
|
||||
import type { SshTarget } from '../../shared/ssh-types'
|
||||
import { readOrcadActivationRecord } from './orcad-activation-record-store'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { classifyOrcadHostUnavailable } from '../orcad/orcad-host-unavailable'
|
||||
import { managedOrcadSlot } from './orcad-managed-runtime-context'
|
||||
import { orcadSlotDir, type OrcadSlotOptions } from './orcad-recovery-slot'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { OrcadHostTransport } from '../ssh/orcad-host-transport'
|
||||
import type * as ManagedRuntimeContext from '../ssh/orcad-managed-runtime-context'
|
||||
import type * as RemoteVersionedInstall from '../ssh/remote-versioned-install'
|
||||
import { emptyOrcadActivationRecord } from '../ssh/orcad-activation-record'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import { getRemoteHostPlatform } from '../ssh/ssh-remote-platform'
|
||||
import type { WslDistroHolder } from './wsl-distro-holder'
|
||||
import type { WslOrcadHostTarget } from './wsl-orcad-host-target'
|
||||
@@ -21,7 +21,7 @@ const mocks = vi.hoisted(() => ({
|
||||
localVersion: vi.fn(),
|
||||
readRecord: vi.fn()
|
||||
}))
|
||||
vi.mock('../ssh/orcad-activation-record-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: mocks.readRecord
|
||||
}))
|
||||
vi.mock('../ssh/remote-versioned-install', async (importOriginal) => ({
|
||||
@@ -35,7 +35,7 @@ vi.mock('../../shared/app-environment', () => ({
|
||||
}))
|
||||
vi.mock('../ssh/remote-exec-command', () => ({ execCommand: mocks.exec }))
|
||||
vi.mock('../ssh/orcad-remote-context', () => ({ resolveOrcadRemoteContext: mocks.resolveContext }))
|
||||
vi.mock('../ssh/orcad-activation-recovery', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-recovery', () => ({
|
||||
recoverInterruptedOrcadActivation: mocks.recover
|
||||
}))
|
||||
vi.mock('../orcad/orcad-artifact-materializer', () => ({
|
||||
|
||||
@@ -7,8 +7,8 @@ import { getAppEnvironment } from '../../shared/app-environment'
|
||||
import { ORCAD_MANAGED_REMOTE_PORT } from '../../shared/orcad-managed-runtime'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
import type { WslHostDeferredUpdate } from '../../shared/wsl-host-types'
|
||||
import { recoverInterruptedOrcadActivation } from '../ssh/orcad-activation-recovery'
|
||||
import { readOrcadActivationRecord } from '../ssh/orcad-activation-record-store'
|
||||
import { recoverInterruptedOrcadActivation } from '../managed-server/activation/orcad-activation-recovery'
|
||||
import { readOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { materializeOrcadArtifact } from '../orcad/orcad-artifact-materializer'
|
||||
import { OrcadHostUnsupportedError } from '../orcad/orcad-host-unavailable'
|
||||
import type { OrcadHostTransport } from '../ssh/orcad-host-transport'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { encodePairingOffer } from '../../shared/pairing'
|
||||
import { emptyOrcadActivationRecord } from '../ssh/orcad-activation-record'
|
||||
import { emptyOrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadHostTransport } from '../ssh/orcad-host-transport'
|
||||
import type { OrcadRemoteContext } from '../ssh/orcad-remote-context'
|
||||
import type { ServeReadiness } from '../server/serve-readiness'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
emptyOrcadActivationRecord,
|
||||
type OrcadActivationRecord
|
||||
} from '../ssh/orcad-activation-record'
|
||||
} from '../managed-server/activation/orcad-activation-record'
|
||||
import type { OrcadSlotOptions } from '../ssh/orcad-recovery-slot'
|
||||
import { getRemoteHostPlatform } from '../ssh/ssh-remote-platform'
|
||||
|
||||
@@ -70,7 +70,7 @@ vi.mock('../ssh/orcad-recovery-slot', () => ({
|
||||
buildHash: host.slotBuildHash
|
||||
})
|
||||
}))
|
||||
vi.mock('../ssh/orcad-activation-gate', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-gate', () => ({
|
||||
evaluateOrcadActivation: (
|
||||
readiness: { health?: { buildHash?: string } } | null,
|
||||
expected: { buildHash: string }
|
||||
@@ -79,16 +79,16 @@ vi.mock('../ssh/orcad-activation-gate', () => ({
|
||||
? { decision: 'accept' }
|
||||
: { decision: 'reject', reason: 'its build does not match the installed slot.' }
|
||||
}))
|
||||
vi.mock('../ssh/orcad-activation-record-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-record-store', () => ({
|
||||
readOrcadActivationRecord: async () => host.record,
|
||||
writeOrcadActivationRecord: async (_slot: unknown, record: unknown) => {
|
||||
host.writes.push(record)
|
||||
}
|
||||
}))
|
||||
vi.mock('../ssh/orcad-activation-transaction-store', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-transaction-store', () => ({
|
||||
readOrcadActivationTransaction: async () => host.transaction
|
||||
}))
|
||||
vi.mock('../ssh/orcad-activation-lock', () => ({
|
||||
vi.mock('../managed-server/activation/orcad-activation-lock', () => ({
|
||||
withOrcadActivationLock: async (
|
||||
_slot: unknown,
|
||||
run: () => Promise<unknown>,
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
* the activation fence. A different version is then handled by the usual update gate.
|
||||
*/
|
||||
import { ORCAD_LOCK_FILE_NAME, parseOrcadInstanceLockRecord } from '../orcad/orcad-instance-lock'
|
||||
import type { OrcadActivationRecord } from '../ssh/orcad-activation-record'
|
||||
import type { OrcadActivationRecord } from '../managed-server/activation/orcad-activation-record'
|
||||
import {
|
||||
readOrcadActivationRecord,
|
||||
writeOrcadActivationRecord
|
||||
} from '../ssh/orcad-activation-record-store'
|
||||
import { evaluateOrcadActivation } from '../ssh/orcad-activation-gate'
|
||||
import { withOrcadActivationLock } from '../ssh/orcad-activation-lock'
|
||||
import { sameOrcadActivationRecord } from '../ssh/orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from '../ssh/orcad-activation-transaction-store'
|
||||
} from '../managed-server/activation/orcad-activation-record-store'
|
||||
import { evaluateOrcadActivation } from '../managed-server/activation/orcad-activation-gate'
|
||||
import { withOrcadActivationLock } from '../managed-server/activation/orcad-activation-lock'
|
||||
import { sameOrcadActivationRecord } from '../managed-server/activation/orcad-activation-transaction'
|
||||
import { readOrcadActivationTransaction } from '../managed-server/activation/orcad-activation-transaction-store'
|
||||
import { readRemoteOrcadManagedStopTarget } from '../ssh/orcad-managed-remote-stop'
|
||||
import {
|
||||
orcadSlotDir,
|
||||
|
||||
Reference in New Issue
Block a user