diff --git a/config/scripts/build-orcad-prebuilds.mjs b/config/scripts/build-orcad-prebuilds.mjs index efbafbe9a1b..679625b9f6d 100644 --- a/config/scripts/build-orcad-prebuilds.mjs +++ b/config/scripts/build-orcad-prebuilds.mjs @@ -132,16 +132,12 @@ function compileNodePty(dir) { return built } console.log('[orcad-prebuilds] compiling node-pty from patched source ...') - const result = spawnSync( - process.platform === 'win32' ? 'npx.cmd' : 'npx', - ['node-gyp', 'rebuild'], - { - cwd: dir, - stdio: 'inherit', - env: process.env, - windowsHide: true - } - ) + const result = spawnSync(process.platform === 'win32' ? 'npx.cmd' : 'npx', ['node-gyp', 'rebuild'], { + cwd: dir, + stdio: 'inherit', + env: process.env, + windowsHide: true + }) if (result.status !== 0) { throw new Error(`[orcad-prebuilds] node-gyp rebuild failed (status ${result.status})`) } diff --git a/config/scripts/build-orcad-prebuilds.test.mjs b/config/scripts/build-orcad-prebuilds.test.mjs index c91c7e6cc9d..84c0e83c18f 100644 --- a/config/scripts/build-orcad-prebuilds.test.mjs +++ b/config/scripts/build-orcad-prebuilds.test.mjs @@ -11,8 +11,7 @@ import { slotName } from './build-orcad-prebuilds.mjs' -const PATCHED_BINDING_GYP = - "'ldflags': ['-Wl,--no-as-needed,-l:libutil.so.1,-l:libpthread.so.0,--as-needed']" +const PATCHED_BINDING_GYP = "'ldflags': ['-Wl,--no-as-needed,-l:libutil.so.1,-l:libpthread.so.0,--as-needed']" const PATCHED_PTY_CC = '__asm__(".symver openpty,openpty@" ORCA_GLIBC_COMPAT_VERSION);' const dirs = [] @@ -108,9 +107,8 @@ describe('mergeManifest', () => { it('does not duplicate a slot rebuilt twice', () => { const once = mergeManifest(null, { slot: 'darwin-arm64', version: '1.1.0', nodeAbi: '127' }) - expect( - mergeManifest(once, { slot: 'darwin-arm64', version: '1.1.0', nodeAbi: '127' }).slots - ).toEqual(['darwin-arm64']) + expect(mergeManifest(once, { slot: 'darwin-arm64', version: '1.1.0', nodeAbi: '127' }).slots) + .toEqual(['darwin-arm64']) }) }) diff --git a/src/main/orcad/native-host-abi.ts b/src/main/orcad/native-host-abi.ts index 2890bb07a15..4afb8ac7bfa 100644 --- a/src/main/orcad/native-host-abi.ts +++ b/src/main/orcad/native-host-abi.ts @@ -117,7 +117,11 @@ export function parseUnmetGlibcVersion(loaderError: string): string | null { } /** `NODE_MODULE_VERSION 115 ... requires NODE_MODULE_VERSION 127` -> { built: '115', host: '127' }. */ -export function parseNodeAbiMismatch(loaderError: string): { built: string; host: string } | null { - const match = loaderError.match(/NODE_MODULE_VERSION\s+(\d+)\D+NODE_MODULE_VERSION\s+(\d+)/) +export function parseNodeAbiMismatch( + loaderError: string +): { built: string; host: string } | null { + const match = loaderError.match( + /NODE_MODULE_VERSION\s+(\d+)\D+NODE_MODULE_VERSION\s+(\d+)/ + ) return match ? { built: match[1], host: match[2] } : null } diff --git a/src/main/orcad/node-pty-prebuilt-slot.ts b/src/main/orcad/node-pty-prebuilt-slot.ts index d0623689902..992cbe705ee 100644 --- a/src/main/orcad/node-pty-prebuilt-slot.ts +++ b/src/main/orcad/node-pty-prebuilt-slot.ts @@ -27,12 +27,7 @@ export type PrebuiltSlotManifest = { export type PrebuiltSlotOutcome = | { installed: true; slot: string; spawnHelper: boolean } - | { - installed: false - slot: string - why: 'no-slot' | 'no-prebuilds-dir' | 'abi-mismatch' - detail?: string - } + | { installed: false; slot: string; why: 'no-slot' | 'no-prebuilds-dir' | 'abi-mismatch'; detail?: string } /** * Where a deployment's prebuilds live: beside the bundle that is running. `argv[1]` is @@ -60,9 +55,7 @@ export function readPrebuiltSlotManifest(prebuildsDir: string): PrebuiltSlotMani module: typeof manifest.module === 'string' ? manifest.module : 'node-pty', version: manifest.version, nodeAbi: manifest.nodeAbi, - slots: Array.isArray(manifest.slots) - ? manifest.slots.filter((s) => typeof s === 'string') - : [] + slots: Array.isArray(manifest.slots) ? manifest.slots.filter((s) => typeof s === 'string') : [] } } catch { return null diff --git a/src/main/ssh/build-toolchain-diagnosis.ts b/src/main/ssh/build-toolchain-diagnosis.ts index c64a41ead51..446601518c9 100644 --- a/src/main/ssh/build-toolchain-diagnosis.ts +++ b/src/main/ssh/build-toolchain-diagnosis.ts @@ -163,3 +163,4 @@ export function formatMissingToolchainError( ] return lines.join('\n') } + diff --git a/src/main/ssh/orcad-activation-record.ts b/src/main/ssh/orcad-activation-record.ts index 42b1e6703a8..8c32e6c355d 100644 --- a/src/main/ssh/orcad-activation-record.ts +++ b/src/main/ssh/orcad-activation-record.ts @@ -169,5 +169,7 @@ export function orcadGcPinnedDirNames( const versions = [record.active, record.previous, daemonEntryVersion ?? null].filter( (v): v is string => typeof v === 'string' && v.length > 0 ) - return [...new Set(versions)].map((version) => remoteInstallDirName(ORCAD_INSTALL_MODEL, version)) + return [...new Set(versions)].map((version) => + remoteInstallDirName(ORCAD_INSTALL_MODEL, version) + ) } diff --git a/src/main/ssh/orcad-remote-deploy.test.ts b/src/main/ssh/orcad-remote-deploy.test.ts index 6cab2dd0034..799193f3384 100644 --- a/src/main/ssh/orcad-remote-deploy.test.ts +++ b/src/main/ssh/orcad-remote-deploy.test.ts @@ -209,9 +209,7 @@ describe('deployOrcad', () => { const result = await deployOrcad(options()) expect(result).toMatchObject({ code: 'orcad_activation_daemon_degraded' }) expect( - vi - .mocked(writeRelayFile) - .mock.calls.some((call) => String(call[2]).endsWith('orcad-active.json')) + vi.mocked(writeRelayFile).mock.calls.some((call) => String(call[2]).endsWith('orcad-active.json')) ).toBe(false) }) diff --git a/src/main/ssh/orcad-remote-deploy.ts b/src/main/ssh/orcad-remote-deploy.ts index 878e327c452..1f8a4099a82 100644 --- a/src/main/ssh/orcad-remote-deploy.ts +++ b/src/main/ssh/orcad-remote-deploy.ts @@ -32,7 +32,10 @@ import { type OrcadActivationRecord, type OrcadStateSnapshot } from './orcad-activation-record' -import { orcadActivationPath, readOrcadActivationRecord } from './orcad-activation-record-store' +import { + orcadActivationPath, + readOrcadActivationRecord +} from './orcad-activation-record-store' import { evaluateOrcadActivation, type OrcadActivationVerdict } from './orcad-activation-gate' import { planOrcadUpdate, type OrcadTerminalCensus } from './orcad-update-plan' import { @@ -108,11 +111,9 @@ async function installOrcadBundle( fullVersion: string, remoteDir: string ): Promise { - if ( - await isRemoteInstallComplete(options.conn, ORCAD_INSTALL_MODEL, remoteDir, options.host, { - signal: options.signal - }) - ) { + if (await isRemoteInstallComplete(options.conn, ORCAD_INSTALL_MODEL, remoteDir, options.host, { + signal: options.signal + })) { return } await acquireInstallLock(options.conn, remoteDir, options.host, { signal: options.signal }) @@ -150,12 +151,7 @@ async function captureSnapshot( takenAt: Date ): Promise { const dirName = orcadSnapshotDirName(fullVersion, takenAt.getTime()) - const snapshotDir = joinRemotePath( - options.host, - baseDir(options), - ORCAD_STATE_SNAPSHOT_DIR, - dirName - ) + const snapshotDir = joinRemotePath(options.host, baseDir(options), ORCAD_STATE_SNAPSHOT_DIR, dirName) const capture = parseOrcadSnapshotCapture( await exec( options, @@ -291,12 +287,9 @@ export async function deployOrcad(options: OrcadDeployOptions): Promise { currentDirAbsPath: '/home/u/.orca-remote/orcad-0.2.0+bb', record: emptyOrcadActivationRecord() }) - const listCommand = mockExec.mock.calls - .map((call) => String(call[1])) - .find((c) => c.includes('find')) + const listCommand = mockExec.mock.calls.map((call) => String(call[1])).find((c) => c.includes('find')) expect(listCommand).toContain("-name 'orcad-*'") expect(listCommand).not.toContain("-name 'relay-*'") }) diff --git a/src/main/ssh/orcad-remote-launch.ts b/src/main/ssh/orcad-remote-launch.ts index a76010ccbce..e82be95faec 100644 --- a/src/main/ssh/orcad-remote-launch.ts +++ b/src/main/ssh/orcad-remote-launch.ts @@ -25,7 +25,10 @@ import type { ServeReadiness } from '../server/serve-readiness' export const ORCAD_READINESS_FILENAME = '.orcad-readiness' /** Stderr, including the bind-exposure line and every supervision message. */ export const ORCAD_LOG_FILENAME = 'orcad.log' -export { ORCAD_PID_FILENAME, OrcadRemoteLaunchUnsupportedError } from './orcad-remote-host-support' +export { + ORCAD_PID_FILENAME, + OrcadRemoteLaunchUnsupportedError +} from './orcad-remote-host-support' export type OrcadLaunchSpec = { remoteInstallDir: string @@ -48,9 +51,7 @@ export type OrcadLaunchSpec = { export function orcadLaunchCommand(host: RemoteHostPlatform, spec: OrcadLaunchSpec): string { assertPosixHost(host) const dir = shellEscape(spec.remoteInstallDir) - const readiness = shellEscape( - joinRemotePath(host, spec.remoteInstallDir, ORCAD_READINESS_FILENAME) - ) + const readiness = shellEscape(joinRemotePath(host, spec.remoteInstallDir, ORCAD_READINESS_FILENAME)) const log = shellEscape(joinRemotePath(host, spec.remoteInstallDir, ORCAD_LOG_FILENAME)) const pidFile = shellEscape(joinRemotePath(host, spec.remoteInstallDir, ORCAD_PID_FILENAME)) const entry = shellEscape(joinRemotePath(host, spec.remoteInstallDir, 'orcad.js')) diff --git a/src/main/ssh/orcad-remote-rollback.test.ts b/src/main/ssh/orcad-remote-rollback.test.ts index b9c74158a6d..59f3d46e330 100644 --- a/src/main/ssh/orcad-remote-rollback.test.ts +++ b/src/main/ssh/orcad-remote-rollback.test.ts @@ -13,7 +13,10 @@ vi.mock('./ssh-relay-install-transfers', () => ({ import { execCommand } from './ssh-relay-deploy-helpers' import { writeRelayFile } from './ssh-relay-install-transfers' import { rollbackOrcad, type OrcadRollbackOptions } from './orcad-remote-rollback' -import { emptyOrcadActivationRecord, type OrcadActivationRecord } from './orcad-activation-record' +import { + emptyOrcadActivationRecord, + type OrcadActivationRecord +} from './orcad-activation-record' import { getRemoteHostPlatform } from './ssh-remote-platform' import type { SshConnection } from './ssh-connection' diff --git a/src/main/ssh/orcad-remote-rollback.ts b/src/main/ssh/orcad-remote-rollback.ts index 03df9479e4a..165ccfc037f 100644 --- a/src/main/ssh/orcad-remote-rollback.ts +++ b/src/main/ssh/orcad-remote-rollback.ts @@ -109,7 +109,9 @@ async function readStateWritesSinceActivation( return newest === null ? null : newest >= activatedAtSeconds } -export async function rollbackOrcad(options: OrcadRollbackOptions): Promise { +export async function rollbackOrcad( + options: OrcadRollbackOptions +): Promise { const now = options.now ?? ((): Date => new Date()) const snapshotPresent = options.record.snapshot ? ( @@ -181,7 +183,11 @@ export async function rollbackOrcad(options: OrcadRollbackOptions): Promise { const exited = new Promise((resolve) => child.once('exit', (_code, signal) => resolve(signal)) ) - expect( - parseOrcadStopOutcome(sh(stopOrcadCommand(host, versionDir, { waitSeconds: 10 }))) - ).toBe('stopped') + expect(parseOrcadStopOutcome(sh(stopOrcadCommand(host, versionDir, { waitSeconds: 10 })))).toBe( + 'stopped' + ) expect(await exited).toBe('SIGTERM') expect(parseOrcadLiveness(sh(orcadLivenessProbeCommand(host, versionDir)))).toBe('DEAD') } finally { diff --git a/src/main/ssh/remote-install-gc.ts b/src/main/ssh/remote-install-gc.ts index b14b7e11fba..0d649cd0b03 100644 --- a/src/main/ssh/remote-install-gc.ts +++ b/src/main/ssh/remote-install-gc.ts @@ -211,9 +211,7 @@ async function isCandidateSafeToRemove( if (!(await isRelayInstallLockStale(conn, lockDir, host))) { return false } - process.stderr.write?.( - `[${model.id}] GC: lock at ${lockDir} is stale; treating as recoverable\n` - ) + process.stderr.write?.(`[${model.id}] GC: lock at ${lockDir} is stale; treating as recoverable\n`) } // Legacy dirs predate .install-complete; skip the sentinel and rely on the live-socket probe alone. @@ -233,6 +231,7 @@ async function isCandidateSafeToRemove( return !(await options.isDirLive(dir)) } + /** * The relay's GC, bound to its own namespace and its own liveness probe (a live unix socket * or Windows pipe inside the version dir). diff --git a/src/main/ssh/ssh-relay-versioned-install.ts b/src/main/ssh/ssh-relay-versioned-install.ts index 5bd111bdec1..d2ddc62e64b 100644 --- a/src/main/ssh/ssh-relay-versioned-install.ts +++ b/src/main/ssh/ssh-relay-versioned-install.ts @@ -92,11 +92,7 @@ export function computeRemoteInstallDir( pathFlavor === 'windows' ? getRemoteHostPlatform('win32-x64') : getRemoteHostPlatform('linux-x64') - return joinRemotePath( - host, - remoteHome, - ...remoteInstallDirSegments(model, fullVersion, pathFlavor) - ) + return joinRemotePath(host, remoteHome, ...remoteInstallDirSegments(model, fullVersion, pathFlavor)) } /**