diff --git a/src/renderer/src/components/UpdateCard.error-card.test.tsx b/src/renderer/src/components/UpdateCard.error-card.test.tsx index 618e73d6b..d9b74c7fd 100644 --- a/src/renderer/src/components/UpdateCard.error-card.test.tsx +++ b/src/renderer/src/components/UpdateCard.error-card.test.tsx @@ -98,6 +98,29 @@ describe('UpdateCard Windows signature failures', () => { }) }) +describe('UpdateCard hourly builds', () => { + it('links a pinned hourly build to its own repo instead of a 404 main-repo tag', () => { + useAppStore.setState({ + updateStatus: { + state: 'available', + version: '1.4.160-hourly.202607281400', + changelog: null, + source: 'hourly' + }, + updateChangelog: null, + dismissedUpdateVersion: null, + updateCardCollapsed: false, + updateReassuranceSeen: true + }) + render() + + fireEvent.click(screen.getByRole('button', { name: 'Release notes' })) + expect(openUrl).toHaveBeenCalledWith( + 'https://github.com/stablyai/orca-hourly/releases/tag/v1.4.160-hourly.202607281400' + ) + }) +}) + describe('UpdateCard local builds', () => { it('does not link local versions to GitHub release downloads', () => { useAppStore.setState({ diff --git a/src/renderer/src/components/UpdateCard.tsx b/src/renderer/src/components/UpdateCard.tsx index 1e04d8df2..4a23897df 100644 --- a/src/renderer/src/components/UpdateCard.tsx +++ b/src/renderer/src/components/UpdateCard.tsx @@ -21,17 +21,11 @@ import { isWindowsSignatureCheckUnavailableFailure, isWindowsSignatureMismatchFailure } from '../../../shared/updater-windows-signature-check' +import { getReleaseNotesUrlForVersion } from '../../../shared/release-channel' import { translate } from '@/i18n/i18n' // ── Helpers ────────────────────────────────────────────────────────── -function releaseUrlForVersion(version: string | null): string { - // Why: fall back to the plain releases listing (not /releases/latest) — /latest also breaks when GitHub's API is degraded. - return version - ? `https://github.com/stablyai/orca/releases/tag/v${version}` - : 'https://github.com/stablyai/orca/releases' -} - function isAnimatedGif(url: string | undefined): boolean { return typeof url === 'string' && url.toLowerCase().endsWith('.gif') } @@ -357,7 +351,7 @@ export function UpdateCard() { 'This turns on a process-wide Electron networking switch after restart. Use it for corporate VPNs or proxies that reject HTTP/2 update downloads.' ), detail: compatibilitySetupError ?? status.message, - releaseUrl: releaseUrlForVersion(cachedVersion), + releaseUrl: getReleaseNotesUrlForVersion(cachedVersion), primaryAction: { label: translate('auto.components.UpdateCard.933c6fdf5b', 'Enable & Restart'), pendingLabel: 'Restarting...', @@ -379,7 +373,7 @@ export function UpdateCard() { ), detail: status.message, // Why: linking the rejected version would let users bypass the publisher check by re-running it. - releaseUrl: releaseUrlForVersion(null), + releaseUrl: getReleaseNotesUrlForVersion(null), manualLabel: translate( 'auto.components.UpdateCard.c9ff9b9ec2', 'Check official releases' @@ -396,7 +390,7 @@ export function UpdateCard() { "The signature check couldn't run — usually because antivirus software blocked it. Retry the download, or get the installer from our official releases." ), detail: status.message, - releaseUrl: releaseUrlForVersion(cachedVersion), + releaseUrl: getReleaseNotesUrlForVersion(cachedVersion), primaryAction: { label: translate('auto.components.UpdateCard.48565a32bc', 'Retry Download'), onClick: handleUpdate @@ -409,7 +403,7 @@ export function UpdateCard() { ? 'Could not complete the update.' : 'Could not check for updates.', detail: status.message, - releaseUrl: releaseUrlForVersion(cachedVersion), + releaseUrl: getReleaseNotesUrlForVersion(cachedVersion), // Why: check-time failures are often transient, so offer a Re-check instead of forcing manual download. primaryAction: cachedVersion ? { @@ -428,7 +422,7 @@ export function UpdateCard() { title: translate('auto.components.UpdateCard.4cf109845a', 'Update Error'), summary: 'Could not restart to install the update.', detail: installError, - releaseUrl: releaseUrlForVersion(cachedVersion), + releaseUrl: getReleaseNotesUrlForVersion(cachedVersion), primaryAction: { label: translate('auto.components.UpdateCard.2c2d3e03ca', 'Try Again'), onClick: handleInstallRetry @@ -598,7 +592,7 @@ export function UpdateCard() { const releaseUrl = isLocalBuild ? undefined : (('releaseUrl' in status ? status.releaseUrl : undefined) ?? - releaseUrlForVersion(status.version)) + getReleaseNotesUrlForVersion(status.version)) if (isRichMode && changelog) { return ( @@ -914,7 +908,7 @@ function DownloadingContent({ className="text-xs text-muted-foreground underline hover:text-foreground self-start" onClick={() => void window.api.shell.openUrl( - release ? release.releaseNotesUrl : releaseUrlForVersion(version) + release ? release.releaseNotesUrl : getReleaseNotesUrlForVersion(version) ) } > diff --git a/src/renderer/src/components/settings/AccountsPane.test.tsx b/src/renderer/src/components/settings/AccountsPane.test.tsx index 59dd184ba..795caf9b5 100644 --- a/src/renderer/src/components/settings/AccountsPane.test.tsx +++ b/src/renderer/src/components/settings/AccountsPane.test.tsx @@ -48,7 +48,7 @@ describe('AccountsPane', () => { expect(markup).toContain('Account location') expect(markup).toContain('aria-label="Account location"') - expect(markup).toContain('role="radio" aria-checked="true" disabled=""') + expect(markup).toContain('role="radio" aria-checked="true" aria-disabled="true"') }) it('selects the WSL account location under auto when the global project runtime is WSL', () => { @@ -70,8 +70,8 @@ describe('AccountsPane', () => { ) expect(markup).toContain('aria-label="Account location"') - // The resolved WSL radio is the checked option (disabled while capabilities load). - expect(markup).toContain('role="radio" aria-checked="true" disabled=""') + // The resolved WSL radio is the checked option (unavailable while capabilities load). + expect(markup).toContain('role="radio" aria-checked="true" aria-disabled="true"') } finally { if (originalOwnUserAgent) { Object.defineProperty(globalThis.navigator, 'userAgent', originalOwnUserAgent) diff --git a/src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx b/src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx index 7095ab971..1b325ed47 100644 --- a/src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx +++ b/src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx @@ -10,6 +10,7 @@ import { translate } from '@/i18n/i18n' import { getUpdateCheckClickOptions, getUpdateCheckHint } from '@/lib/update-check-click-options' import { GeneralRemoteServerUpdates } from './GeneralRemoteServerUpdates' import { ReleaseChannelSection } from './ReleaseChannelSection' +import { getReleaseNotesUrlForVersion } from '../../../../shared/release-channel' export function GeneralUpdateSettingsSection(): React.JSX.Element { const updateStatus = useAppStore((s) => s.updateStatus) @@ -184,8 +185,7 @@ export function GeneralUpdateSettingsSection(): React.JSX.Element { {updateStatus.source !== 'local' && ( } { + render( + + + value="stable" + onChange={onChange} + options={[ + { value: 'stable', label: 'Stable' }, + { + value: 'hourly', + label: 'Hourly', + disabled: true, + ariaLabel: 'Hourly (macOS only)', + tooltip: 'Hourly builds are produced only for macOS.' + } + ]} + /> + + ) + return { onChange } +} + +describe('SettingsSegmentedControl unavailable options', () => { + // Why: a native disabled button leaves the tab order, so keyboard users can never + // focus it to open the tooltip explaining why the option is unavailable. + it('marks unavailable options aria-disabled so their tooltip stays reachable', async () => { + renderControl() + + const hourly = screen.getByRole('radio', { name: 'Hourly (macOS only)' }) + expect(hourly.hasAttribute('disabled')).toBe(false) + expect(hourly.getAttribute('aria-disabled')).toBe('true') + + fireEvent.focus(hourly) + expect( + await screen.findAllByText('Hourly builds are produced only for macOS.') + ).not.toHaveLength(0) + }) + + it('ignores clicks on unavailable options', () => { + const { onChange } = renderControl() + + fireEvent.click(screen.getByRole('radio', { name: 'Hourly (macOS only)' })) + expect(onChange).not.toHaveBeenCalled() + + fireEvent.click(screen.getByRole('radio', { name: 'Stable' })) + expect(onChange).toHaveBeenCalledWith('stable') + }) +}) diff --git a/src/renderer/src/components/settings/SettingsFormControls.tsx b/src/renderer/src/components/settings/SettingsFormControls.tsx index a05146f51..6730b4a49 100644 --- a/src/renderer/src/components/settings/SettingsFormControls.tsx +++ b/src/renderer/src/components/settings/SettingsFormControls.tsx @@ -179,7 +179,10 @@ export function SettingsSegmentedControl({ role="radio" aria-checked={active} aria-label={opt.ariaLabel} - disabled={opt.disabled} + // Why aria-disabled, not disabled: a native disabled button leaves the tab + // order, so keyboard users can never focus it to open the tooltip explaining + // why the option is unavailable. The click guard below keeps it inert. + aria-disabled={opt.disabled} onClick={() => { if (!opt.disabled) { onChange(opt.value) diff --git a/src/shared/release-channel.test.ts b/src/shared/release-channel.test.ts index 089487f0a..d8e74ee13 100644 --- a/src/shared/release-channel.test.ts +++ b/src/shared/release-channel.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest' import { formatHourlyVersion, + getReleaseNotesUrlForVersion, getReleaseRepoForChannel, getVersionChannel, isChannelSupportedOnPlatform, @@ -30,6 +31,21 @@ describe('release channel', () => { expect(getReleaseRepoForChannel('rc')).toBe('stablyai/orca') }) + // Why: an hourly tag linked against the main repo 404s — the tag only exists + // in the hourly repo. + it('builds release-notes links against the repo that published the version', () => { + expect(getReleaseNotesUrlForVersion('1.4.160-hourly.202607281400')).toBe( + 'https://github.com/stablyai/orca-hourly/releases/tag/v1.4.160-hourly.202607281400' + ) + expect(getReleaseNotesUrlForVersion('1.4.160')).toBe( + 'https://github.com/stablyai/orca/releases/tag/v1.4.160' + ) + expect(getReleaseNotesUrlForVersion('v1.4.160-rc.3')).toBe( + 'https://github.com/stablyai/orca/releases/tag/v1.4.160-rc.3' + ) + expect(getReleaseNotesUrlForVersion(null)).toBe('https://github.com/stablyai/orca/releases') + }) + it('round-trips an hourly version stamp as UTC', () => { const version = formatHourlyVersion('1.4.160', '202607281405') expect(isHourlyVersion(version)).toBe(true) diff --git a/src/shared/release-channel.ts b/src/shared/release-channel.ts index fc0c09cef..d95b0b2aa 100644 --- a/src/shared/release-channel.ts +++ b/src/shared/release-channel.ts @@ -82,6 +82,20 @@ export function getVersionChannel(version: string): ReleaseChannel | null { return normalized.includes('-') ? 'rc' : 'stable' } +/** + * Release-notes page for a version, in whichever repo published it. Hourly tags + * exist only in the hourly repo, so a main-repo tag URL for one 404s. + * A null version falls back to the plain releases listing (not /releases/latest + * — /latest also breaks when GitHub's API is degraded). + */ +export function getReleaseNotesUrlForVersion(version: string | null): string { + const repo = + version && getVersionChannel(version) === 'hourly' ? HOURLY_RELEASE_REPO : MAIN_RELEASE_REPO + return version + ? `https://github.com/${repo}/releases/tag/v${normalizeTagToVersion(version)}` + : `https://github.com/${repo}/releases` +} + export type ReleaseBuild = { tag: string version: string