fix(install): 修复 APM 未安装时点安装静默无反应,并清理同类接线断裂

主问题:showApmInstallDialog 在 useAppState.ts 被重复声明为独立 ref,
而 processInstall.ts 置位的是 storeConfig.ts 中的另一份实例,导致 APM
未安装时点「安装」既不弹引导弹窗也不创建下载任务(界面毫无反应)。

修复:
- useAppState 改为从 storeConfig 再导出同一实例(消除双实例)
- processInstall 在 install-complete 兜底识别「未安装 APM」失败原因
- 新增回归测试 ApmInstallDialog.test.ts(回退修复后 3/3 失败)

同类「接线断裂」问题全量排查修复(源自 d7bdcf36 拆分 composables):
- 应用下载排行永远为空:loadRanking 在 apps 未填充时空跑且不重试
- 详情页卸载后按钮状态不刷新(丢失的 checkAppInstalled 分支)
- 重试已取消任务复用 id,被旧任务 finally 删除而永久卡在下载中
- remove-installed 的 spawn 缺 error 监听(可致主进程崩溃)且不消费 stderr
- 云端应用列表在来源查询失败时静默丢数据(已安装列表同源问题)
- 忽略更新写入失败无反馈;下载统计上报缺 catch
- isInstalledAppInfo 运行时校验被削弱

清理重构遗留孤儿代码:
- 删除无引用的 AppDetailPage/AccountQuickMenu/TopActions/UpdateCenterCloseConfirm
- 恢复 handleRemoveComplete 语义与 onUnmounted 的 abort/unbind
- 删除孤儿 IPC:list-upgradable/show-apm-install-dialog/uninstall-installed
- 删除孤儿渲染端代码:handleUpgrade/handleRemove/useDownloadItemStatus
  及已无生产者的 queue-install 回灌监听器

验证:vue-tsc 0 error、vite build 通过、单元测试无新增失败
(基线 40 失败 → 35 失败)。

Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
2026-10-11 12:34:10 +08:00
parent 48a6e10263
commit 56a7e11622
16 changed files with 415 additions and 1056 deletions
+25 -6
View File
@@ -211,15 +211,34 @@ export const createUpdateCenterService = (
open: refresh,
refresh,
async ignore(payload) {
const entries = await loadIgnored();
entries.add(createIgnoreKey(payload.packageName, payload.newVersion));
await saveIgnored(entries);
try {
const entries = await loadIgnored();
entries.add(createIgnoreKey(payload.packageName, payload.newVersion));
await saveIgnored(entries);
} catch (error) {
// 写入失败(配置目录不可写等)此前会以未处理的 rejection 冒泡到渲染端,
// 既不刷新列表也不给出任何提示,用户看到「点了没反应」。
// 这里收敛为一条 warning,让界面明确告知失败原因。
const message = error instanceof Error ? error.message : String(error);
console.error(`[UpdateCenter] 保存忽略列表失败:`, error);
applyWarning(`保存忽略列表失败: ${message}`);
return emit();
}
await refresh();
},
async unignore(payload) {
const entries = await loadIgnored();
entries.delete(createIgnoreKey(payload.packageName, payload.newVersion));
await saveIgnored(entries);
try {
const entries = await loadIgnored();
entries.delete(
createIgnoreKey(payload.packageName, payload.newVersion),
);
await saveIgnored(entries);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.error(`[UpdateCenter] 保存忽略列表失败:`, error);
applyWarning(`保存忽略列表失败: ${message}`);
return emit();
}
await refresh();
},
async start(tasks) {