feat(selfupdate): 自动更新提醒 + 一键更新 - #2
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
suny911
marked this pull request as ready for review
July 4, 2026 01:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
guling-trader 启动时对比 GitHub 最新 Release 版本号,发现新版本在主窗口内联横幅提醒;用户点「立即更新」后程序自己下载新 exe、校验 SHA256、Windows 下重命名自替换并重启,无需手动下载。
设计定稿见
docs/superpowers/specs/2026-07-04-self-update-design.md,实施计划见docs/superpowers/plans/2026-07-04-self-update.md。改了什么
src/trader/selfupdate/:check.py(查 GitHub Release 比三段式版本号,非 Windows / 网络异常一律 fail-closed 返回 None)、apply.py(下载→SHA256 校验→os.rename自替换含失败回滚→释放单例 mutex→拉新进程→os._exit;含孤儿.old/.new清理)。main_window.py:SharedState新增 3 字段(info/progress/status)、内联横幅 UI(idle/downloading/error 三态)、「立即更新」防重入置灰。main.py:启动 Step 1.5 孤儿清理 + Step 2.5 自更新检查;「立即更新」按钮回调经run_coroutine_threadsafe丢后台 loop;release_singleton_mutex()(含 None 保护、依赖注入避免循环导入)。ui_dialogs.py(其弹窗类是全仓未实例化的死代码,本次不复活)。关键设计取舍
SharedState。测试
pytest tests/95 passed / 10 skipped(skip 均为 Windows-only,macOS 上按预期跳过),项目原有 75 个测试无回归。独立 code-review 结论
已过两轮独立审查(code-reviewer + 人工复核):0 BLOCKER。若干 WARNING/INFO 均为已在设计中拍板的取舍(三段式版本不引 packaging、SharedState 保持零依赖、双保险 try/except)或概率可忽略的极端边界(两次 rename 同时失败,上层已拦住不会拉起坏进程),不阻塞合入。
🤖 Generated with Claude Code