3 Commits

Author SHA1 Message Date
wangjia 3acd3ca59d fix(client/update): macOS 自更新失败韧性——回滚校验/提权自愈防换丢+codesign验签闸+超时不硬动+退出码检
- C3(critical): swap_plain 静默回滚后校验 $APP 是否真的复原(引入返回码语义 0/1/2/3),
  提权 ROOT_SH 改为自愈式(优先从 $BACKUP 复原、$NEW_APP 兜底直接就位),不再假设 $APP
  一定存在;新增终检,任何失败组合下都保证 /Applications 里最终有一个可用 app,不再
  出现"app 消失、零提示"。
- I1: PID 等待超时(~30s)后追加 5s 宽限,仍未退出则放弃换装、不硬动运行中的 bundle。
- I2: 换装前对 $NEW_APP 跑 codesign --verify --deep --strict,验签不过拒绝换装(回退访达)。
- I3: open "$APP" 检退出码,失败记日志(Gatekeeper/TCC 拦截时不再误记 relaunched)。
- M1: Dart 侧 helper chmod +x 检退出码,失败清理半截暂存目录;shell 侧 ROOT_SH chmod
  同样检退出码。

正常成功路径行为不变;helper 抽出后 sh -n/bash -n 语法检查通过;flutter analyze 0 issues。
逐失败分支(自愈从 BACKUP 复原、仅剩 NEW_APP 兜底就位、彻底不可恢复诚实失败)已用隔离目录
跑真实 mv 逻辑人工核对,报告见 .superpowers/sdd/fix-macos-updater-report.md。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
2026-07-13 15:52:35 +08:00
wangjia b702957788 feat(client/update): macOS 自更新改为自动装进 /Applications + 重启
ci-pangolin / Lint — shellcheck (pull_request) Successful in 9s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 24s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 20s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 19s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 56s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 33s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 3s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Failing after 12s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 12s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Successful in 4m32s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 22s
原「下载到 Downloads → 访达定位 → 手动拖入」半自动流程改为全自动:
- 下 zip → ditto 解压到暂存 → 写分离 helper 脚本、Process.start(detached)、exit(0)
- helper 等主进程退出 → 原子换 bundle(mv 旧→.old → mv 新→原位,任一步失败自动回滚)
  → 清 quarantine → open 重启新版
- 权限:主 app 未开沙箱;admin 用户对 /Applications 可写 → 静默无弹窗(案例①,绝大多数)
  .app 属主非本人 → osascript 弹一次系统原生密码框提权(案例②/③)
- 兜底:非 /Applications/不可写/解压失败/提权取消 → 回退旧的访达定位手动流程,绝不残废 app
- 不碰 sysext:运行中的扩展从 /Library/SystemExtensions 跑,换 .app 与手动拖同路径,
  新版启动照常 OSSystemExtensionRequest

验证:flutter analyze 干净;helper sh -n + shellcheck 通过;假 bundle dry-run 换装+重启+清理跑通。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 21:55:58 +08:00
wangjia c723bdd53e feat(client/update): 启动自动检查 + App 内下载安装(不走浏览器)
Deploy Client / build-windows (push) Successful in 2m2s
Deploy Client / build-android (push) Successful in 2m13s
Deploy Client / build-macos (push) Successful in 3m45s
Deploy Client / build-ios (push) Successful in 3m58s
Deploy Client / release-deploy (push) Successful in 2m1s
参照 jiu 补齐,但比 jiu 多做了 Android 原生安装(jiu 的 App 内下载仅 Win/mac):
- 启动自动检查:update_provider 改 AsyncNotifier,build() 延迟 3s 首查 + 每小时
  轮询;home_shell watch 拉起、listen 弹更新框;_dismissed 防反复弹(轮询重置);
  强制更新走不可关闭弹窗。设置页「检查更新」改 forceCheck()。
- App 内下载(core/update/app_updater.dart,http 流式带进度框,不再 launchUrl):
  · Android:下 APK → open_filex 拉起系统安装器(+ REQUEST_INSTALL_PACKAGES)
  · Windows:下 exe → Process.start(detached) → exit(0) 覆盖安装
  · macOS :下 zip → open 解压 + 访达显示,提示手动拖入(带系统扩展不自动 swap)
  · iOS   :降级外链(TestFlight/App Store)
  失败降级浏览器下载。新增 6 语更新进度/失败/提示文案。
- 依赖 open_filex;flutter analyze 仅 2 个既有 withOpacity info。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
2026-07-07 17:09:29 +08:00