feat: complete T-534 generated reset enhancements

This commit is contained in:
chengma
2026-07-06 20:35:47 +08:00
parent 46995b301d
commit 71f8beae57
9 changed files with 488 additions and 63 deletions
+10
View File
@@ -1235,3 +1235,13 @@
- 边界:未改 cmhub HTTP 协议、配置 schema、DB schema、Excel、Shopee/CDP 流程;全组件齐备任务不纳入本轮生成。
- 测试:新增/调整 AI 与 GUI 单测覆盖只补封面、混合标题/封面缺口、封面关闭时标题态任务不纳入、全组件齐备不重复生成、②入口可启动补封面。
- 验证:`python -m py_compile app\ai.py app\gui\workers.py app\gui\tabs\generate.py tests\test_ai.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p test_ai.py` 通过(23 tests);相关 GUI 用例通过;`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(207 tests);`git diff --check` 通过,仅有本机 LF/CRLF 提示。
## 【2026-07-06】T-534 完成 · ②按组件批量重置生成结果
- 状态:DONE
- 代码:`db.reset_generated()` 增加 `reset_title` / `reset_cover` 组件开关和仅重置封面时可选的 `delete_file`,重置后保持 `stage=generated/status=success`,让 T-533 能按缺口只补被清掉的标题或封面;已提交线上记录保留 `committed/apply_attempts` 历史。
- AI:`generation_needs()` 只阻断 `status=failed` 且有 `apply_attempts` 的更新失败记录;用户主动重置后的成功态记录即使保留提交历史,也允许按缺口补生成。
- GUI:②任务表改为多选;「重置生成结果」确认框提供「重置标题 / 重置封面 / 重置全部 / 取消」,有选中行时作用于选中任务,没有选中行时作用于当前筛选结果;确认框显示标题/封面数量、运行中跳过数、已提交线上数量和重复提交风险;批量写 `run_type=reset` 日志。
- 边界:不改 cmhub HTTP 协议、配置 schema、Excel、Shopee/CDP 流程;默认不删除本地新封面文件,不触碰 Shopee,不自动回写 Excel。
- 测试:新增/调整 DB、AI、GUI 单测覆盖只重标题保留封面、只重封面保留手动标题、重置全部、多选/筛选范围、committed 警告、运行中禁用、提交历史下补封面。
- 验证:`python -m py_compile app\db.py app\ai.py app\gui\tabs\generate.py tests\test_db.py tests\test_ai.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p test_db.py` 通过(7 tests);`python -m unittest discover -s tests -p test_ai.py` 通过(24 tests);相关 GUI 用例通过;`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(212 tests)。