Repository navigation
feat: configure bounded playback recovery and cooldown in the console - #26
Conversation
… feat/configurable-playback-recovery
yichen11818
left a comment
There was a problem hiding this comment.
感谢你为这个项目投入时间,也感谢把配置界面、文档和回归测试一并补齐。播放失败后队列停住确实值得解决,这次对重试次数、冷却、取消和状态展示的设计也比较完整。
我审查了当前提交 972d7914462ffa4f42e0dedb4d4cf941c18ce946,并在隔离环境运行了后端测试:177 项,跳过 1 项,其余通过。不过补充边界场景后,复现了两个建议在合并前修复的问题:
-
[P2] 手动选曲失败后,接口返回成功并播放另一首。
play_queue_item()现在调用_continue_auto_play(),但自动遍历逻辑会吞掉 402/403/404/410,删除目标并继续播放下一首。复现场景:A 正常播放,手动选择返回 403 的 B,实际结果是 B 被删除、切到 C,接口返回{"ok": true}。原接口会向调用方返回失败。report_initial_error=True没有覆盖这个分支。建议区分手动指定目标与自动续播,保留首次请求的错误语义,避免失败的选曲意外替换正常播放。
位置:backend/main.py:5217–5218,以及_auto_play_next_from_queue()的不可播放错误分支。 -
[P2] B 站永久性权限错误会被当成临时故障重试。
_playback_recovery_reason()将所有 502 归为upstream_unavailable,但现有 B 站解析链路也会把权限错误和 yt-dlp 的永久不可用异常包装成 502。我模拟 B 站 API 返回 403、yt-dlp 同样报告视频不可用,通过实际入队调用链复现了失败条目被保留并安排重试。WAIT 策略下,这类错误会反复冷却重试,与文档中“认证、付费限制、歌曲不存在不作为临时故障重试”的约定不符。建议在来源适配层保留错误类别,再依据原始原因决定是否恢复,并增加覆盖错误包装链路的测试。
位置:backend/main.py:4407–4412。
另外,#26 与 #27 在本地合并无冲突;组合后的后端 185 项测试(跳过 1 项,其余通过)、前端类型检查及 15 项前端测试均通过。上述两个场景是现有测试之外补充复现的。本次未进行真实平台账号或 TeamSpeak 音频验证。
整体方向认可,建议先修复这两处行为问题再合并。再次感谢你的贡献。
|
已按这条评审修正,提交为
回归先复现了原问题再修复。新增用例通过实际入队链路和模拟 HTTP/yt-dlp 响应验证:API 403 + 永久不可用、元数据完整/缺失、业务拒绝、无效响应、协议错误、429、超时,以及首次 503 后下一次真实下载流程成功。 本地 Python 3.11 后端 183 项测试通过(2 项跳过);与 #27 再次合并无冲突,组合后 191 项后端测试通过(2 项跳过)、15 项前端测试通过。未使用真实平台账号或 TeamSpeak 音频环境,未改动生产服务器。已推送,请再看一下这两个边界是否符合预期。 |
yichen11818
left a comment
There was a problem hiding this comment.
感谢及时修复,也感谢补上实际错误包装链路和过期请求的回归用例。
已复核 cd7ba65、c7cb0d6,当前审查版本为 c7cb0d66ee4c5c59a8092b28037f6ba57eeebab9。上一轮提出的两个问题均已确认修复:
- 重跑上次的手动选曲复现场景:A 正常播放时选择返回 403 的 B,现在接口返回 403,A 继续保留,B 不被删除,也不会误播 C。
- 重跑 B 站 API 403 + yt-dlp 视频不可用的实际入队链路:现在返回 403,
recovery.pending为 false,队列没有新增失败条目。错误类别不再因外层包装成 502 而丢失。
同时检查了新增的过期请求保护,以及临时错误仍能恢复的回归覆盖。本地验证结果:
- #26 后端共 183 项:182 项通过,1 项因环境条件跳过。
- 独立复跑上一轮的两个复现场景:2 项全部通过。
- 与当前 #27 合并无冲突;组合后共 191 项后端测试:190 项通过,1 项因环境条件跳过。
- 当前 #26 提交的 GitHub 检查和三个 Docker 镜像构建均通过。
本轮增量审查未发现新的阻塞问题,之前的两条修改意见已解决,从本次代码审查和自动化验证结果看可以合并。本次仍未进行真实平台账号或 TeamSpeak 音频验证。
Problem and behavior
Transient source failures during natural continuation or explicit play/next/skip can leave a non-empty queue idle. Add a persisted Playback recovery console section with bounded exponential retry, temporary skip or wait-on-target exhaustion, and an outage cooldown.
Closes #24.
Validation
Python 3.11 full backend suite: 183 tests, passed (2 skipped), using temporary databases, mocked provider/voice boundaries and a deterministic recovery clock; no platform accounts or TeamSpeak server required.
Node 22:
npm ci,npm run typecheck,npm test -- --maxWorkers=1(12 tests),npm run build,npm run build:demopassed.Headless Chromium fixture check: open Settings → Playback recovery, inspect pending cooldown, click Stop and cancel retry, confirm POST
/voice/stopand disappearance of the pending banner. Screenshot below.Standards and specification reviews completed; reported permanent-failure traversal and paused-event race cases were reproduced and fixed.
Local containers were memory/CPU bounded. No production deployment or live audio/TeamSpeak validation in this PR.
Combined integration of feat: configure bounded playback recovery and cooldown in the console #26 and feat: configure Netease and QQ Music quality defaults per provider #27 merged without conflicts locally: 191 backend tests passed (2 skipped); Web typecheck, 15 Vitest tests, production build and demo build passed. The integration branch was used only for local validation.
Review follow-up: explicit selection keeps its initial permanent error without deleting the target or replacing current playback; Bilibili API/yt-dlp wrappers preserve failure classification. Regression cases also cover stale selection failures after stop/pause/new intent, unclassified errors, permissions, rate limits, timeouts and a successful transient retry through the download chain.
Screenshot
Configuration timing, ranges, environment names and status fields are documented in
docs/PLAYBACK_RECOVERY.md.