Repository navigation
fix(update): 查不到 GitHub 时不再谎报「已是最新版本」 - #154
Merged
shuishuipingan merged 1 commit intoNov 12, 2026
Merged
shuishuipingan merged 1 commit into
shuishuipingan merged 1 commit into
Conversation
/update/plan 每次请求都实时打 GitHub API,而 /update/check 的结果缓存 6 小时。 匿名限流 60 次/小时/IP 触发 403 后,异常被 except 吞掉,latest 落成空串, has_update 变成 False,处理器把它渲染成「当前已是最新版本」——和旁边由缓存 得出的「发现新版本」自相矛盾,更新按钮也被 apply_blocked_reasons 清零。 改为在异常分支回退读 /update/check 的缓存;仍拿不到才置 lookup_failed=True, 不编造版本号,面板改提示「无法访问 GitHub(限流或网络不可达)」。 测试:tests/_test_update_lookup_failed.py(9 项)。
StephenBoyMi
force-pushed
the
fix/update-plan-lookup-failed
branch
from
November 12, 2026 02:54
af2b5b4 to
339d707
Compare
Owner
|
审阅通过:403/网络失败与真实无更新现已区分,有新鲜成功缓存时可恢复正确版本。已隔离验证新增9项、既有21+20项更新测试,并以离线桩直接执行 Handler.do_GET 验证无缓存/失败缓存/成功缓存/过期缓存、401和远程更新限制。畸形成功版本校验与查询合并属于后续改进,不阻塞本次针对性修复。完整回归通过后合并发布。 |
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.
问题
同一块看板自相矛盾:左边「发现新版本 v1.9.6(当前 1.9.4)」,右边「无法一键更新:当前已是最新版本」,更新按钮消失。
根因
两个端点各自打一次 GitHub API:
/update/check→check_for_update(),结果缓存 6h,那次是成功的;/update/plan→update_plan_info(),每次实时调qoder_updater.latest_release()。GitHub 匿名限流 60 次/小时/IP。403 时异常被
except吞掉,latest落成""→has_update=False→ 处理器把「查不到」渲染成「当前已是最新版本」,同时apply_blocked_reasons把can_apply清零。修法
update_plan_info()的异常分支回退读check_for_update()的缓存(同一份数据,面板左右两侧不再打架);lookup_failed=True,不编造版本号;lookup_failed优先判定。测试
tests/_test_update_lookup_failed.py:9 项,stub 403 × 有/无缓存两种,另加处理器文案顺序断言。影响面
只动
/update/plan的返回字段与文案;/update/check、/update/apply未改。