Skip to content

merge: sync upstream b17e605 (resumable update downloads) - #29

Merged
1lck merged 14 commits into
mainfrom
sync/upstream-b17e605
Nov 16, 2026
Merged

1lck merged 14 commits into
mainfrom
sync/upstream-b17e605

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 16, 2026 •

Copy link
Copy Markdown

Merge upstream main b17e605 into fork main 97fdbdd. Merge this PR with a merge commit, never squash, so upstream stays an ancestor of fork main and every published Lithe pin stays reachable.

Upstream range

89ce846..b17e605, 13 commits:

Conflict

One, in update/install_windows_test.go (TestPayloadHelperScriptKeepsABackupAndRestores). The fork's aaf3285 asserted { Restore; Launch; exit 1 }; upstream asserts the full line if ($p.HasExited -and $p.ExitCode -ne 0) { Restore; Launch; exit 1 }. Resolved to upstream's side. The merged update/install_windows.go is byte-identical to upstream and contains that line, so the stronger assertion holds. The whole update/ directory is now identical to upstream.

Fork patches

Validation

On macOS 27 / arm64, Go 1.27.4 (module go 1.26.0), on 944e3e5:

  • gofmt -l $(git ls-files '*.go'): clean.
  • go vet ./...: clean (only the existing didModifyRange: deprecation warning from cgo).
  • GOOS=windows GOARCH=amd64 go build ./... and GOOS=windows GOARCH=arm64 go build ./...: pass.
  • GOOS=linux GOARCH=amd64 go vet ./update/ ./ui/ ./components/: clean.
  • go test ./... -count=1: everything passes except 14 packaging tests in cmd/viva (the program was built for macOS 13.0 or later but [mac] min_system says 12.0). That is the local toolchain: the same test fails on fork main 97fdbdd before this merge, and fix(update): resume an interrupted download vivaui/viva#324 records the same failure on upstream.
  • git merge-base --is-ancestor upstream/main HEAD: true.
  • Fork tags already match git ls-remote --tags --refs https://github.com/vivaui/viva.git; no tag push needed.

xiaoyumuxi added a commit to 1lck/Lithe-IDEA that referenced this pull request Nov 16, 2026
* build(desktop): Viva 升级到 fork 944e3e5(上游 b17e605,更新下载可断点续传)

fork main 97fdbdd 合入上游 89ce846..b17e605 的 13 个提交(Lithe-IDEA/Lithe-viva#29),
其中 vivaui/viva#324 让 update.Download/DownloadPatch 断开后用 Range 接着下,
并新增 ErrInterrupted。唯一冲突在 update/install_windows_test.go,按上游解决。

require 改为上游基线 b17e605,replace 改为 fork 944e3e5。

* fix(desktop): 更新与插件市场下载断开后接着下,一分钟没有数据才超时

应用更新和插件市场的下载断开后都从头再下。更新包几百 MB,网络不稳时可能一直下不完;
插件下载连同检查、解压一共只有 5 分钟,大包在慢网络上会超时。

应用更新(Viva update,见 vivaui/viva#324):
- 断开、取消、服务器错误或一分钟没有收到数据时保留已下载的部分,下次用 HTTP Range
  接着下;服务器不支持时从头下,已校验的文件直接复用。
- 补丁下载被打断(appupdate.ErrInterrupted)不算补丁失败,不改下完整包,也不记
  delta fallback;下次接着下补丁。
- 下载开始时删除其他版本的缓存目录,缓存只留当前版本;删除失败记录
  app.background.operation_failed(update_download_cleanup)。

插件市场:
- 下载不限总时长,一分钟没有收到数据结束,报 ErrArchiveStalled(界面显示“操作超时”);
  检查与解压仍限 5 分钟(pluginPrepareTimeout)。
- ArchiveSession 保留被打断的传输,同一设置窗口里再下载同一个包时用 Range 接着下;
  服务器忽略、错位或拒绝 Range 时从头下;接上的内容与索引摘要不符时丢弃并报校验失败。
  会话最多保留一份文件,换包或关闭时删除。

测试:updates_test.go 覆盖补丁续传不改下完整包、清理其他版本;download_resume_test.go
覆盖续传、Range 各种回应、换包、停滞结束、下载不受总时长限制、保留内容不对时丢弃;
plugins_test.go 覆盖市场下载不受检查与解压时限约束。

依赖 Viva 的 ErrInterrupted:上游 b17e605(vivaui/viva#324)提供,前一个提交已把
replace 升级到包含它的 fork commit。

* refactor(desktop): 删除续传后不再被生产代码调用的 DownloadWithProgress

ArchiveSession 改为调用支持续传的 download 后,ArchiveDownloader.DownloadWithProgress
只剩 Download 和一个进度测试在用。把它并入 Download(无进度、被打断的部分直接删除),
进度回调的约束移到 ArchiveSession.Download 的注释里;进度测试改走 ArchiveSession,
与生产路径一致。
@1lck
1lck merged commit 25d7106 into main Nov 16, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants