Open-source Xbox-inspired desktop launcher for Xodus on Linux
TypeScript
[source-only] feat(settings): present component updates and the optional CachyOS runtime
Nexus Maintainer3f8b42c8777a
diff --git a/assets/locales/en.json b/assets/locales/en.jsonindex 2f444cc..7e39a29 100644--- a/assets/locales/en.json+++ b/assets/locales/en.json@@ -1,7 +1,5 @@{- "updates.title": "Component updates",- "updates.help": "Update installed managed components together. Optional runtimes are not installed automatically. Game family choices, prefixes and local saves are kept.",- "updates.action": "Update all components",+ "updates.action": "Update all","updates.confirm_title": "Update installed components?","updates.confirm_help": "Only the listed installed components will be updated. The launcher is updated last and will not restart automatically.","updates.apply": "Apply updates",@@ -17,20 +15,17 @@"updates.deferred": "Deferred","updates.retry": "Retry {{name}}","updates.restart_help": "Restart the launcher using Restart launcher below when you are ready. No restart happens automatically.",+ "runtime.cachyos_title": "CachyOS runtime",+ "runtime.cachyos_current": "This runtime is up to date.",+ "runtime.cachyos_active": "Active local build: {{version}}",+ "runtime.cachyos_active_label": "ACTIVE",+ "runtime.cachyos_installed": "CachyOS runtime installed. The default runtime, game runtime choices, prefixes and local saves are unchanged.","runtime.default_title": "Default Wine / Proton runtime",- "runtime.families_current": "This family is up to date.",- "runtime.families_title": "Per-game runtime families",- "runtime.families_help": "Choose a family in Game settings. Family updates reuse its existing prefix and local saves. Installing here keeps your current default Wine / Proton selection unchanged.",- "runtime.families_not_installed": "Not installed as a per-game family","runtime.families_version": "Installed: {{version}}","runtime.families_available": "Available: {{version}}","runtime.families_requires": "Requires backend {{backend}} and launcher {{launcher}} or newer.",- "runtime.families_cachyos_optin": "Allow this optional experimental CachyOS runtime",- "runtime.families_prerelease": "Include prereleases",- "runtime.families_show_cachyos": "Show experimental CachyOS runtime","runtime.families_update": "Update {{name}}","runtime.families_install": "Install {{name}}",- "runtime.families_installed": "Runtime family installed. Game family choices and local saves were kept.","runtime.families_committed_attention": "The runtime was activated, but finishing setup needs attention. Check its status before retrying.","runtime.families_failed": "The runtime operation could not be completed. Check its status and try again.","auth.sign_out_unknown_help": "Signs out active accounts and removes device registration. Saved Store accounts may remain available.",diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex 3b2e079..e32ac21 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -1,5 +1,6 @@-import {ComponentUpdates} from './ComponentUpdates';+import {useComponentUpdates} from './ComponentUpdates';import {ManagedRuntimeSettings} from './ManagedRuntimeSettings';+import {StatusDot} from './StatusDot';import {useGameRuntimeReady} from './useGameRuntimeReady';import {useStoreAccess} from './store-access';import {GameRuntimeFields} from './GameRuntimeFields';@@ -20,7 +21,7 @@ import {reconcileSettingsDraft} from './settings-draft';import {xboxOverlaySettings} from '../shared/xbox-overlay-settings';import './xbox-desktop-social.css';import { estimateTimeRemaining } from '../shared/utils';-import { nexusRuntimeUpdateAvailable, runtimeDisplay } from '../shared/runtime-display';+import { nexusRuntimeUpdateAvailable, runtimeDisplay, activeRuntimeIsCachyos } from '../shared/runtime-display';import { subscriptionBadge } from '../shared/subscription';import { defaultLaunchTools, normalizeLaunchTools } from '../shared/launch-tools';import { DEFAULT_SHADER_CACHE_GIB, shaderCacheLimits } from '../shared/shader-cache';@@ -89,10 +90,6 @@ function errorMessage(error: unknown): string {return raw.replace(/^Error invoking remote method '[^']+': Error:\s*/, '');}-function StatusDot({ tone = 'green' }: { tone?: 'green' | 'amber' | 'red' }) {- return <span className={`status-dot ${tone}`} />;-}-export function GameTitle({ title }: { title: string }) {return <strong title={title}>{title}</strong>;}@@ -942,6 +939,13 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (valueconst [accountManagement, setAccountManagement] = useState(data.settings.multiAccountEnabled === true);useEffect(() => setAccountManagement(data.settings.multiAccountEnabled === true), [data.settings.multiAccountEnabled]);const managingAccounts = accountManagement && data.auth.savedAccountsEnabled === true;+ const componentUpdatesDisabled = Boolean(busy)||data.auth.running||data.backend.updating||data.runtime.updating||Boolean(data.launcherUpdate?.updating)||Boolean(data.gameOperation&&['preparing','running','stopping'].includes(data.gameOperation.status))||data.downloads.some(task=>['queued','running','paused'].includes(task.status))||data.componentUpdates?.running===true;+ const componentUpdates = useComponentUpdates({+ data,+ disabled: componentUpdatesDisabled,+ onBusyChange: value=>setBusy(value?'component-updates':undefined),+ confirm,+ });async function showAccountManagement(enabled: boolean) {await window.launcher.updateSettings({ multiAccountEnabled: enabled });setAccountManagement(enabled);@@ -977,6 +981,7 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (valuelet cacheLimitValid = true;try { shaderCacheLimits(form.shaderCacheLimitGiB ?? DEFAULT_SHADER_CACHE_GIB); } catch { cacheLimitValid = false; }const runtimeInfo = runtimeDisplay(data.runtime);+ const activeCachyos = activeRuntimeIsCachyos(data.runtime);const overlay=xboxOverlaySettings(form);const savedOverlay=xboxOverlaySettings(data.settings);const overlayDirty=overlay.overlayEnabled!==savedOverlay.overlayEnabled||overlay.overlaySide!==savedOverlay.overlaySide||(form.overlayShortcut??savedOverlay.overlayShortcut)!==savedOverlay.overlayShortcut;@@ -997,8 +1002,6 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value<CheckField className="tray-toggle" role="switch" label={ui('settings.close_to_tray')} description={ui('settings.close_to_tray_help')} checked={form.closeToTray===true} disabled={Boolean(busy)} onChange={event=>{const closeToTray=event.target.checked;setForm({...form,closeToTray});void invoke('close-to-tray',()=>window.launcher.updateSettings({closeToTray}),ui('settings.tray_saved'));}}/></section>- <ComponentUpdates data={data} disabled={Boolean(busy)||data.auth.running||data.backend.updating||data.runtime.updating||Boolean(data.launcherUpdate?.updating)||Boolean(data.gameOperation&&['preparing','running','stopping'].includes(data.gameOperation.status))||data.downloads.some(task=>['queued','running','paused'].includes(task.status))} onBusyChange={value=>setBusy(value?'component-updates':undefined)}/>-<section className="settings-card compact launcher-card">{data.launcherUpdate?.phase ? <p>{uiText(data.launcherUpdate.phase)}</p> : null}{data.launcherUpdate?.updating ? <div className="progress-track"><i style={{ width: `${data.launcherUpdate.progress ?? 0}%` }} /></div> : null}@@ -1009,9 +1012,23 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value{data.launcherUpdate?.releaseUrl && !data.launcherUpdate.canInstall ? <a className="primary" href={data.launcherUpdate.releaseUrl} target="_blank" rel="noreferrer"><ArrowDownToLine />{ui("ui.download_update_4f494b2")}</a> : null}{data.launcherUpdate?.restartRequired ? <button className="primary" disabled={Boolean(busy)||data.componentUpdates?.running} onClick={() => invoke('launcher-restart', () => window.launcher.restartLauncher())}><RefreshCw />{ui("ui.restart_launcher_b076da9")}</button> : null}{data.launcherUpdate?.canRollback ? <button className="secondary" disabled={data.launcherUpdate.updating || Boolean(busy)} onClick={async () => { if (await confirm({ title: ui("ui.restore_previous_launcher_ab5c227"), message: ui("ui.your_settings_and_games_will_not_change_3e99619"), confirmLabel: ui("ui.restore_launcher_a0520ac") })) void invoke('launcher-rollback', () => window.launcher.rollbackLauncherUpdate()); }}>{ui("ui.restore_previous_launcher_9b5f101")}</button> : null}- <button className="secondary" disabled={data.launcherUpdate?.checking || data.launcherUpdate?.updating || data.launcherUpdate?.restartRequired} onClick={() => invoke('update-check', () => window.launcher.checkLauncherUpdate(), ui("ui.update_check_finished_3f30d8a"))}>{data.launcherUpdate?.checking ? <LoaderCircle className="spin" /> : <RefreshCw />}{ui("ui.check_for_updates_f26f327")}</button>+ <button className="secondary" disabled={componentUpdatesDisabled || data.launcherUpdate?.checking || data.launcherUpdate?.updating || data.launcherUpdate?.restartRequired} onClick={async () => {+ // The component plan already runs the launcher release discovery. A+ // blocked or stale discovery is not a failure and must not start a+ // second launcher-only check. Fall back once only when the real plan+ // failed or its launcher row is not covered.+ const discovery=await componentUpdates.discover();+ if(discovery.status==='blocked'||discovery.status==='stale')return;+ if(discovery.status==='plan'&&discovery.plan.items.some(item=>item.component==='launcher'&&(item.state==='ready'||item.state==='unchanged'))){+ toast({kind:'success',message:ui("ui.update_check_finished_3f30d8a")});+ return;+ }+ await invoke('update-check', () => window.launcher.checkLauncherUpdate(), ui("ui.update_check_finished_3f30d8a"));+ }}>{data.launcherUpdate?.checking ? <LoaderCircle className="spin" /> : <RefreshCw />}{ui("ui.check_for_updates_f26f327")}</button>+ {componentUpdates.action}<button className="secondary" disabled={Boolean(busy)} title={ui("ui.add_nexus_with_artwork_including_while_steam_is_f7d03b8")} onClick={() => invoke('steam-launcher', () => window.launcher.addToSteam(), ui("ui.nexus_added_to_steam_2f6a699"))}><Plus />{ui("ui.add_nexus_to_steam_790c35e")}</button></div>+ {componentUpdates.details}</section><section className="settings-card account-card">@@ -1020,7 +1037,7 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value<KeyringSetup compact disabled={data.auth.running} /><div className="button-row"><button className="primary" disabled={!caps.login || data.auth.running} onClick={() => invoke('login', () => window.launcher.login(), ui("ui.xodus_sign_in_completed_8240737"))}>{data.auth.running ? <LoaderCircle className="spin" /> : <LogIn />}{data.auth.stored ? ui("ui.sign_in_again_51fbe1d") : ui("ui.sign_in_with_xodus_252572f")}</button><button className="secondary" disabled={!caps.logout || data.auth.running || (data.auth.stored === false && !data.auth.player)} title={data.auth.savedAccountsEnabled === true ? ui("auth.sign_out_active_help") : caps.savedAccounts && data.auth.savedAccountsEnabled === undefined ? ui("auth.sign_out_unknown_help") : ui("ui.remove_saved_sign_in_credentials_and_local_devic_6485324")} onClick={() => invoke('logout', () => window.launcher.logout(), data.auth.savedAccountsEnabled === true ? ui("auth.active_signed_out") : caps.savedAccounts && data.auth.savedAccountsEnabled === undefined ? ui("auth.active_signed_out_unknown") : ui("ui.saved_sign_in_credentials_and_local_device_regis_c9738bd"))}>{data.auth.player ? ui("auth.sign_out_all") : ui("ui.sign_out_48f0d3d")}</button><button className="secondary" disabled={!caps.account || data.auth.running} onClick={() => invoke('account', () => window.launcher.refreshAccount())}><RefreshCw />{ui("ui.refresh_status_442c4b8")}</button></div>{!managingAccounts && data.auth.player ? <p className="fine-print account-player-summary">{ui("auth.active_player", { name: data.auth.player })}</p> : null}- {managingAccounts || caps.savedAccounts ? <div className="button-row"><button className="secondary" aria-expanded={managingAccounts} disabled={Boolean(busy) || data.auth.running} onClick={() => invoke('account-management', () => showAccountManagement(!managingAccounts))}>{managingAccounts ? ui("auth.hide_management") : ui("auth.manage_multiple")}</button></div> : null}+ {managingAccounts || caps.savedAccounts ? <div className="button-row account-management-row"><button className="secondary" aria-expanded={managingAccounts} disabled={Boolean(busy) || data.auth.running} onClick={() => invoke('account-management', () => showAccountManagement(!managingAccounts))}>{managingAccounts ? ui("auth.hide_management") : ui("auth.manage_multiple")}</button></div> : null}{managingAccounts && (data.auth.saved?.length ?? 0) > 0 && caps.savedAccounts ? <div className="saved-accounts" role="list" aria-label={ui("ui.saved_store_accounts_a1c4e72")}><span className="overline">{ui("ui.saved_store_accounts_a1c4e72")}</span>{data.auth.saved!.map(name => <div key={name} className="button-row" role="listitem">@@ -1056,10 +1073,10 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value<div className="settings-heading"><div className="settings-icon"><Gamepad2 /></div><div><h2>{ui("runtime.default_title")}</h2><p>{data.runtime.installed ? ui("ui.active_ae2c40a", { runtime: runtimeInfo.title, version: runtimeInfo.version }) : ui("ui.no_runtime_selected_b8e7445")}</p></div><span className={`status-label ${data.runtime.installed && runtimeInfo.source === 'Nexus runtime' ? 'ready' : 'unknown'}`}><StatusDot tone={data.runtime.installed && runtimeInfo.source === 'Nexus runtime' ? 'green' : 'amber'} />{!data.runtime.installed ? ui("ui.missing_8af1d32") : runtimeInfo.source === 'Nexus runtime' ? ui("ui.ready_c2e3ac4") : ui("ui.other_runtime_ce6adfb")}</span></div>{data.runtime.nexusError ? <div className="alert amber"><CircleAlert /><span>{data.runtime.nexusError}</span></div> : null}{data.runtime.error ? <div className="alert amber"><CircleAlert /><span>{uiText(data.runtime.error)}</span></div> : null}{data.runtime.phase ? <div className="runtime-phase"><LoaderCircle className={data.runtime.updating ? 'spin' : ''} /><span>{uiText(data.runtime.phase)}</span></div> : null}- <div className="button-row end">+ {activeCachyos ? null : <div className="button-row end"><button className="secondary" disabled={Boolean(busy) || data.runtime.nexusChecking} onClick={() => invoke('runtime-check', () => window.launcher.checkNexusRuntime())}>{busy === 'runtime-check' || data.runtime.nexusChecking ? <LoaderCircle className="spin" /> : <RefreshCw />}{ui("ui.check_for_updates_f26f327")}</button>{nexusRuntimeUpdateAvailable(data.runtime) ? <button className="primary" disabled={Boolean(busy) || data.runtime.updating} onClick={() => invoke('runtime-install-nexus', () => window.launcher.installNexusRuntime(), ui("ui.nexus_runtime_was_verified_installed_and_selecte_51b0ff1"))}>{busy === 'runtime-install-nexus' || data.runtime.updating ? <LoaderCircle className="spin" /> : <ArrowDownToLine />}{ui("ui.install_nexus_runtime_2cf3608")}{data.runtime.nexusVersion ? ` ${data.runtime.nexusVersion.replace(/^runtime-/, '')}` : ''}</button> : null}- </div>+ </div>}{data.runtime.updating || runtimeLogs.length > 0 ? <pre className="build-log">{runtimeLogs.join('\n') || ui("ui.waiting_for_output_f05fefe")}</pre> : null}</section>diff --git a/src/renderer/ComponentUpdates.tsx b/src/renderer/ComponentUpdates.tsxindex d71de19..597c6dc 100644--- a/src/renderer/ComponentUpdates.tsx+++ b/src/renderer/ComponentUpdates.tsx@@ -1,8 +1,10 @@import {useEffect,useRef,useState} from 'react';-import {RefreshCw,LoaderCircle} from 'lucide-react';+import {ArrowDownToLine,LoaderCircle} from 'lucide-react';import type {AppSnapshot,ComponentUpdatePlan,ComponentUpdateBatchResult,ComponentUpdateOutcome} from '../shared/types';-import {useConfirmation} from './Confirmation';+import type {useConfirmation} from './Confirmation';import {ui} from './i18n';++type Confirm = ReturnType<typeof useConfirmation>;function outcomeLabel(value:ComponentUpdateOutcome):string {switch(value){case 'updated':return ui('updates.updated');case 'unchanged':return ui('updates.unchanged');@@ -11,8 +13,22 @@ function outcomeLabel(value:ComponentUpdateOutcome):string {case 'failed-before-commit':return ui('updates.failed');case 'not-run':return ui('updates.not_run');case 'deferred':return ui('updates.deferred');}}-export function ComponentUpdates({data,disabled,onBusyChange}:{data:AppSnapshot;disabled:boolean;onBusyChange:(busy:boolean)=>void}) {- const confirm=useConfirmation();+function planStateLabel(state:ComponentUpdatePlan['items'][number]['state']):string {+ switch(state){+ case 'ready':return ui('updates.ready');case 'unchanged':return ui('updates.unchanged');+ case 'deferred':return ui('updates.deferred');case 'skipped':return ui('updates.skipped');+ }+}++type DiscoveryResult =+ | {status:'plan';plan:ComponentUpdatePlan}+ | {status:'blocked'}+ | {status:'stale'}+ | {status:'failed'};++/** Read-only discovery plus the explicit batch action for installed managed+ * components. Nothing is installed while rendering or while planning. */+export function useComponentUpdates({data,disabled,onBusyChange,confirm}:{data:AppSnapshot;disabled:boolean;onBusyChange:(busy:boolean)=>void;confirm:Confirm}) {const [local,setLocal]=useState<{scope:string;plan:ComponentUpdatePlan;result?:ComponentUpdateBatchResult}>();const [pending,setPending]=useState(false),[error,setError]=useState<{scope:string;text:string}>();// Component identities change during a successful batch. Main owns exact identity checks.@@ -28,46 +44,75 @@ export function ComponentUpdates({data,disabled,onBusyChange}:{data:AppSnapshot;const plan=local?.scope===scope?local.plan:visibleStatus?.plan;const result=local?.scope===scope?local.result:visibleStatus?.result;const applicable=result&&result.planId===plan?.id?result:undefined;+ const readyItems=!applicable&&plan?plan.items.filter(item=>item.state==='ready'):[];const running=pending||status?.running===true;const apiReady=typeof window!=='undefined'&&typeof window.launcher?.planComponentUpdates==='function'&&typeof window.launcher?.applyComponentUpdates==='function'&&typeof window.launcher?.retryComponentUpdate==='function';- async function perform(retryId?:string) {+ async function discover(): Promise<DiscoveryResult> {+ if(disabled||running||inFlight.current||!apiReady)return {status:'blocked'};+ const captured=scope;inFlight.current=true;setPending(true);setError(undefined);onBusyChange(true);+ try {+ const next=await window.launcher.planComponentUpdates();+ if(!mounted.current||live.current!==captured)return {status:'stale'};+ planScopes.current.set(next.id,captured);+ setLocal({scope:captured,plan:next});+ return {status:'plan',plan:next};+ }catch(reason){+ if(mounted.current&&live.current===captured){setError({scope:captured,text:reason instanceof Error?reason.message:String(reason)});return {status:'failed'};}+ return {status:'stale'};+ }+ finally{inFlight.current=false;if(mounted.current){setPending(false);onBusyChange(false);}}+ }+ async function apply() {if(disabled||running||inFlight.current||!apiReady)return;const captured=scope;inFlight.current=true;setPending(true);setError(undefined);onBusyChange(true);try {- if(retryId){- if(!plan||!applicable?.items.some(item=>item.id===retryId&&item.retryable))return;- const next=await window.launcher.retryComponentUpdate(plan.id,retryId);- if(mounted.current&&live.current===captured)setLocal({scope:captured,plan,result:next});- }else{+ let target=plan;+ if(!target||target.id===applicable?.planId||planScopes.current.get(target.id)!==captured) {const next=await window.launcher.planComponentUpdates();if(!mounted.current||live.current!==captured)return;planScopes.current.set(next.id,captured);setLocal({scope:captured,plan:next});- const ready=next.items.filter(item=>item.state==='ready');- if(!ready.length)return;- const summary=ready.map(item=>item.label+(item.targetVersion?' → '+item.targetVersion:'')).join('; ');- const accepted=await confirm({title:ui('updates.confirm_title'),message:ui('updates.confirm_help')+' '+summary,confirmLabel:ui('updates.apply')});- if(!accepted||!mounted.current||live.current!==captured)return;- const batch=await window.launcher.applyComponentUpdates(next.id);- if(mounted.current&&live.current===captured)setLocal({scope:captured,plan:next,result:batch});+ target=next;}+ const ready=target.items.filter(item=>item.state==='ready');+ if(!ready.length)return;+ const summary=ready.map(item=>item.label+(item.targetVersion?' \u2192 '+item.targetVersion:'')).join('; ');+ const accepted=await confirm({title:ui('updates.confirm_title'),message:ui('updates.confirm_help')+' '+summary,confirmLabel:ui('updates.apply')});+ if(!accepted||!mounted.current||live.current!==captured)return;+ const batch=await window.launcher.applyComponentUpdates(target.id);+ if(mounted.current&&live.current===captured)setLocal({scope:captured,plan:target,result:batch});+ }catch(reason){if(mounted.current&&live.current===captured)setError({scope:captured,text:reason instanceof Error?reason.message:String(reason)});}+ finally{inFlight.current=false;if(mounted.current){setPending(false);onBusyChange(false);}}+ }+ async function retry(itemId:string) {+ if(disabled||running||inFlight.current||!apiReady)return;+ if(!plan||!applicable?.items.some(item=>item.id===itemId&&item.retryable))return;+ const captured=scope;inFlight.current=true;setPending(true);setError(undefined);onBusyChange(true);+ try {+ const batch=await window.launcher.retryComponentUpdate(plan.id,itemId);+ if(mounted.current&&live.current===captured)setLocal({scope:captured,plan,result:batch});}catch(reason){if(mounted.current&&live.current===captured)setError({scope:captured,text:reason instanceof Error?reason.message:String(reason)});}finally{inFlight.current=false;if(mounted.current){setPending(false);onBusyChange(false);}}}- return <section className="settings-card component-updates" aria-label={ui('updates.title')}>- <h2>{ui('updates.title')}</h2><p>{ui('updates.help')}</p>- {status?.running&&status.phase?<p role="status">{status.phase}</p>:null}+ const action=readyItems.length>0+ ? <button className="primary" disabled={disabled||running||!apiReady} onClick={()=>void apply()}>{running?<LoaderCircle className="spin"/>:<ArrowDownToLine/>}{ui('updates.action')}</button>+ : undefined;+ const showPlan=Boolean(plan)&&(applicable!==undefined||readyItems.length===0);+ const phaseNotice=status?.running&&status.phase?status.phase:undefined;+ const hasDetails=Boolean(phaseNotice)||error?.scope===scope||showPlan||applicable?.restartRequired;+ const details=hasDetails?<div className="component-update-details">+ {phaseNotice?<p role="status" className="runtime-phase"><LoaderCircle className="spin"/><span>{phaseNotice}</span></p>:null}{error?.scope===scope?<p role="alert" className="alert amber">{error.text}</p>:null}- <button className="primary" disabled={disabled||running||!apiReady} onClick={()=>void perform()}>{running?<LoaderCircle className="spin"/>:<RefreshCw/>}{ui('updates.action')}</button>- {plan?<ul className="component-update-results" aria-label={ui('updates.results')}>+ {showPlan&&plan?<ul className="component-update-results" aria-label={ui('updates.results')}>{plan.items.map(item=>{const row=applicable?.items.find(result=>result.id===item.id);- const label=row?outcomeLabel(row.outcome):item.state==='ready'?ui('updates.ready'):item.state==='unchanged'?ui('updates.unchanged'):item.state==='deferred'?ui('updates.deferred'):ui('updates.skipped');- return <li key={item.id}><div><strong>{item.label}</strong><span>{label}</span>{item.currentVersion||item.targetVersion?<small>{item.currentVersion??'…'}{item.targetVersion?' → '+item.targetVersion:''}</small>:null}{row?.message||item.reason?<p>{row?.message??item.reason}</p>:null}</div>- {row?.retryable?<button className="secondary" disabled={disabled||running} onClick={()=>void perform(item.id)}>{ui('updates.retry',{name:item.label})}</button>:null}+ const label=row?outcomeLabel(row.outcome):planStateLabel(item.state);+ return <li key={item.id}><div><strong>{item.label}</strong><span>{label}</span>{item.currentVersion||item.targetVersion?<small>{item.currentVersion??'\u2026'}{item.targetVersion?' \u2192 '+item.targetVersion:''}</small>:null}{row?.message||item.reason?<p>{row?.message??item.reason}</p>:null}</div>+ {row?.retryable?<button className="secondary" disabled={disabled||running} onClick={()=>void retry(item.id)}>{ui('updates.retry',{name:item.label})}</button>:null}</li>;})}</ul>:null}{applicable?.restartRequired?<p role="status">{ui('updates.restart_help')}</p>:null}- </section>;+ </div>:undefined;+ return {action,details,discover};}diff --git a/src/renderer/ManagedRuntimeSettings.tsx b/src/renderer/ManagedRuntimeSettings.tsxindex 2bfba36..aaa36d8 100644--- a/src/renderer/ManagedRuntimeSettings.tsx+++ b/src/renderer/ManagedRuntimeSettings.tsx@@ -1,82 +1,82 @@import {useEffect,useRef,useState} from 'react';-import {ArrowDownToLine,RefreshCw,LoaderCircle} from 'lucide-react';+import {ArrowDownToLine,CircleAlert,Gamepad2,LoaderCircle,RefreshCw} from 'lucide-react';import type {AppSnapshot,ManagedFamilyStatus,ManagedRuntimeOptions} from '../shared/types';-import {runtimeFamilyLabels,type RuntimeFamily} from '../shared/runtime-selection';-import {CheckField} from './CheckField';+import type {RuntimeFamily} from '../shared/runtime-selection';+import {activeRuntimeIsCachyos,runtimeDisplay} from '../shared/runtime-display';+import {StatusDot} from './StatusDot';import {ui} from './i18n';-/** Explicit component operations only. Installing a family never selects it for a game. */+const family:RuntimeFamily='nexus-cachyos';+// A click on this card is the explicit opt-in for the optional family. Nothing+// is checked, installed or selected while rendering.+const options=(allowPrerelease:boolean):ManagedRuntimeOptions=>({allowCachyos:true,allowPrerelease});++/** Explicit optional CachyOS runtime operations. Installing never selects it for a game. */export function ManagedRuntimeSettings({data,disabled,onBusyChange}:{data:AppSnapshot;disabled:boolean;onBusyChange:(busy:boolean)=>void}) {- const [experimental,setExperimental]=useState(false),[allowCachyos,setAllowCachyos]=useState(false);- const [prerelease,setPrerelease]=useState<Partial<Record<RuntimeFamily,boolean>>>({});- const [local,setLocal]=useState<{scope:string;statuses:Partial<Record<RuntimeFamily,ManagedFamilyStatus>>}>();- const [invalidated,setInvalidated]=useState<Partial<Record<RuntimeFamily,boolean>>>({});- const [pending,setPending]=useState<RuntimeFamily>();+ const [local,setLocal]=useState<{scope:string;status:ManagedFamilyStatus}>();+ const [pending,setPending]=useState<'check'|'install'>();const [notice,setNotice]=useState<{scope:string;text:string;error:boolean}>();const scope=JSON.stringify([data.settings.runtimeRoot,data.backend.binaryPath,data.backend.commit,data.backend.version,data.launcherUpdate?.currentVersion]);const live=useRef(scope),inFlight=useRef(false),mounted=useRef(true);live.current=scope;useEffect(()=>{mounted.current=true;return()=>{mounted.current=false;};},[]);- useEffect(()=>{setAllowCachyos(false);setPrerelease({});setInvalidated({});setNotice(undefined);},[scope]);+ useEffect(()=>{setNotice(undefined);},[scope]);const statuses=(data.runtime.managedFamilies??[]);const snapshotKey=JSON.stringify(statuses);useEffect(()=>setLocal(undefined),[scope,snapshotKey]);- const status=(family:RuntimeFamily)=>local?.scope===scope&&local.statuses[family]||statuses.find(item=>item.id===family);- const cachyosInstalled=Boolean(status('nexus-cachyos')?.installed);+ const snapshot=statuses.find(item=>item.id===family);+ const item=local?.scope===scope?local.status:snapshot;+ const installed=Boolean(item?.installed);+ const available=item?.available;+ // The recorded installation channel is never reset by removing the discovery+ // control; uninstalled families only ever discover stable releases.+ const channel=item?.channel==='prerelease';+ // A verified default runtime of this family is reported truthfully, but it is+ // not a managed-family installation.+ const activeLocal=!installed&&activeRuntimeIsCachyos(data.runtime);+ const activeVersion=activeLocal?runtimeDisplay(data.runtime).version:'';const apiReady=typeof window!=='undefined'&&typeof window.launcher?.checkManagedRuntime==='function'&&typeof window.launcher?.installManagedRuntime==='function';- const active=disabled||Boolean(pending)||statuses.some(item=>item.checking||item.installing);- const channel=(family:RuntimeFamily)=>prerelease[family]??status(family)?.channel==='prerelease';- const options=(family:RuntimeFamily):ManagedRuntimeOptions=>({allowCachyos:family==='nexus-cachyos'&&(cachyosInstalled||allowCachyos),allowPrerelease:channel(family)});- async function perform(family:RuntimeFamily,install:boolean) {- if(active||inFlight.current||!apiReady||family==='nexus-cachyos'&&!cachyosInstalled&&!allowCachyos)return;- const candidate=status(family)?.available;+ // Another family may be checking or installing through its own surface; keep+ // this card idle instead of starting a competing managed runtime operation.+ const active=disabled||Boolean(pending)||statuses.some(status=>status.checking||status.installing);+ const busy=pending!==undefined||Boolean(item?.checking||item?.installing);+ async function perform(install:boolean) {+ if(active||inFlight.current||!apiReady)return;+ const candidate=item?.available;if(install&&!candidate)return;- const captured=scope;inFlight.current=true;setPending(family);setNotice(undefined);onBusyChange(true);+ const captured=scope;inFlight.current=true;setPending(install?'install':'check');setNotice(undefined);onBusyChange(true);try {if(install) {- const result=await window.launcher.installManagedRuntime(family,candidate!.candidateSha256,options(family));+ const result=await window.launcher.installManagedRuntime(family,candidate!.candidateSha256,options(channel));if(!mounted.current||live.current!==captured)return;const success=result.family===family&&result.success&&result.committed&&result.durability==='confirmed';- setNotice({scope:captured,error:!success,text:success?ui('runtime.families_installed'):result.error??(result.committed?ui('runtime.families_committed_attention'):ui('runtime.families_failed'))});+ setNotice({scope:captured,error:!success,text:success?ui('runtime.cachyos_installed'):result.error??(result.committed?ui('runtime.families_committed_attention'):ui('runtime.families_failed'))});// The next authoritative snapshot owns post-install identity and availability.setLocal(undefined);} else {- const result=await window.launcher.checkManagedRuntime(family,options(family));+ const result=await window.launcher.checkManagedRuntime(family,options(channel));if(!mounted.current||live.current!==captured)return;if(result.id!==family)throw Error(ui('runtime.families_failed'));- setInvalidated(current=>({...current,[family]:false}));- setLocal(current=>({scope:captured,statuses:{...(current?.scope===captured?current.statuses:{}),[family]:result}}));+ setLocal({scope:captured,status:result});}}catch(error){if(mounted.current&&live.current===captured)setNotice({scope:captured,error:true,text:error instanceof Error?error.message:String(error)});}finally{inFlight.current=false;if(mounted.current){setPending(undefined);onBusyChange(false);}}}- function changePrerelease(family:RuntimeFamily,value:boolean) {- setPrerelease(current=>({...current,[family]:value}));setInvalidated(current=>({...current,[family]:true}));- // Changing discovery policy invalidates a previously offered candidate.- setLocal(current=>({scope,statuses:{...(current?.scope===scope?current.statuses:{}),[family]:{...(status(family)??{id:family,checking:false,installing:false}),available:undefined}}}));- }- function row(family:RuntimeFamily) {- const item=status(family),installed=item?.installed,available=invalidated[family]?undefined:item?.available;- const busy=pending===family||item?.checking||item?.installing;- const allowed=family!=='nexus-cachyos'||cachyosInstalled||allowCachyos;- return <section className="managed-runtime-family" key={family} aria-label={runtimeFamilyLabels[family]}>- <h3>{runtimeFamilyLabels[family]}</h3>- <p>{installed?ui('runtime.families_version',{version:item?.version??installed.sourceCommit.slice(0,12)}):ui('runtime.families_not_installed')}</p>- {item?.phase?<p role="status">{item.phase}</p>:null}- {item?.error?<p className="alert amber" role="alert">{item.error}</p>:null}- {family==='nexus-cachyos'&&!installed?<CheckField label={ui('runtime.families_cachyos_optin')} checked={allowCachyos} disabled={active} onChange={event=>{setAllowCachyos(event.target.checked);setInvalidated(current=>({...current,'nexus-cachyos':true}));}}/>:null}- <CheckField label={ui('runtime.families_prerelease')} checked={channel(family)} disabled={active||!allowed} onChange={event=>changePrerelease(family,event.target.checked)}/>- {available&&item?.updateAvailable===false?<p role="status">{ui('runtime.families_current')}</p>:null}- {available&&item?.updateAvailable!==false?<p>{ui('runtime.families_available',{version:available.version})}<br/><small>{ui('runtime.families_requires',{backend:available.requiresBackendVersion,launcher:available.requiresLauncherVersion})}</small></p>:null}- <div className="button-row">- <button className="secondary" disabled={active||!apiReady||!allowed} onClick={()=>void perform(family,false)}>{busy?<LoaderCircle className="spin"/>:<RefreshCw/>}{ui('ui.check_for_updates_f26f327')}</button>- {available&&item?.updateAvailable!==false?<button className="primary" disabled={active||!apiReady||!allowed} onClick={()=>void perform(family,true)}><ArrowDownToLine/>{installed?ui('runtime.families_update',{name:runtimeFamilyLabels[family]}):ui('runtime.families_install',{name:runtimeFamilyLabels[family]})}</button>:null}- </div>- </section>;- }- return <section className="settings-card managed-runtime-settings" aria-label={ui('runtime.families_title')}>- <h2>{ui('runtime.families_title')}</h2><p>{ui('runtime.families_help')}</p>+ const version=item?.version??item?.installed?.sourceCommit.slice(0,12)??'';+ const summary=installed?ui('runtime.families_version',{version}):activeLocal?ui('runtime.cachyos_active',{version:activeVersion}):undefined;+ return <section className="settings-card managed-runtime-settings" aria-label={ui('runtime.cachyos_title')}>+ <div className="settings-heading">+ <div className="settings-icon"><Gamepad2 /></div>+ <div><h2>{ui('runtime.cachyos_title')}</h2>{summary?<p>{summary}</p>:null}</div>+ <span className={`status-label ${installed||activeLocal?'ready':'unknown'}`}><StatusDot tone={installed||activeLocal?'green':'amber'} />{installed?ui('ui.ready_c2e3ac4'):activeLocal?ui('runtime.cachyos_active_label'):ui('ui.not_installed_d177cdc')}</span>+ </div>{notice?.scope===scope?<p role={notice.error?'alert':'status'} className={notice.error?'alert amber':'runtime-phase'}>{notice.text}</p>:null}- {row('nexus')}- {experimental||cachyosInstalled?row('nexus-cachyos'):<button className="secondary" disabled={active} onClick={()=>setExperimental(true)}>{ui('runtime.families_show_cachyos')}</button>}+ {item?.error?<div className="alert amber" role="alert"><CircleAlert /><span>{item.error}</span></div>:null}+ {busy&&item?.phase?<div className="runtime-phase"><LoaderCircle className="spin" /><span>{item.phase}</span></div>:null}+ {available&&item?.updateAvailable===false?<p role="status">{ui('runtime.cachyos_current')}</p>:null}+ {available&&item?.updateAvailable!==false?<p>{ui('runtime.families_available',{version:available.version})}<br/><small>{ui('runtime.families_requires',{backend:available.requiresBackendVersion,launcher:available.requiresLauncherVersion})}</small></p>:null}+ <div className="button-row end">+ <button className="secondary" disabled={active||!apiReady} onClick={()=>void perform(false)}>{pending==='check'||pending===undefined&&item?.checking?<LoaderCircle className="spin" />:<RefreshCw />}{ui('ui.check_for_updates_f26f327')}</button>+ {available&&item?.updateAvailable!==false?<button className="primary" disabled={active||!apiReady} onClick={()=>void perform(true)}>{pending==='install'||pending===undefined&&item?.installing?<LoaderCircle className="spin" />:<ArrowDownToLine />}{installed?ui('runtime.families_update',{name:ui('runtime.cachyos_title')}):ui('runtime.families_install',{name:ui('runtime.cachyos_title')})}</button>:null}+ </div></section>;}diff --git a/src/renderer/StatusDot.tsx b/src/renderer/StatusDot.tsxnew file mode 100644index 0000000..5e2ac8c--- /dev/null+++ b/src/renderer/StatusDot.tsx@@ -0,0 +1,3 @@+export function StatusDot({ tone = 'green' }: { tone?: 'green' | 'amber' | 'red' }) {+ return <span className={`status-dot ${tone}`} />;+}diff --git a/src/renderer/component-updates.test.tsx b/src/renderer/component-updates.test.tsxindex dbe2b17..c640641 100644--- a/src/renderer/component-updates.test.tsx+++ b/src/renderer/component-updates.test.tsx@@ -2,47 +2,161 @@import {act} from 'react';import {createRoot,type Root} from 'react-dom/client';import {afterEach,beforeEach,expect,it,vi} from 'vitest';-import {ComponentUpdates} from './ComponentUpdates';import {ConfirmationProvider} from './Confirmation';+import {SettingsPage} from './App';import {demoSnapshot} from '../shared/demo-data';import type {ComponentUpdatePlan,ComponentUpdateBatchResult} from '../shared/types';-let root:Root,data:ReturnType<typeof demoSnapshot>,busy:ReturnType<typeof vi.fn>;-const plan:ComponentUpdatePlan={id:'opaque-plan',createdAt:'2026-11-03',items:[{id:'backend',component:'backend',label:'Nexus backend',currentVersion:'0.2.3',targetVersion:'0.2.4',state:'ready'},{id:'cachy',component:'runtime',label:'CachyOS',state:'skipped',reason:'Optional family is not installed'}]};-const result:ComponentUpdateBatchResult={planId:plan.id,items:[{id:'backend',outcome:'updated',committed:true,retryable:false},{id:'cachy',outcome:'skipped',committed:false,retryable:false}],restartRequired:false};-const render=async(disabled=false)=>act(async()=>root.render(<ConfirmationProvider><ComponentUpdates data={data} disabled={disabled} onBusyChange={busy}/></ConfirmationProvider>));-const button=(text:string)=>[...document.querySelectorAll<HTMLButtonElement>('button')].find(node=>node.textContent===text)!;-const click=async(node:Element)=>act(async()=>(node as HTMLElement).click());+let root:Root,data:ReturnType<typeof demoSnapshot>,toast:ReturnType<typeof vi.fn>;+const plan:ComponentUpdatePlan={id:'opaque-plan',createdAt:'2026-11-03',items:[{id:'backend',component:'backend',label:'Nexus backend',currentVersion:'0.2.3',targetVersion:'0.2.4',state:'ready'},{id:'cachy',component:'runtime',label:'CachyOS',state:'skipped',reason:'Optional family is not installed'},{id:'launcher',component:'launcher',label:'Launcher',currentVersion:'0.4.2',targetVersion:'0.5.0',state:'ready'}]};+const result:ComponentUpdateBatchResult={planId:plan.id,items:[{id:'backend',outcome:'updated',committed:true,retryable:false},{id:'cachy',outcome:'skipped',committed:false,retryable:false},{id:'launcher',outcome:'updated',committed:true,retryable:false}],restartRequired:false};+const render=async()=>act(async()=>root.render(<ConfirmationProvider><SettingsPage data={data} toast={toast}/></ConfirmationProvider>));+const launcher=()=>document.querySelector<HTMLElement>('.launcher-card')!;+const launcherButton=(label:string)=>[...launcher().querySelectorAll('button')].find(node=>node.textContent===label) as HTMLButtonElement|undefined;+const button=(label:string)=>[...document.querySelectorAll('button')].find(node=>node.textContent===label) as HTMLButtonElement|undefined;+const click=async(node:Element|undefined)=>{expect(node).toBeDefined();await act(async()=>(node as HTMLElement).click());};beforeEach(async()=>{- vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT',true);data=demoSnapshot();busy=vi.fn();window.launcher={planComponentUpdates:vi.fn(async()=>structuredClone(plan)),applyComponentUpdates:vi.fn(async()=>structuredClone(result)),retryComponentUpdate:vi.fn(async()=>structuredClone(result)),restartLauncher:vi.fn(async()=>{})} as unknown as Window['launcher'];document.body.innerHTML='<div id="root"></div>';root=createRoot(document.getElementById('root')!);await render();+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT',true);data=demoSnapshot();data.downloads=[];toast=vi.fn();+ window.launcher={+ planComponentUpdates:vi.fn(async()=>structuredClone(plan)),+ applyComponentUpdates:vi.fn(async()=>structuredClone(result)),+ retryComponentUpdate:vi.fn(async()=>structuredClone(result)),+ checkLauncherUpdate:vi.fn(async()=>{}),+ checkKeyring:vi.fn(async()=>({state:'ready'})),+ onOperationLog:vi.fn(()=>()=>{}),+ } as unknown as Window['launcher'];+ document.body.innerHTML='<div id="root"></div>';root=createRoot(document.getElementById('root')!);await render();});afterEach(async()=>{await act(async()=>root.unmount());vi.restoreAllMocks();vi.unstubAllGlobals();document.body.innerHTML='';});-it('does no discovery on mount and sends only opaque plan ID after explicit confirmation',async()=>{- expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();await click(button('Update all components'));expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.querySelector('[role="dialog"]')?.textContent).toContain('Nexus backend → 0.2.4');await click(button('Apply updates'));expect(window.launcher.applyComponentUpdates).toHaveBeenCalledWith('opaque-plan');expect(document.body.textContent).toContain('Optional family is not installed');expect(document.body.textContent).toContain('Updated');expect(window.launcher.restartLauncher).not.toHaveBeenCalled();expect(busy).toHaveBeenLastCalledWith(false);+it('removes the standalone component update card and discovers nothing on mount',()=>{+ expect(document.querySelector('.component-updates')).toBeNull();+ expect(document.body.textContent).not.toContain('Component updates');+ expect(launcherButton('Update all')).toBeUndefined();+ expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();});-it('cancelling confirmation never applies a plan or installs skipped optional components',async()=>{- await click(button('Update all components'));await click(button('Cancel'));expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.body.textContent).toContain('Skipped');+it('read-only Check discovers updates and reveals Update all beside it without installing',async()=>{+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ // The plan already runs launcher release discovery; no duplicate launcher check follows it.+ expect(window.launcher.checkLauncherUpdate).not.toHaveBeenCalled();+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();+ const row=launcher().querySelector('.button-row')!;+ const labels=[...row.querySelectorAll('button')].map(node=>node.textContent);+ expect(labels).toContain('Check for updates');expect(labels).toContain('Update all');+ await click(launcherButton('Update all'));+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();+ expect(document.querySelector('[role="dialog"]')?.textContent).toContain('Nexus backend → 0.2.4');+ await click(button('Apply updates'));+ expect(window.launcher.applyComponentUpdates).toHaveBeenCalledWith('opaque-plan');+ const results=launcher().querySelector('.component-update-results');+ expect(results).not.toBeNull();expect(results?.textContent).toContain('Updated');+ expect(results?.textContent).toContain('Optional family is not installed');+ expect(launcherButton('Update all')).toBeUndefined();+ expect(window.launcher.restartLauncher).toBeUndefined();});-it('offers targeted retry only for main-authorized retryable rows, preserving committed attention wording',async()=>{- data.componentUpdates={running:false,plan,result:{...result,items:[{id:'backend',outcome:'committed-needs-attention',committed:true,retryable:false,message:'Selection was published, confirmation failed'},{id:'cachy',outcome:'failed-before-commit',committed:false,retryable:true}]}};await render();expect(document.body.textContent).toContain('Activated, needs attention');expect(button('Retry Nexus backend')).toBeUndefined();await click(button('Retry CachyOS'));expect(window.launcher.retryComponentUpdate).toHaveBeenCalledWith(plan.id,'cachy');expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();+it('falls back to the launcher-only check only when the plan cannot cover the launcher',async()=>{+ vi.mocked(window.launcher.planComponentUpdates).mockResolvedValue({...structuredClone(plan),items:structuredClone(plan).items.map(item=>item.component==='launcher'?{...item,state:'skipped' as const,targetVersion:undefined,reason:'An installed writable AppImage is required.'}:{...item,state:'unchanged' as const,targetVersion:undefined})});+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ expect(window.launcher.checkLauncherUpdate).toHaveBeenCalledOnce();+ expect(launcherButton('Update all')).toBeUndefined();+ expect(launcher().querySelector('.component-update-results')?.textContent).toContain('An installed writable AppImage is required.');});-it('shows explicit restart guidance last without automatically restarting',async()=>{- data.componentUpdates={running:false,plan,result:{...result,restartRequired:true}};await render();expect(document.body.textContent).toContain('No restart happens automatically');expect(window.launcher.restartLauncher).not.toHaveBeenCalled();+it('cancelling confirmation never applies the plan',async()=>{+ await click(launcherButton('Check for updates'));+ await click(launcherButton('Update all'));+ await click(button('Cancel'));+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();});-it('shows no-update and deferred plans without unnecessary apply or confirmation',async()=>{- vi.mocked(window.launcher.planComponentUpdates).mockResolvedValue({...plan,items:plan.items.map(item=>({...item,state:'deferred',reason:'Update launcher then restart first'}))});await click(button('Update all components'));expect(document.querySelector('[role="dialog"]')).toBeNull();expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.body.textContent).toContain('Deferred');+it('shows deferred or already-current plans inline without an Update all action',async()=>{+ vi.mocked(window.launcher.planComponentUpdates).mockResolvedValue({...plan,items:plan.items.map(item=>({...item,state:'deferred' as const,reason:'Update launcher then restart first'}))});+ await click(launcherButton('Check for updates'));+ expect(launcherButton('Update all')).toBeUndefined();+ expect(document.querySelector('[role="dialog"]')).toBeNull();+ expect(launcher().querySelector('.component-update-results')?.textContent).toContain('Update launcher then restart first');});-it('blocks duplicate requests and other-activity admission while exposing main progress',async()=>{- await render(true);await click(button('Update all components'));expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();await render();let done!:(value:ComponentUpdatePlan)=>void;vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));await click(button('Update all components'));expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();await act(async()=>done({...plan,items:[]}));data.componentUpdates={running:true,phase:'Verifying runtime',plan};await render();expect(button('Update all components').disabled).toBe(true);expect(document.querySelector('[role="status"]')?.textContent).toBe('Verifying runtime');+it('offers targeted retry only for main-authorized retryable rows and keeps committed attention wording',async()=>{+ data.componentUpdates={running:false,plan,result:{...result,items:[{id:'backend',outcome:'committed-needs-attention',committed:true,retryable:false,message:'Selection was published, confirmation failed'},{id:'cachy',outcome:'failed-before-commit',committed:false,retryable:true}]}};+ await render();+ expect(launcher().textContent).toContain('Activated, needs attention');+ expect(button('Retry Nexus backend')).toBeUndefined();+ await click(button('Retry CachyOS'));+ expect(window.launcher.retryComponentUpdate).toHaveBeenCalledWith(plan.id,'cachy');+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();});-it('discards an old-account plan while pending and never applies it',async()=>{- let done!:(value:ComponentUpdatePlan)=>void;vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));data={...data,auth:{...data.auth,username:'[email protected]'}};await render();await act(async()=>done(plan));expect(document.querySelector('[role="dialog"]')).toBeNull();expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(busy).toHaveBeenLastCalledWith(false);+it('shows explicit restart guidance last and never restarts automatically',async()=>{+ data.componentUpdates={running:false,plan,result:{...result,restartRequired:true}};+ await render();+ expect(launcher().textContent).toContain('No restart happens automatically');+ expect(window.launcher.restartLauncher).toBeUndefined();});-it('retains the completed result after its own backend update changes the binary path',async()=>{- let done!:(value:ComponentUpdateBatchResult)=>void;vi.mocked(window.launcher.applyComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));await click(button('Apply updates'));data={...data,backend:{...data.backend,binaryPath:'/new/backend',version:'0.2.4'}};await render();await act(async()=>done(result));expect(document.body.textContent).toContain('Updated');+it('blocks discovery during other activity and never overlaps held requests',async()=>{+ data.auth={...data.auth,running:true};await render();+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();+ data.auth={...data.auth,running:false};await render();+ let done!:(value:ComponentUpdatePlan)=>void;+ vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));+ await click(launcherButton('Check for updates'));await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ await act(async()=>done(structuredClone(plan)));+ data.componentUpdates={running:true,phase:'Verifying runtime',plan};+ await render();+ expect(launcherButton('Update all')?.disabled).toBe(true);+ expect(launcher().querySelector('[role="status"]')?.textContent).toBe('Verifying runtime');});--it.each(['account','root'])('hides an existing snapshot plan/result and retry when %s changes without a new snapshot status',async change=>{- data.componentUpdates={running:false,plan,result:{...result,items:[{id:'backend',outcome:'failed-before-commit',committed:false,retryable:true,message:'Old-context failure'}]}};await render();expect(button('Retry Nexus backend')).toBeDefined();- if(change==='account')data={...data,auth:{...data.auth,username:'[email protected]'}};else data={...data,settings:{...data.settings,runtimeRoot:'/different/runtime'}};- await render();expect(button('Retry Nexus backend')).toBeUndefined();expect(document.querySelector('.component-update-results')).toBeNull();expect(document.body.textContent).not.toContain('Old-context failure');expect(window.launcher.retryComponentUpdate).not.toHaveBeenCalled();+it('does not start the launcher fallback when discovery is blocked by other activity',async()=>{+ data.auth={...data.auth,running:true};await render();+ expect(launcherButton('Check for updates')?.disabled).toBe(true);+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();+ expect(window.launcher.checkLauncherUpdate).not.toHaveBeenCalled();+});+it('ignores a duplicate Check while planning without releasing the shared busy state',async()=>{+ let done!:(value:ComponentUpdatePlan)=>void;+ vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ expect(launcherButton('Check for updates')?.disabled).toBe(true);+ expect(launcherButton('Add Nexus Launcher to Steam')?.disabled).toBe(true);+ await click(launcherButton('Check for updates'));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ expect(window.launcher.checkLauncherUpdate).not.toHaveBeenCalled();+ await act(async()=>done(structuredClone(plan)));+ expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();+ expect(window.launcher.checkLauncherUpdate).not.toHaveBeenCalled();+ expect(launcherButton('Check for updates')?.disabled).toBe(false);+ expect(launcherButton('Add Nexus Launcher to Steam')?.disabled).toBe(false);+});+it('discards an old-account plan instead of applying it',async()=>{+ let done!:(value:ComponentUpdatePlan)=>void;+ vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));+ await click(launcherButton('Check for updates'));+ data={...data,auth:{...data.auth,username:'[email protected]'}};+ await render();+ await act(async()=>done(structuredClone(plan)));+ expect(document.querySelector('[role="dialog"]')).toBeNull();+ expect(launcherButton('Update all')).toBeUndefined();+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();+});+it('retains a completed result after the backend identity changes but hides it after account changes',async()=>{+ let done!:(value:ComponentUpdateBatchResult)=>void;+ vi.mocked(window.launcher.applyComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));+ await click(launcherButton('Check for updates'));await click(launcherButton('Update all'));await click(button('Apply updates'));+ data={...data,backend:{...data.backend,binaryPath:'/new/backend',version:'0.2.4'}};+ await render();+ await act(async()=>done(structuredClone(result)));+ expect(launcher().textContent).toContain('Updated');+ data={...data,auth:{...data.auth,username:'[email protected]'}};+ await render();+ expect(launcher().querySelector('.component-update-results')).toBeNull();+});+it('falls back exactly once when real discovery fails and keeps the error visible',async()=>{+ vi.mocked(window.launcher.planComponentUpdates).mockRejectedValue(Error('Update plan could not be prepared.'));+ await click(launcherButton('Check for updates'));+ expect(launcher().querySelector('[role="alert"]')?.textContent).toContain('Update plan could not be prepared.');+ expect(window.launcher.checkLauncherUpdate).toHaveBeenCalledOnce();+ expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();+ expect(launcherButton('Check for updates')?.disabled).toBe(false);+ expect(data.componentUpdates?.running).not.toBe(true);});diff --git a/src/renderer/game-runtime-fields.test.tsx b/src/renderer/game-runtime-fields.test.tsxindex 87ae54f..e321285 100644--- a/src/renderer/game-runtime-fields.test.tsx+++ b/src/renderer/game-runtime-fields.test.tsx@@ -8,8 +8,8 @@ it('offers only default when no verified variants are installed, never an unbuilexpect(html.match(/<option/g)).toHaveLength(1);expect(html).not.toContain('CachyOS');expect(html).toContain('Use default runtime');});it('lists verified families with explicit separate-prefix acknowledgment and save warning',()=>{- const html=renderToStaticMarkup(<GameRuntimeFields value="nexus-cachyos" separate={false} installed={[{id:'nexus-cachyos',label:'Nexus Runtime (CachyOS, experimental)',buildId:'a'.repeat(64),sourceCommit:'b'.repeat(40),manifestSha256:'c'.repeat(64)}]} change={change} changeSeparate={change}/>);- expect(html).toContain('experimental');expect(html).toMatch(/type="checkbox" required/);expect(html).toContain('class="check-input"');const help=html.match(/aria-describedby="([^"]+)"/)?.[1];expect(help).toBeTruthy();expect(html).toContain('<small id="'+help+'">');expect(html).toContain('Existing local saves stay in the old prefix');expect(html).toContain('Updates within this family reuse the same prefix and local saves');expect(html).not.toContain('each runtime build');expect(html).not.toContain('this runtime build');expect(html).not.toContain('checked=""');+ const html=renderToStaticMarkup(<GameRuntimeFields value="nexus-cachyos" separate={false} installed={[{id:'nexus-cachyos',label:'CachyOS',buildId:'a'.repeat(64),sourceCommit:'b'.repeat(40),manifestSha256:'c'.repeat(64)}]} change={change} changeSeparate={change}/>);+ expect(html).toContain('CachyOS');expect(html).toMatch(/type="checkbox" required/);expect(html).toContain('class="check-input"');const help=html.match(/aria-describedby="([^"]+)"/)?.[1];expect(help).toBeTruthy();expect(html).toContain('<small id="'+help+'">');expect(html).toContain('Existing local saves stay in the old prefix');expect(html).toContain('Updates within this family reuse the same prefix and local saves');expect(html).not.toContain('each runtime build');expect(html).not.toContain('this runtime build');expect(html).not.toContain('checked=""');});it('shows a missing persisted selection as disabled rather than falling back',()=>{const html=renderToStaticMarkup(<GameRuntimeFields value="nexus-cachyos" separate installed={[]} change={change} changeSeparate={change}/>);diff --git a/src/renderer/game-runtime-settings.test.tsx b/src/renderer/game-runtime-settings.test.tsxindex a19c73a..ee27aa1 100644--- a/src/renderer/game-runtime-settings.test.tsx+++ b/src/renderer/game-runtime-settings.test.tsx@@ -10,7 +10,7 @@ const family='nexus-cachyos';const a={buildId:'a'.repeat(64),manifestSha256:'b'.repeat(64),sourceCommit:'c'.repeat(40)};const b={buildId:'d'.repeat(64),manifestSha256:'e'.repeat(64),sourceCommit:'f'.repeat(40)};const c={buildId:'1'.repeat(64),manifestSha256:'2'.repeat(64),sourceCommit:'3'.repeat(40)};-const installed=(build:typeof a):InstalledRuntimeFamily=>({id:family,label:'Nexus Runtime (CachyOS, experimental)',...build});+const installed=(build:typeof a):InstalledRuntimeFamily=>({id:family,label:'CachyOS',...build});const render=async()=>{await act(async()=>root.render(<LibraryPage data={data} toast={()=>{}}/>));};const click=async(element:Element)=>{await act(async()=>(element as HTMLElement).click());};async function openSettings() {diff --git a/src/renderer/maintenance.test.tsx b/src/renderer/maintenance.test.tsxindex 9f748b4..0cd98b6 100644--- a/src/renderer/maintenance.test.tsx+++ b/src/renderer/maintenance.test.tsx@@ -49,6 +49,19 @@ it.each([}expect(html).toContain('Xodus ready');});+it('never advertises the Standard runtime release in the top notice while a CachyOS runtime is active', () => {+ const data = demoSnapshot();+ data.runtime = { ...data.runtime, installed: true,+ name: 'nexus-runtime-cachyos-11.0-experimental-ge36f73cb-local',+ nexusAvailable: true, nexusVersion: 'runtime-11.0-new', nexusName: 'nexus-runtime-11.0-new-x86_64.tar.xz' };+ const cachy = renderToStaticMarkup(<TopStatus data={data} go={() => {}} />);+ expect(cachy).not.toContain('update-notice');+ expect(cachy).not.toContain('Runtime 11.0-new');+ data.runtime = { ...data.runtime, name: 'nexus-runtime-11.0-experimental-g5910703e-local' };+ const standard = renderToStaticMarkup(<TopStatus data={data} go={() => {}} />);+ expect(standard).toContain('update-notice');+ expect(standard).toContain('Runtime 11.0-new');+});it('does not advertise failed, incomplete or already installed component releases', () => {const data = demoSnapshot();data.backend.releaseAvailable = false; data.backend.updateAvailable = true;diff --git a/src/renderer/managed-runtime-settings.test.tsx b/src/renderer/managed-runtime-settings.test.tsxindex 90503d2..9d1e51a 100644--- a/src/renderer/managed-runtime-settings.test.tsx+++ b/src/renderer/managed-runtime-settings.test.tsx@@ -4,58 +4,101 @@ import {createRoot,type Root} from 'react-dom/client';import {afterEach,beforeEach,expect,it,vi} from 'vitest';import {ManagedRuntimeSettings} from './ManagedRuntimeSettings';import {demoSnapshot} from '../shared/demo-data';-import type {ManagedFamilyStatus} from '../shared/types';+import type {ManagedFamilyStatus,ManagedFamilyInstallResult} from '../shared/types';let root:Root,data:ReturnType<typeof demoSnapshot>,busy:ReturnType<typeof vi.fn>;-const offer={version:'runtime-11.0',candidateSha256:'a'.repeat(64),sourceCommit:'b'.repeat(40),archiveName:'nexus-runtime.tar.xz',requiresBackendVersion:'0.2.3',requiresLauncherVersion:'0.5.0'};-const available=(id:'nexus'|'nexus-cachyos'='nexus'):ManagedFamilyStatus=>({id,checking:false,installing:false,available:offer,updateAvailable:true});+const offer={version:'runtime-cachyos-11.0',candidateSha256:'a'.repeat(64),sourceCommit:'b'.repeat(40),archiveName:'nexus-runtime-cachyos-x86_64.tar.xz',requiresBackendVersion:'0.2.3',requiresLauncherVersion:'0.5.0'};+const build={id:'nexus-cachyos' as const,label:'CachyOS',buildId:'c'.repeat(64),manifestSha256:'d'.repeat(64),sourceCommit:'e'.repeat(40)};+const available=():ManagedFamilyStatus=>({id:'nexus-cachyos',checking:false,installing:false,available:offer,updateAvailable:true});+const installed=(channel:'stable'|'prerelease'='stable',updateAvailable=false):ManagedFamilyStatus=>({...available(),installed:build,version:'runtime-cachyos-10.0',channel,updateAvailable});+const standard:ManagedFamilyStatus={id:'nexus',checking:false,installing:false,installed:{...build,id:'nexus',label:'Standard'},version:'runtime-10.0',channel:'stable',updateAvailable:false};+const activeCachy={...demoSnapshot().runtime,installed:true,name:'nexus-runtime-cachyos-11.0-experimental-ge36f73cb-local',winePath:'/local/cachyos/files/bin/wine',commit:'runtime-cachyos-11.0-experimental-ge36f73cb-local'};const render=async(disabled=false)=>act(async()=>root.render(<ManagedRuntimeSettings data={data} disabled={disabled} onBusyChange={busy}/>));-const click=async(node:Element)=>act(async()=>(node as HTMLElement).click());-const button=(text:string)=>[...document.querySelectorAll('button')].find(node=>node.textContent===text)!;-const checkbox=(text:string)=>[...document.querySelectorAll('label')].find(node=>node.textContent?.includes(text))!.querySelector('input')!;+const text=()=>document.body.textContent??'';+const card=()=>document.querySelector<HTMLElement>('section.settings-card.managed-runtime-settings')!;+const button=(label:string)=>[...document.querySelectorAll('button')].find(node=>node.textContent===label) as HTMLButtonElement|undefined;+const click=async(node:Element|undefined)=>{expect(node).toBeDefined();await act(async()=>(node as HTMLElement).click());};+const alerts=()=>[...document.querySelectorAll('[role="alert"]')].map(node=>node.textContent??'').join(' ');beforeEach(async()=>{vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT',true);data=demoSnapshot();data.runtime.managedFamilies=[];busy=vi.fn();- window.launcher={checkManagedRuntime:vi.fn(async()=>available()),installManagedRuntime:vi.fn(async()=>({family:'nexus',success:true,committed:true,durability:'confirmed'}))} as unknown as Window['launcher'];+ window.launcher={checkManagedRuntime:vi.fn(async()=>available()),installManagedRuntime:vi.fn(async():Promise<ManagedFamilyInstallResult>=>({family:'nexus-cachyos',success:true,committed:true,durability:'confirmed'}))} as unknown as Window['launcher'];document.body.innerHTML='<div id="root"></div>';root=createRoot(document.getElementById('root')!);await render();});afterEach(async()=>{await act(async()=>root.unmount());vi.restoreAllMocks();vi.unstubAllGlobals();document.body.innerHTML='';});-it('starts simple and performs no discovery or optional installation on render',()=>{- expect(document.querySelectorAll('.managed-runtime-family')).toHaveLength(1);expect(document.body.textContent).toContain('Not installed');expect(window.launcher.checkManagedRuntime).not.toHaveBeenCalled();expect(window.launcher.installManagedRuntime).not.toHaveBeenCalled();expect(document.body.textContent).toContain('default Wine / Proton selection unchanged');+it('renders one concise CachyOS card with no experimental text, prerelease control or help paragraph',()=>{+ expect(document.querySelectorAll('section.settings-card.managed-runtime-settings')).toHaveLength(1);+ expect(document.querySelectorAll('h3,.managed-runtime-family,input[type="checkbox"]')).toHaveLength(0);+ expect([...document.querySelectorAll('h2')].map(node=>node.textContent)).toEqual(['CachyOS runtime']);+ expect(text().toLowerCase()).not.toContain('experimental');+ expect(card().querySelector('.status-label.unknown')?.textContent).toContain('Not installed');+ expect(button('Install CachyOS runtime')).toBeUndefined();+ expect(window.launcher.checkManagedRuntime).not.toHaveBeenCalled();expect(window.launcher.installManagedRuntime).not.toHaveBeenCalled();});-it('checks Standard explicitly then installs the exact captured candidate without selecting games',async()=>{- await click(button('Check for updates'));expect(window.launcher.checkManagedRuntime).toHaveBeenCalledWith('nexus',{allowCachyos:false,allowPrerelease:false});expect(document.body.textContent).toContain(offer.version);- await click(button('Install Nexus Runtime'));expect(window.launcher.installManagedRuntime).toHaveBeenCalledWith('nexus',offer.candidateSha256,{allowCachyos:false,allowPrerelease:false});expect(document.querySelector('[role="status"]')?.textContent).toContain('Game family choices and local saves were kept');expect(busy.mock.calls).toEqual([[true],[false],[true],[false]]);+it('never infers an installed family from a Standard snapshot or an unrelated default runtime',async()=>{+ data.runtime.managedFamilies=[standard];await render();+ expect(text()).toContain('Not installed');expect(text()).not.toContain('Installed: runtime-10.0');+ expect(button('Install CachyOS runtime')).toBeUndefined();});-it('requires distinct CachyOS and prerelease opt-ins for both API actions',async()=>{- await click(button('Show experimental CachyOS runtime'));const row=document.querySelector('[aria-label="Nexus Runtime (CachyOS, experimental)"]')!;const check=row.querySelector('button')!;expect(check.disabled).toBe(true);- await click(checkbox('Allow this optional'));vi.mocked(window.launcher.checkManagedRuntime).mockResolvedValue(available('nexus-cachyos'));- const prerelease=[...row.querySelectorAll('input')][1];await click(prerelease);await click(check);- expect(window.launcher.checkManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',{allowCachyos:true,allowPrerelease:true});- vi.mocked(window.launcher.installManagedRuntime).mockResolvedValue({family:'nexus-cachyos',success:true,committed:true,durability:'confirmed'});await click(row.querySelector('button.primary')!);expect(window.launcher.installManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',offer.candidateSha256,{allowCachyos:true,allowPrerelease:true});+it('checks explicitly and installs the exact captured candidate',async()=>{+ await click(button('Check for updates'));+ expect(window.launcher.checkManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',{allowCachyos:true,allowPrerelease:false});+ expect(text()).toContain('Available: runtime-cachyos-11.0');expect(text()).toContain('Requires backend 0.2.3 and launcher 0.5.0 or newer.');+ await click(button('Install CachyOS runtime'));+ expect(window.launcher.installManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',offer.candidateSha256,{allowCachyos:true,allowPrerelease:false});+ expect(document.querySelector('[role="status"]')?.textContent).toContain('CachyOS runtime installed. The default runtime, game runtime choices, prefixes and local saves are unchanged.');+ expect(busy.mock.calls).toEqual([[true],[false],[true],[false]]);});-it('reports a committed uncertain result as attention, never success or old-runtime-kept',async()=>{- data.runtime.managedFamilies=[available()];await render();vi.mocked(window.launcher.installManagedRuntime).mockResolvedValue({family:'nexus',success:false,committed:true,durability:'unknown'});- await click(button('Install Nexus Runtime'));expect(document.querySelector('[role="alert"]')?.textContent).toContain('runtime was activated');expect(document.body.textContent).not.toContain('Runtime family installed.');expect(document.body.textContent).not.toContain('previous runtime was kept');+it('shows a managed installation with its version and keeps its recorded prerelease channel without a toggle',async()=>{+ data.runtime.managedFamilies=[installed('prerelease',true)];await render();+ expect(text()).toContain('Installed: runtime-cachyos-10.0');expect(text()).toContain('READY');+ expect(card().querySelector('.status-label.ready')).not.toBeNull();expect(document.querySelector('input[type="checkbox"]')).toBeNull();+ await click(button('Update CachyOS runtime'));+ expect(window.launcher.installManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',offer.candidateSha256,{allowCachyos:true,allowPrerelease:true});});-it('discards a held old-root discovery response and releases local busy state',async()=>{- let resolve!:(value:ManagedFamilyStatus)=>void;vi.mocked(window.launcher.checkManagedRuntime).mockReturnValue(new Promise(done=>resolve=done));await click(button('Check for updates'));- data={...data,settings:{...data.settings,runtimeRoot:'/new/root'}};await render();await act(async()=>resolve(available()));expect(button('Install Nexus Runtime')).toBeUndefined();expect(busy).toHaveBeenLastCalledWith(false);+it('reports an active local CachyOS default runtime truthfully without claiming a managed installation',async()=>{+ data.runtime=activeCachy;await render();+ expect(text()).toContain('ACTIVE');expect(text()).toContain('Active local build: cachyos-11.0-experimental-ge36f73cb-local');+ expect(text()).not.toContain('Installed:');expect(card().querySelector('.status-label.ready')).not.toBeNull();+ expect(button('Install CachyOS runtime')).toBeUndefined();+ await click(button('Check for updates'));+ expect(window.launcher.checkManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',{allowCachyos:true,allowPrerelease:false});});-it('invalidates offered prerelease-policy candidates until a new explicit check',async()=>{- await click(button('Check for updates'));expect(button('Install Nexus Runtime')).toBeDefined();await click(checkbox('Include prereleases'));expect(button('Install Nexus Runtime')).toBeUndefined();expect(window.launcher.installManagedRuntime).not.toHaveBeenCalled();await click(button('Check for updates'));expect(button('Install Nexus Runtime')).toBeDefined();+it('does not claim an active local CachyOS runtime when the default runtime is something else',async()=>{+ data.runtime={...activeCachy,name:'nexus-runtime-11.0-experimental-g5910703e-local'};await render();+ expect(text()).not.toContain('ACTIVE');expect(text()).toContain('Not installed');});-it('shows installed optional families with their recorded channel and no fresh installation opt-in',async()=>{- data.runtime.managedFamilies=[{...available('nexus-cachyos'),installed:{id:'nexus-cachyos',label:'CachyOS',buildId:'c'.repeat(64),manifestSha256:'d'.repeat(64),sourceCommit:'e'.repeat(40)},version:'installed-v1',channel:'prerelease',updateAvailable:false}];await render();- expect(document.querySelectorAll('.managed-runtime-family')).toHaveLength(2);expect(document.body.textContent).not.toContain('Allow this optional');expect(checkbox('Include prereleases').checked).toBe(false);expect(document.querySelector<HTMLInputElement>('[aria-label="Nexus Runtime (CachyOS, experimental)"] input')?.checked).toBe(true);expect(document.body.textContent).toContain('Installed: installed-v1');expect(document.body.textContent).toContain('up to date');expect(button('Update Nexus Runtime (CachyOS, experimental)')).toBeUndefined();expect(window.launcher.checkManagedRuntime).not.toHaveBeenCalled();+it('reports a committed uncertain install as attention instead of success',async()=>{+ data.runtime.managedFamilies=[available()];await render();+ vi.mocked(window.launcher.installManagedRuntime).mockResolvedValue({family:'nexus-cachyos',success:false,committed:true,durability:'unknown'});+ await click(button('Install CachyOS runtime'));+ expect(alerts()).toContain('runtime was activated');expect(text()).not.toContain('CachyOS runtime installed.');+ expect(text()).not.toContain('previous runtime was kept');});-it('blocks controls during other activity and prevents duplicate held requests',async()=>{- await render(true);expect(button('Check for updates').disabled).toBe(true);await click(button('Check for updates'));expect(window.launcher.checkManagedRuntime).not.toHaveBeenCalled();await render();let resolve!:(value:ManagedFamilyStatus)=>void;vi.mocked(window.launcher.checkManagedRuntime).mockReturnValue(new Promise(done=>resolve=done));await click(button('Check for updates'));await click(button('Check for updates'));expect(window.launcher.checkManagedRuntime).toHaveBeenCalledOnce();await act(async()=>resolve(available()));+it('surfaces status and request failures as actionable alerts',async()=>{+ data.runtime.managedFamilies=[{...available(),error:'Backend 0.3.0 or newer is required'}];await render();+ expect(alerts()).toContain('Backend 0.3.0 or newer is required');+ vi.mocked(window.launcher.checkManagedRuntime).mockRejectedValue(Error('Runtime release discovery is unavailable.'));+ await click(button('Check for updates'));+ expect(alerts()).toContain('Runtime release discovery is unavailable.');});--it('reuses installed CachyOS opt-in and prerelease channel for an ordinary update',async()=>{- data.runtime.managedFamilies=[{...available('nexus-cachyos'),installed:{id:'nexus-cachyos',label:'CachyOS',buildId:'c'.repeat(64),manifestSha256:'d'.repeat(64),sourceCommit:'e'.repeat(40)},channel:'prerelease'}];await render();- vi.mocked(window.launcher.installManagedRuntime).mockResolvedValue({family:'nexus-cachyos',success:true,committed:true,durability:'confirmed'});await click(button('Update Nexus Runtime (CachyOS, experimental)'));expect(window.launcher.installManagedRuntime).toHaveBeenCalledWith('nexus-cachyos',offer.candidateSha256,{allowCachyos:true,allowPrerelease:true});+it('discards a held old-root discovery response and releases local busy state',async()=>{+ let resolve!:(value:ManagedFamilyStatus)=>void;vi.mocked(window.launcher.checkManagedRuntime).mockReturnValue(new Promise(done=>resolve=done));+ await click(button('Check for updates'));+ data={...data,settings:{...data.settings,runtimeRoot:'/new/root'}};await render();await act(async()=>resolve(available()));+ expect(button('Install CachyOS runtime')).toBeUndefined();expect(busy).toHaveBeenLastCalledWith(false);+});+it('blocks controls during other activity and prevents duplicate held requests',async()=>{+ await render(true);expect(button('Check for updates')!.disabled).toBe(true);+ await click(button('Check for updates'));expect(window.launcher.checkManagedRuntime).not.toHaveBeenCalled();+ data.runtime.managedFamilies=[{...standard,checking:true}];await render();+ expect(button('Check for updates')!.disabled).toBe(true);+ data.runtime.managedFamilies=[];await render();let resolve!:(value:ManagedFamilyStatus)=>void;+ vi.mocked(window.launcher.checkManagedRuntime).mockReturnValue(new Promise(done=>resolve=done));+ await click(button('Check for updates'));await click(button('Check for updates'));+ expect(window.launcher.checkManagedRuntime).toHaveBeenCalledOnce();await act(async()=>resolve(available()));});--it('uses a later authoritative snapshot instead of retaining a stale locally checked offer',async()=>{- await click(button('Check for updates'));expect(button('Install Nexus Runtime')).toBeDefined();data.runtime.managedFamilies=[{...available(),installed:{id:'nexus',label:'Nexus',buildId:'c'.repeat(64),manifestSha256:'d'.repeat(64),sourceCommit:offer.sourceCommit},updateAvailable:false}];await render();expect(button('Install Nexus Runtime')).toBeUndefined();expect(document.body.textContent).toContain('up to date');+it('shows the current candidate and uses a later authoritative snapshot instead of a stale local offer',async()=>{+ await click(button('Check for updates'));expect(button('Install CachyOS runtime')).toBeDefined();+ data.runtime.managedFamilies=[installed()];await render();+ expect(button('Install CachyOS runtime')).toBeUndefined();+ expect(text()).toContain('Installed: runtime-cachyos-10.0');expect(text()).toContain('This runtime is up to date.');});diff --git a/src/renderer/settings.test.tsx b/src/renderer/settings.test.tsxindex 1ad3898..d961694 100644--- a/src/renderer/settings.test.tsx+++ b/src/renderer/settings.test.tsx@@ -86,3 +86,24 @@ it('shows close-to-tray as an optional desktop preference',()=>{expect(html).toContain('Close to system tray');expect(html).toContain('Desktop mode only.');expect(html).toMatch(/type="checkbox"[^>]*checked=""/);});++it('does not offer the Standard runtime installer while the active default runtime is CachyOS', () => {+ const data = demoSnapshot();+ data.runtime = { ...data.runtime, installed: true, name: 'nexus-runtime-cachyos-11.0-experimental-ge36f73cb-local', winePath: '/local/cachyos/files/bin/wine', commit: 'runtime-cachyos-local', nexusAvailable: true, nexusName: 'nexus-runtime-99.0-x86_64.tar.xz' };+ const html = renderToStaticMarkup(<SettingsPage data={data} toast={() => {}} />);+ expect(html).not.toContain('Install Nexus runtime');+ expect(html).toContain('CachyOS runtime');+ data.runtime = { ...data.runtime, name: 'nexus-runtime-11.0-experimental-g5910703e-local' };+ const standard = renderToStaticMarkup(<SettingsPage data={data} toast={() => {}} />);+ expect(standard).toContain('Install Nexus runtime');+});++it('separates the multiple-account toggle from the sign-in action row', () => {+ const data = demoSnapshot();+ data.backend.capabilities.savedAccounts = true;+ data.auth.savedAccountsEnabled = true;+ data.settings.multiAccountEnabled = true;+ const html = renderToStaticMarkup(<SettingsPage data={data} toast={() => {}} />);+ expect(html).toContain('class="button-row account-management-row"');+ expect(html).toContain('Hide account management');+});diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex d98bc69..8baf479 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -456,6 +456,7 @@ button.primary svg, button.secondary svg { width: 17px; height: 17px; }.diagnostic-path { overflow-wrap: anywhere; color: var(--muted); font-size: 10px; }.launcher-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap; }.launcher-card .settings-heading { margin: 0; }+.launcher-card .component-update-details { flex: 1 1 100%; min-width: 0; }.button-row a.primary { display: inline-flex; align-items: center; gap: 8px; padding: 0 17px; min-height: 39px; border-radius: 3px; background: #388e35; color: #fff; border: 1px solid transparent; font-size: 12px; font-weight: 650; text-decoration: none; }.button-row a.primary:hover { background: var(--green-hover); }.button-row a.primary svg { width: 17px; height: 17px; }@@ -498,6 +499,7 @@ button.primary svg, button.secondary svg { width: 17px; height: 17px; }.account-note { display: flex; gap: 8px; padding: 12px; margin-bottom: 15px; background: #292c30; color: #c8cbd0; font-size: 9px; line-height: 1.5; }.account-note svg { width: 16px; flex: 0 0 auto; color: #d6ad56; }.account-card .fine-print { margin: 14px 0 0; max-width: 920px; }+.account-card .account-management-row { margin-top: 12px; }.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }.meta-grid div { min-width: 0; padding: 11px 13px; background: #1b1d20; display: grid; gap: 5px; }.meta-grid span { color: var(--faint); font-size: 8px; }@@ -667,15 +669,12 @@ button.primary, button.secondary { border-radius: 5px; min-height: 40px; font-si.cloud-save-warning > button { flex-shrink: 0; }@media (max-width: 800px) { .cloud-save-warning { margin: 8px 12px 0; flex-wrap: wrap; } .cloud-save-warning > div { flex-basis: 100%; } }-.managed-runtime-family { margin-top: 20px; min-width: 0; }-.managed-runtime-family + .managed-runtime-family { padding-top: 20px; border-top: 1px solid var(--line); }-.managed-runtime-family p { overflow-wrap: anywhere; }-.managed-runtime-settings > button { margin-top: 16px; }+.managed-runtime-settings p { overflow-wrap: anywhere; }-.component-update-results { list-style: none; padding: 0; margin: 20px 0 0; }+.component-update-results { list-style: none; padding: 0; margin: 8px 0 0; }.component-update-results li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }.component-update-results li > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }.component-update-results li small { color: var(--muted); }.component-update-results li > button { flex-shrink: 0; }@media (max-width: 900px) { .component-update-results li { flex-wrap: wrap; } }-.component-updates button, .managed-runtime-settings button { min-height: 44px; }+.component-update-details button, .managed-runtime-settings button { min-height: 44px; }diff --git a/src/shared/runtime-display.test.ts b/src/shared/runtime-display.test.tsindex c69949e..7d81c8f 100644--- a/src/shared/runtime-display.test.ts+++ b/src/shared/runtime-display.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';import { demoSnapshot } from './demo-data';-import { nexusRuntimeUpdateAvailable, runtimeDisplay } from './runtime-display';+import { activeRuntimeIsCachyos, nexusRuntimeUpdateAvailable, runtimeDisplay } from './runtime-display';describe('runtimeDisplay', () => {it('uses the same available archive comparison for the top notice and Settings', () => {@@ -33,4 +33,19 @@ describe('runtimeDisplay', () => {it('does not show the update version as installed when no runtime is installed', () => {expect(runtimeDisplay({ ...demoSnapshot().runtime, installed: false }).version).toBe('Not installed');});+ it('never advertises the Standard release while a CachyOS runtime is the active default', () => {+ const runtime = { ...demoSnapshot().runtime, installed: true,+ name: 'nexus-runtime-cachyos-11.0-experimental-ge36f73cb-local',+ nexusAvailable: true, nexusVersion: 'runtime-11.0-new', nexusName: 'nexus-runtime-11.0-new-x86_64.tar.xz' };+ expect(nexusRuntimeUpdateAvailable(runtime)).toBe(false);+ expect(nexusRuntimeUpdateAvailable({ ...runtime, name: 'nexus-runtime-11.0-experimental-g5910703e-local' })).toBe(true);+ expect(nexusRuntimeUpdateAvailable({ ...runtime, name: 'nexus-runtime-cachyos-local', installed: false })).toBe(true);+ });+ it('recognizes an active CachyOS family runtime only from the verified installed record', () => {+ const base = { ...demoSnapshot().runtime, installed: true, name: 'nexus-runtime-cachyos-11.0-experimental-ge36f73cb-local' };+ expect(activeRuntimeIsCachyos(base)).toBe(true);+ expect(activeRuntimeIsCachyos({ ...base, installed: false })).toBe(false);+ expect(activeRuntimeIsCachyos({ ...base, name: 'nexus-runtime-11.0-experimental-g5910703e-local' })).toBe(false);+ expect(activeRuntimeIsCachyos({ ...base, name: 'my-wine-build' })).toBe(false);+ });});diff --git a/src/shared/runtime-display.ts b/src/shared/runtime-display.tsindex 1f73000..12cef19 100644--- a/src/shared/runtime-display.ts+++ b/src/shared/runtime-display.ts@@ -1,6 +1,9 @@import type { RuntimeStatus } from './types.js';export function nexusRuntimeUpdateAvailable(runtime: RuntimeStatus): boolean {+ // A CachyOS-family runtime is a different family from the Standard Nexus+ // release, so an active one never advertises a Standard update as same-family.+ if (activeRuntimeIsCachyos(runtime)) return false;return Boolean(runtime.nexusAvailable && runtime.nexusName &&runtime.name !== runtime.nexusName.replace(/-x86_64\.tar\.xz$/, ''));}@@ -22,3 +25,11 @@ export function runtimeDisplay(runtime: RuntimeStatus): { title: string; source:: runtime.commit ? `Build ${runtime.commit.slice(0, 12)}` : name || 'Version unavailable',};}++/** The verified default runtime belongs to the optional CachyOS family when its+ * recorded build name carries the CachyOS family prefix. Local diagnostic+ * builds use the same prefix, so an explicitly selected local CachyOS runtime+ * is presented truthfully without inventing a managed-family installation. */+export function activeRuntimeIsCachyos(runtime: RuntimeStatus): boolean {+ return runtime.installed === true && /^nexus-runtime-cachyos-/.test(runtime.name ?? '');+}diff --git a/src/shared/runtime-selection.ts b/src/shared/runtime-selection.tsindex 8abc62b..2111ede 100644--- a/src/shared/runtime-selection.ts+++ b/src/shared/runtime-selection.ts@@ -8,7 +8,7 @@ export function gameRuntimeSelection(value: unknown): GameRuntimeSelection {throw Error('Unknown managed runtime selection. Choose the default or an installed Nexus runtime.');}export const runtimeFamilyLabels: Record<RuntimeFamily, string> = {- nexus: 'Nexus Runtime', 'nexus-cachyos': 'Nexus Runtime (CachyOS, experimental)',+ nexus: 'Standard', 'nexus-cachyos': 'CachyOS',};export interface RuntimeBuildApproval {buildId:string; manifestSha256:string; sourceCommit:string;