Skip to content

Restore download statistics and completion listener notifications - #537

Merged
JusterZhu merged 3 commits into
masterfrom
copilot/fix-addlistener-multidownload-issues
Sep 19, 2026
Merged

JusterZhu merged 3 commits into
masterfrom
copilot/fix-addlistener-multidownload-issues

Conversation

Copilot AI commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Automatic updates could succeed without invoking AddListenerMultiDownloadStatistics or AddListenerMultiDownloadCompleted. Client and OSS strategies omitted the progress bridge, which also lacked statistics event dispatch.

  • Connect notifications: Pass the synchronous event bridge to default and injected download orchestrators in both strategies.
  • Restore statistics: Dispatch legacy statistics alongside generic progress, preserving completion behavior. Report byte counts and percentage; document unavailable speed/ETA as empty string/zero.
  • Regression coverage: Cover strategy wiring, completion callbacks, and statistics with known or unknown download sizes.

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AddListenerMultiDownloadStatistics and AddListenerMultiDownloadCompleted triggers Restore download statistics and completion listener notifications Sep 19, 2026
Copilot AI requested a review from JusterZhu September 19, 2026 14:00
@JusterZhu
JusterZhu marked this pull request as ready for review September 19, 2026 14:06
Copilot AI lite review requested due to automatic review settings September 19, 2026 14:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical compatibility issue causes the statistics version information to be lost.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Restores download progress, statistics, and completion notifications across client and OSS strategies.

Changes:

  • Wires progress bridges into download orchestrators.
  • Dispatches legacy statistics events.
  • Adds regression coverage for notification behavior and download sizes.
File Summary
tests/​CoreTest/​Strategy/​DownloadEventTests.cs Tests strategy notification wiring.
tests/​CoreTest/​Download/​DownloadProgressReporterTests.cs Tests statistics and completion behavior.
src/​GeneralUpdate.Core/​Strategy/​OssStrategy.cs Wires OSS download progress events.
src/​GeneralUpdate.Core/​Strategy/​ClientStrategy.cs Wires client download progress events.
src/​GeneralUpdate.Core/​Download/​Progress/​DownloadProgressReporter.cs Dispatches legacy statistics notifications.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +64 to +66
new MultiDownloadStatisticsEventArgs(value.AssetName ?? "unknown",
TimeSpan.Zero, string.Empty, value.TotalBytes ?? 0,
value.BytesDownloaded, value.Percentage));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6eb5c48. The download progress pipeline now preserves and forwards the original version object via VersionContext, and MultiDownloadStatisticsEventArgs.Version uses that object when available instead of the asset filename.

Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
@JusterZhu

Copy link
Copy Markdown
Collaborator

@copilot 事件不触发的问题都解决了吗

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 事件不触发的问题都解决了吗

是的,这次“事件不触发”的主链路已经修复:Client/Oss 两个策略都已接入 CreateEventBridge(),并且 DownloadProgressReporter 会在进度上报时分发 MultiDownloadStatistics,完成时分发 MultiDownloadCompleted。我这边也补了对应回归测试并已通过。

@JusterZhu
JusterZhu merged commit e72cb95 into master Sep 19, 2026
4 checks passed
@JusterZhu
JusterZhu deleted the copilot/fix-addlistener-multidownload-issues branch September 19, 2026 15:13
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.

[ERROR] AddListenerMultiDownloadStatistics和AddListenerMultiDownloadCompleted没有触发

3 participants