Repository navigation
fix(install): 下载失败时报出地址和原始错误,慢速下载不再被中断 - #259
Merged
Merged
Conversation
用户反馈(2026-11-17):Win11 上安装 v0.3.1 时提示「has no SHA256SUMS」, 而发布中有这个文件。install.ps1 把任何下载失败都报成文件缺失并丢掉原始错误; install.sh 的 wget 不显示错误,查询最新版本的管道也会吞掉下载失败。 - 失败时报出下载地址和原始错误。install.ps1 遇到 HTTP 4xx(408、429 除外) 立即停止,其他错误最多尝试 3 次;install.sh 对超时和 HTTP 408、429、500、 502、503、504 最多尝试 3 次 - 超时只针对停滞,慢速下载不会被中断:curl 用 --speed-limit/--speed-time, wget 用 --timeout;PowerShell 等待响应头最多 30 秒,7.4 起另加 -OperationTimeoutSeconds 30 - install.ps1:校验和不一致时报出已下载的字节数(Windows PowerShell 5.1 会把中途断开的下载当作已完成) - 测试先写并在原脚本上失败:test_install_script.py 用真实 curl/wget 访问本地 假发布;新增 test_install_windows.ps1,CI 在 hooks-windows 上用 5.1 和 7 各跑一遍 - 安装文档两种语言各加一句;docs/acceptance.md 补上新测试和实测记录
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #259 +/- ##
==========================================
- Coverage 93.58% 93.57% -0.01%
==========================================
Files 489 489
Lines 85908 85908
Branches 4909 4909
==========================================
- Hits 80394 80391 -3
- Misses 4845 4848 +3
Partials 669 669
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
问题
用户反馈(2026-11-17):Windows 11 上用
irm … | iex安装 v0.3.1 时提示release v0.3.1 has no SHA256SUMS (is 0.3.1 a Voltip release?),而发布中有这个文件。install.ps1用一个 catch 把 SHA256SUMS 的任何下载失败都报成文件缺失,原始错误(TLS、代理、超时)被丢掉。install.sh的 wget 用-q,失败时什么都不显示;curl 先打印原始错误,紧接着又报出同样有误的结论。查询最新版本时fetch | sed | head的管道吞掉了下载失败,只报could not find the latest release。改动
scripts/install.ps1Invoke-InstallRequest:失败时报出 URL、HTTP 状态和每一层内部异常的信息。HTTP 4xx(408、429 除外)立即停止,其他错误最多尝试 3 次,间隔 1 秒。-TimeoutSec 30只限制等待响应头的时间;PowerShell 7.4 起另加-OperationTimeoutSeconds 30,数据停止 30 秒才结束下载,慢速下载不受影响。Write-Host打印一遍。scripts/install.sh:curl 和 wget 各一个download。curl 用--connect-timeout 15 --speed-limit 1 --speed-time 30 --retry 2,不设总时长;wget 去掉-q,用--timeout=30 --tries=3。查询最新版本时先下载再解析。.github/workflows/ci.yml:hooks-windows在 Windows PowerShell 5.1 和 PowerShell 7 下各跑一遍test_install_windows.ps1。它不需要工具链和安装包,放在这个 job 不用等交叉构建。docs/site/guide/install.md、docs/site/zh/guide/install.md:各加一句,说明下载失败时检查什么。docs/acceptance.md:一行命令安装这一行补上新行为、新测试和实测记录。测试
先写测试,在原脚本上确认失败,再改脚本。
scripts/release/test_install_script.py:CurlDownloads/WgetDownloads用真实的 curl 和 wget 访问本地假发布,只替换目标地址:403、404 不重试并报出地址和状态,503 重试,三次后停止。test_regression_a_slow_download_is_never_cut_off检查每次下载都没有总时长上限、都有停滞检测(真实的慢速下载要十分钟,所以检查参数)。原脚本上这些用例全部失败,报错正是has no SHA256SUMS。原有的DebInstall改为继承公共基类FakeRelease,测试内容不变;简易的 fake curl 支持-o -。scripts/release/test_install_windows.ps1(新增,14 个用例):替换 web、进程和注册表相关的 cmdlet,按irm | iex的方式运行整个脚本。原脚本上 14 个全部失败。本机:
python3 -m unittest discover -s scripts/release -p 'test_*.py'234 个通过;pwsh 7.6.3 下 14 个通过;shellcheck scripts/install.sh、scripts/check-acceptance-ledger.sh、.github/scripts/check-no-production-hosts.sh通过。Windows 真机(
scripts/windows-remote.sh,Windows Server 2025,Windows PowerShell 5.1.26100 与 PowerShell 7.6.9):test_install_windows.ps1在两个版本下都通过。Invoke-InstallRequest访问本机故障服务器(时限调成 3 秒):连接被拒 3 次后报错,404 只试 1 次,503 后成功,响应头一直不到时 3 次后报错,50 KB 用 5 秒的慢速下载正常完成。7.6.9 下中途断开或连接重置后重下成功,数据停止 3 秒后结束。checksum mismatch for Voltip_0.3.1_x64-setup.exe (1000 bytes downloaded): nothing was installed;7.6.9 重下后校验通过。VOLTIP_VERSION=0.0.0时报出 GitHub 的 404 和完整地址。Linux:
install.sh对 GitHub 实测VOLTIP_VERSION=0.0.0,curl 和 wget 都报出 404 和地址。没有运行
make verify里的 Rust 和 web 门禁:这个 PR 只改安装脚本、测试、CI 和文档,不涉及它们。风险与回退
只影响一行命令安装。一行命令从
main读取脚本,合并后即生效,不需要发版。回退:revert 这个提交。