From 672bfef26b3bf5339d8fd845358fb7354dc9208a Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Mon, 31 Aug 2026 07:06:59 -0700 Subject: [PATCH] refactor(updater): keep Linux marker message with status --- src/main/linux-package-downloaded-status.ts | 7 +++---- src/main/linux-update-package-type.ts | 3 --- src/main/updater-events.test.ts | 4 +--- src/main/updater-linux-package-recovery-actions.test.ts | 4 +--- src/main/updater-test-harness.ts | 5 +---- src/main/updater.headless-serve-install.test.ts | 4 +--- src/main/updater.install-failure-cause.test.ts | 4 +--- src/main/updater.ts | 6 +++--- 8 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/main/linux-package-downloaded-status.ts b/src/main/linux-package-downloaded-status.ts index 186a7ef4e9d..259202dfa00 100644 --- a/src/main/linux-package-downloaded-status.ts +++ b/src/main/linux-package-downloaded-status.ts @@ -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 = diff --git a/src/main/linux-update-package-type.ts b/src/main/linux-update-package-type.ts index 23bbb34d82d..fe0a25b9f2a 100644 --- a/src/main/linux-update-package-type.ts +++ b/src/main/linux-update-package-type.ts @@ -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 diff --git a/src/main/updater-events.test.ts b/src/main/updater-events.test.ts index feb5c5eae66..54361d74121 100644 --- a/src/main/updater-events.test.ts +++ b/src/main/updater-events.test.ts @@ -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) })) diff --git a/src/main/updater-linux-package-recovery-actions.test.ts b/src/main/updater-linux-package-recovery-actions.test.ts index f9bc27b93d0..5730e53cc25 100644 --- a/src/main/updater-linux-package-recovery-actions.test.ts +++ b/src/main/updater-linux-package-recovery-actions.test.ts @@ -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()), diff --git a/src/main/updater-test-harness.ts b/src/main/updater-test-harness.ts index f628bf037c7..20c23f48a47 100644 --- a/src/main/updater-test-harness.ts +++ b/src/main/updater-test-harness.ts @@ -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 }), diff --git a/src/main/updater.headless-serve-install.test.ts b/src/main/updater.headless-serve-install.test.ts index b33b8a4fd3b..567875782ce 100644 --- a/src/main/updater.headless-serve-install.test.ts +++ b/src/main/updater.headless-serve-install.test.ts @@ -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 })) diff --git a/src/main/updater.install-failure-cause.test.ts b/src/main/updater.install-failure-cause.test.ts index 2d72316e3d5..55cd48836b8 100644 --- a/src/main/updater.install-failure-cause.test.ts +++ b/src/main/updater.install-failure-cause.test.ts @@ -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. diff --git a/src/main/updater.ts b/src/main/updater.ts index 77776eef590..019bfd124be 100644 --- a/src/main/updater.ts +++ b/src/main/updater.ts @@ -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