[P2] fix(updater): route hourly release-notes links to the hourly repo and let the disabled channel tooltip open (#11812)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -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(<UpdateCard />)
|
||||
|
||||
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({
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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' && (
|
||||
<a
|
||||
href={
|
||||
updateStatus.releaseUrl ??
|
||||
`https://github.com/stablyai/orca/releases/tag/v${updateStatus.version}`
|
||||
updateStatus.releaseUrl ?? getReleaseNotesUrlForVersion(updateStatus.version)
|
||||
}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@@ -224,8 +224,7 @@ export function GeneralUpdateSettingsSection(): React.JSX.Element {
|
||||
{updateStatus.source !== 'local' && (
|
||||
<a
|
||||
href={
|
||||
updateStatus.releaseUrl ??
|
||||
`https://github.com/stablyai/orca/releases/tag/v${updateStatus.version}`
|
||||
updateStatus.releaseUrl ?? getReleaseNotesUrlForVersion(updateStatus.version)
|
||||
}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { TooltipProvider } from '../ui/tooltip'
|
||||
import { SettingsSegmentedControl } from './SettingsFormControls'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
function renderControl(onChange = vi.fn()): { onChange: ReturnType<typeof vi.fn> } {
|
||||
render(
|
||||
<TooltipProvider>
|
||||
<SettingsSegmentedControl<string>
|
||||
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.'
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
)
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -179,7 +179,10 @@ export function SettingsSegmentedControl<T extends string | number>({
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user