diff --git a/src/main/updater.test.ts b/src/main/updater.test.ts index 2b6cd326e98..35a8c4c45bc 100644 --- a/src/main/updater.test.ts +++ b/src/main/updater.test.ts @@ -246,6 +246,34 @@ describe('updater', () => { expect(powerMonitorOnMock).not.toHaveBeenCalled() }) + it.each([ + ['hourly', 'v1.4.160-hourly.202607281400', 'Hourly builds are produced only for macOS.'], + ['adhoc', 'v1.4.160-adhoc.20260728140533', 'Adhoc builds are produced only for macOS.'] + ] as const)( + 'uses the display label in the mac-only %s pinned-build error', + async (channel, tag, message) => { + const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('linux') + try { + const send = vi.fn() + const { setupAutoUpdater, checkForUpdatesFromMenu } = await import('./updater') + setupAutoUpdater({ webContents: { send } } as never, { + getLastUpdateCheckAt: () => Date.now() + }) + + checkForUpdatesFromMenu({ channel, targetTag: tag }) + + expect(send).toHaveBeenCalledWith('updater:status', { + state: 'error', + message, + userInitiated: true + }) + expect(autoUpdaterMock.checkForUpdates).not.toHaveBeenCalled() + } finally { + platformSpy.mockRestore() + } + } + ) + it.runIf(process.platform === 'darwin')( 'allows a validated local build to downgrade through the normal updater lifecycle', async () => { diff --git a/src/main/updater.ts b/src/main/updater.ts index d4bdb8a9215..6bb26d84dd5 100644 --- a/src/main/updater.ts +++ b/src/main/updater.ts @@ -71,6 +71,7 @@ import { listReleaseBuilds, resolveTargetBuild } from './updater-release-builds' import { hasDedicatedReleaseRepo, isChannelSupportedOnPlatform, + RELEASE_CHANNEL_LABELS, type ReleaseBuild, type ReleaseChannel } from '../shared/release-channel' @@ -1680,7 +1681,7 @@ async function checkForPinnedBuild(channel: ReleaseChannel, tag: string): Promis if (!isChannelSupportedOnPlatform(channel, process.platform)) { sendStatus({ state: 'error', - message: `${channel} builds are produced only for macOS.`, + message: `${RELEASE_CHANNEL_LABELS[channel]} builds are produced only for macOS.`, userInitiated: true }) return diff --git a/src/renderer/src/components/settings/ReleaseChannelSection.tsx b/src/renderer/src/components/settings/ReleaseChannelSection.tsx index 99cc9796126..dac9f1b0fa2 100644 --- a/src/renderer/src/components/settings/ReleaseChannelSection.tsx +++ b/src/renderer/src/components/settings/ReleaseChannelSection.tsx @@ -11,6 +11,7 @@ import { translate } from '@/i18n/i18n' import { getShortcutPlatform } from '@/lib/shortcut-platform' import { RELEASE_CHANNELS, + RELEASE_CHANNEL_LABELS, getVersionChannel, hasDedicatedReleaseRepo, isChannelSupportedOnPlatform, @@ -19,13 +20,6 @@ import { type ReleaseChannel } from '../../../../shared/release-channel' -const CHANNEL_LABELS: Record = { - stable: 'Stable', - rc: 'RC', - hourly: 'Hourly', - adhoc: 'Adhoc' -} - const CHANNEL_DESCRIPTIONS: Record = { stable: 'Shipped releases. What everyone else is running.', rc: 'Release candidates cut ahead of each stable.', @@ -200,10 +194,10 @@ export function ReleaseChannelSection(): React.JSX.Element { return { value: channel, label: supported ? ( - CHANNEL_LABELS[channel] + RELEASE_CHANNEL_LABELS[channel] ) : ( - {CHANNEL_LABELS[channel]} + {RELEASE_CHANNEL_LABELS[channel]} ), @@ -213,14 +207,14 @@ export function ReleaseChannelSection(): React.JSX.Element { : translate( 'auto.components.settings.ReleaseChannelSection.devChannelMacOnlyAria', '{{value0}} (macOS only)', - { value0: CHANNEL_LABELS[channel] } + { value0: RELEASE_CHANNEL_LABELS[channel] } ), tooltip: supported ? undefined : translate( 'auto.components.settings.ReleaseChannelSection.devChannelMacOnly', '{{value0}} builds are produced only for macOS. Linux and Windows stay on Stable or RC.', - { value0: CHANNEL_LABELS[channel] } + { value0: RELEASE_CHANNEL_LABELS[channel] } ) } })} diff --git a/src/shared/release-channel.ts b/src/shared/release-channel.ts index 87dd7665ded..743ef6529f3 100644 --- a/src/shared/release-channel.ts +++ b/src/shared/release-channel.ts @@ -4,6 +4,13 @@ export type ReleaseChannel = 'stable' | 'rc' | 'hourly' | 'adhoc' export const RELEASE_CHANNELS: readonly ReleaseChannel[] = ['stable', 'rc', 'hourly', 'adhoc'] +export const RELEASE_CHANNEL_LABELS: Readonly> = { + stable: 'Stable', + rc: 'RC', + hourly: 'Hourly', + adhoc: 'Adhoc' +} + /** Dev builds live in their own repos so their tags never enter the main * releases atom feed, which only exposes the 10 newest entries — 24 hourly * tags a day would evict every stable/RC entry and strand real users. */