mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
refactor(updater): keep Linux marker message with status
This commit is contained in:
@@ -4,12 +4,11 @@ import {
|
||||
clearTrackedLinuxPackageArtifact,
|
||||
getTrackedLinuxPackageArtifact
|
||||
} from './linux-package-update-recovery'
|
||||
import {
|
||||
getLinuxPackageType,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE
|
||||
} from './linux-update-package-type'
|
||||
import { getLinuxPackageType } from './linux-update-package-type'
|
||||
import type { LinuxPackageArtifact } from './linux-package-update-recovery'
|
||||
|
||||
export const LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE =
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
export const LINUX_PACKAGE_MANUAL_INSTALL_MESSAGE =
|
||||
'Quit Orca before running the system package install command.'
|
||||
const PACKAGE_METADATA_UNUSABLE_MESSAGE =
|
||||
|
||||
@@ -8,9 +8,6 @@ export type { LinuxRootPackageType }
|
||||
/** The packaged Linux format that controls how updates may be installed. */
|
||||
export type LinuxPackageType = LinuxRootPackageType | 'non-root' | 'unusable'
|
||||
|
||||
export const LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE =
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
|
||||
// Why: `undefined` means "not resolved yet"; every other value is stable for this process.
|
||||
let cachedPackageType: LinuxPackageType | undefined
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@ vi.mock('electron', () => ({
|
||||
// Why: only the packaged-marker resolver is faked so the real artifact tracking runs.
|
||||
vi.mock('./linux-update-package-type', () => ({
|
||||
getLinuxPackageType: getLinuxPackageTypeMock,
|
||||
getLinuxRootPackageType: getLinuxRootPackageTypeMock,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE:
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
getLinuxRootPackageType: getLinuxRootPackageTypeMock
|
||||
}))
|
||||
|
||||
vi.mock('./updater-changelog', () => ({ fetchChangelog: vi.fn().mockResolvedValue(null) }))
|
||||
|
||||
@@ -80,9 +80,7 @@ vi.mock('./updater-lifecycle-diagnostics', () => ({
|
||||
}))
|
||||
vi.mock('./linux-update-package-type', () => ({
|
||||
getLinuxPackageType: () => 'deb',
|
||||
getLinuxRootPackageType: () => 'deb',
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE:
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
getLinuxRootPackageType: () => 'deb'
|
||||
}))
|
||||
vi.mock('./linux-package-update-recovery', () => ({
|
||||
captureLinuxPackageArtifact: vi.fn(() => getTrackedLinuxPackageArtifactMock()),
|
||||
|
||||
@@ -48,7 +48,6 @@ type UpdaterModuleFactories = {
|
||||
linuxUpdatePackageType: () => {
|
||||
getLinuxPackageType: Mock<() => LinuxPackageType>
|
||||
getLinuxRootPackageType: Mock<() => 'deb' | 'rpm' | null>
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE: string
|
||||
}
|
||||
updaterLifecycleDiagnostics: () => { recordUpdaterLifecycle: UpdaterSpy }
|
||||
updaterChangelog: () => { fetchChangelog: UpdaterSpy }
|
||||
@@ -243,9 +242,7 @@ export function createUpdaterMocks(): UpdaterMocks {
|
||||
// Why: only the marker resolver is faked so the real artifact capture/redaction path stays under test.
|
||||
linuxUpdatePackageType: () => ({
|
||||
getLinuxPackageType: getLinuxPackageTypeMock,
|
||||
getLinuxRootPackageType: getLinuxRootPackageTypeMock,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE:
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
getLinuxRootPackageType: getLinuxRootPackageTypeMock
|
||||
}),
|
||||
updaterLifecycleDiagnostics: () => ({ recordUpdaterLifecycle: recordUpdaterLifecycleMock }),
|
||||
updaterChangelog: () => ({ fetchChangelog: fetchChangelogMock }),
|
||||
|
||||
@@ -78,9 +78,7 @@ vi.mock('electron-updater', () => ({ autoUpdater: autoUpdaterMock }))
|
||||
vi.mock('./electron-updater-loader', () => ({ loadElectronAutoUpdater: () => autoUpdaterMock }))
|
||||
vi.mock('./linux-update-package-type', () => ({
|
||||
getLinuxPackageType: () => 'non-root',
|
||||
getLinuxRootPackageType: () => null,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE:
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
getLinuxRootPackageType: () => null
|
||||
}))
|
||||
vi.mock('@electron-toolkit/utils', () => ({ is: { dev: false } }))
|
||||
vi.mock('./ipc/pty', () => ({ killAllPty: killAllPtyMock }))
|
||||
|
||||
@@ -102,9 +102,7 @@ vi.mock('./updater-lifecycle-diagnostics', () => ({
|
||||
}))
|
||||
vi.mock('./linux-update-package-type', () => ({
|
||||
getLinuxPackageType: () => 'non-root',
|
||||
getLinuxRootPackageType: () => null,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE:
|
||||
'Orca could not verify the installed Linux package format, so it will not install this update automatically. Download the update from the official release page and install it manually.'
|
||||
getLinuxRootPackageType: () => null
|
||||
}))
|
||||
|
||||
// The real electron-updater DebUpdater failure text when elevation is impossible.
|
||||
|
||||
+3
-3
@@ -35,11 +35,11 @@ import {
|
||||
} from './update-install-exit-watchdog'
|
||||
import { registerAutoUpdaterHandlers } from './updater-events'
|
||||
import { recordUpdaterLifecycle } from './updater-lifecycle-diagnostics'
|
||||
import { getLinuxPackageType } from './linux-update-package-type'
|
||||
import {
|
||||
getLinuxPackageType,
|
||||
getRetainedLinuxPackageManualInstallStatus,
|
||||
LINUX_PACKAGE_MARKER_UNUSABLE_MESSAGE
|
||||
} from './linux-update-package-type'
|
||||
import { getRetainedLinuxPackageManualInstallStatus } from './linux-package-downloaded-status'
|
||||
} from './linux-package-downloaded-status'
|
||||
import {
|
||||
createUpdaterDiagnosticLogger,
|
||||
redactLinuxPackageInstallText
|
||||
|
||||
Reference in New Issue
Block a user