feat: 完成T-504更新执行增强

- 新增 dry-run、多账号并行和最大并行账号数设置

- 增加 run_logs/run_log_events 运行日志表及读写接口

- ApplyWorker 支持 dry-run 预览、按账号并行、端口冲突阻断和日志展示

- 补充 DB/GUI 单元测试并同步任务、架构、API、路由和当前状态文档

验证: python -m compileall app main.py tests; python -m unittest discover -s tests
This commit is contained in:
chengma
2026-06-29 10:25:09 +08:00
parent 01e319cad8
commit 0e0ed193b6
17 changed files with 1071 additions and 149 deletions
+11
View File
@@ -642,3 +642,14 @@
- 测试:`tests/test_appconfig.py` 覆盖结构化日志脱敏;`tests/test_gui.py` 覆盖保存 API Key 提示、账号密码保存提示、表格/状态不泄露明文、AI 测试 worker payload 脱敏。
- 文档:`docs/06-tasks.md` 将 T-503 标为 DONE;同步 `docs/02-requirements.md`、`docs/03-tech-stack.md`、`docs/04-architecture.md`、`docs/05-coding-rules.md`、`docs/api.md`、`docs/routes.md`、`docs/current-state.md`。
- 验证:`python -m unittest discover -s tests -p test_appconfig.py` 通过(5 tests);`python -m unittest discover -s tests -p test_gui.py` 通过(44 tests);`python -m compileall app main.py tests` 通过;`python -m unittest discover -s tests` 通过(107 tests)。
## 【2026-06-29】T-504 多账号并行 / dry-run / 运行日志
- 状态:DONE
- 配置:`app/appconfig.py` 的 `shopee_update` 新增 `dry_run`、`parallel_accounts`、`max_parallel_accounts`;⑤ 设置页可配置并持久化,默认 dry-run 关闭、多账号并行关闭。
- 数据:`app/db.py` 新增 `run_logs` / `run_log_events` schema 与创建、结束、逐条事件、查询函数;日志 payload 统一走脱敏工具。
- 执行:③ `ApplyWorker` 支持 dry-run 预览、默认串行真实更新、按账号并行真实更新;dry-run 不打开 Shopee、不调用 `editor.apply_task()`、不改任务状态、不回写 Excel,只写运行日志和汇总;真实更新前检查账号就绪和本轮账号调试端口冲突,不同账号可并行,同一账号内仍串行。
- UI:③ 增加运行日志视图,确认弹窗展示 dry-run 与多账号并行状态;dry-run 完成只弹预览汇总,不触发结果回写。端口冲突阻断时弹窗列出冲突端口并引导去④。
- 测试:`tests/test_db.py` 覆盖运行日志持久化;`tests/test_gui.py` 覆盖 dry-run 不变更任务、真实更新串行、按账号并行、端口冲突阻断、⑤设置读写与③共享配置。
- 文档:`docs/06-tasks.md` 将 T-504 标为 DONE;同步 `docs/00-ai-start-here.md`、`docs/02-requirements.md`、`docs/03-tech-stack.md`、`docs/04-architecture.md`、`docs/05-coding-rules.md`、`docs/api.md`、`docs/routes.md`、`docs/current-state.md` 和 UI 草图。
- 验证:`python -m compileall app main.py tests` 通过;`python -m unittest discover -s tests` 通过(112 tests);未执行真实 Shopee 提交。