Skip to content

fix(download): prevent cancelled mobile batches from restoring - #566

Merged
cwuom merged 1 commit into
masterfrom
fix/cancel-mobile-download
Oct 24, 2026
Merged

cwuom merged 1 commit into
masterfrom
fix/cancel-mobile-download

Conversation

@cwuom

@cwuom cwuom commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

描述 / Description

移动或漫游网络下多选下载后取消流量确认,原实现已经创建 OPEN 持久批次,取消时仅移除内存展示,导致重启后再次出现下载中的批次卡。

将流量确认移到创建持久批次、清理停止标记和恢复已有任务之前,并覆盖等待删除清理超时的延迟入口。未确认的请求不再留下可恢复批次,也不会提升或恢复原有 operation。

确认检查与持久化共用同一次网络快照,保留 Wi-Fi/未知网络准入时的限制,避免准备期间切换移动网络后未经确认使用流量。

类型 / Type

  • Bug 修复 / Bug Fix
  • 新功能 / New Feature
  • 文档更新 / Documentation Update
  • 其他(请描述)/ Other (please describe):

修复或解决的问题 / Issues Fixed or Closed by This PR

修复流量模式下取消多选下载后,重启恢复未确认批次的状态问题。

清单 / Checklist

  • 我已阅读并遵循贡献指南 / I have read and followed the contribution guidelines
  • 我已在本地测试这些更改 / I have tested these changes locally
  • 我已更新相关文档或注释(如适用) / I have updated relevant documentation or comments (if applicable)
  • 我确认本次更改没有破坏任何原有逻辑 / I confirm this change does not break existing behavior
  • 我确认本次更改保持向下兼容(如适用) / I confirm this change remains backward compatible (if applicable)
  • 我已运行必要的构建、测试或静态检查 / I have run the required build, tests, or static checks
  • 我确认没有提交密钥、Token 或其他敏感信息 / I confirm no secrets, tokens, or other sensitive information were committed
  • 涉及 UI 变更时,我已补充截图或录屏(如适用) / I have added screenshots or recordings for UI changes (if applicable)

其他信息 / Additional Information

验证:

  • 新增 7 项 Robolectric API 28 回归,使用真实 Room、下载启动 Job、确认事件与持久批次恢复入口,覆盖移动/漫游网络未确认、重复取消、确认后断网恢复、既有 operation 不变、删除清理超时及 Wi-Fi 切移动网络
  • 移动/漫游未确认用例在原代码上失败;切网用例在网络快照修复前失败;修复后 7 项全部通过
  • ./gradlew :download:runtime:verifyCrap :download:runtime:lintDebug :verifyModuleBoundaries --offline --console=plain 通过
  • 下载运行模块共 2,644 项测试,0 失败、0 错误、0 跳过
  • CRAP 检查 186 个受检方法,0 个超过 9;模块边界检查通过
  • lint 0 错误,保留未修改测试文件中的 1 条既有 CheckResult warning;本次修改文件无 lint finding
  • 独立代码复审完成,无阻塞发现

验证边界:

  • 尚未执行模拟器、实体设备、真实蜂窝传输或 Android 进程重启实测
  • 不自动删除升级前遗留的幽灵批次,避免误删已确认且尚未入队的有效任务
  • 本次修改下载准入和持久化时序,截图/录屏清单项不适用

变更内容

  • 移动网络或漫游网络下,批量下载会先请求流量风险确认,再创建持久化批次或恢复已有操作。用户取消时,不会留下可在重启后恢复的批次。
  • 删除清理延迟期间,系统会先请求确认。确认和后续准入使用同一网络类型;确认后网络变化时,批次按对应网络要求等待,不会绕过 Wi‑Fi 限制。

测试

  • 新增 Robolectric 测试,覆盖未确认、重复取消、确认后网络失效、已有操作、删除清理超时及 Wi‑Fi 切换场景。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T16:46:54.307321Z a42d6c3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 224df24 and a42d6c3.

📒 Files selected for processing: 5
  • modules/download/runtime/src/main/java/moe/ouom/neriplayer/core/download/manager/admission/GlobalDownloadManagerAdmission.kt
  • modules/download/runtime/src/main/java/moe/ouom/neriplayer/core/download/manager/batch/GlobalDownloadManagerBatchPrepare.kt
  • modules/download/runtime/src/main/java/moe/ouom/neriplayer/core/download/manager/batch/GlobalDownloadManagerBatchRecovery.kt
  • modules/download/runtime/src/main/java/moe/ouom/neriplayer/core/download/manager/catalog/GlobalDownloadManagerCatalogDelete.kt
  • modules/download/runtime/src/test/java/moe/ouom/neriplayer/core/download/manager/batch/GlobalDownloadManagerTrafficRiskBatchTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

批量下载流程现在在准入阶段请求流量风险确认,并使用准入时的网络类型决定 Wi-Fi 要求。该要求可传入队列暂存和删除清理等待任务的持久化逻辑。新增测试覆盖未确认请求、网络变化、任务恢复和删除清理超时等场景。

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to a42d6

The change is mergeable after normal checks; no concrete blocking issue is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确概括了本次变更的主要目的:阻止已取消的移动网络批次在重启后恢复。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cwuom
cwuom merged commit b14153f into master Oct 24, 2026
8 checks passed
liaolon added a commit to liaolon/NeriPlayer that referenced this pull request Oct 25, 2026
带入上游:
- fix(ui): preserve page state and back navigation across rotation (cwuom#570)
- fix(download): prevent cancelled mobile batches from restoring (cwuom#566)
- fix(nowplaying): sync matched favorites and refine song sheets (cwuom#562)
- feat(lyrics): add ColorOS 16/17 lockscreen lyrics with Root and Shizuku (cwuom#563)
- fix(lyrics): preserve Bluetooth lyrics in display metadata (cwuom#560)
- fix(ui): stabilize cover morphs and improve Clean switch contrast (cwuom#561)
- fix(netease): isolate rejected songs during playlist sync (cwuom#559)
- feat(backup): protect configuration exports and warn on HTTP WebDAV (cwuom#557)
- perf(ui): defer expensive UI work and complete Clean theme styling (cwuom#556)
- fix(auth): persist accounts when Android Keystore is unavailable (cwuom#554)
- fix(lyrics): apply translation mode before publishing songs (cwuom#553)
- fix(local): restore scanned audio playback and metadata writes (cwuom#551)

与心动模式改动的重叠文件(NowPlayingScreen、NowPlayingQueueSheet、
MoreOptionsMainContent、PersistedPlayerState、PersistedPlayerStateMapping、
PlayerManager、PlayerManagerPersistenceExtensions、NeteaseClient)均为自动合并,
无冲突;heartbeatMode 持久化字段与恢复调用保持完整。
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.

1 participant