feat: expand full-flow diagnostics

This commit is contained in:
chengma
2026-07-01 15:32:27 +08:00
parent 84b35f1cdc
commit f80f00b5a2
7 changed files with 1085 additions and 53 deletions
+10 -1
View File
@@ -917,9 +917,18 @@
- 新标题微调:②「新标题」列允许已生成、未提交线上、非运行中任务双击本地编辑;写回 `tasks.new_title`,保留 `stage=generated`,清空 `last_error` 并回到可更新状态,不触碰 Shopee/CDP/Excel/封面。
- 测试:新增 DB 与 GUI 回归测试,覆盖本地标题编辑、③ 右键重置入口、开始更新主按钮标识、安全拦截前往设置。
- 验证:`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(145 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。
## 【2026-07-01】T-510 完成 · 「预览本轮更新」改名为「检查本轮更新」
- 文档:先同步 `docs/00-ai-start-here.md`、`docs/02-requirements.md`、`docs/04-architecture.md`、`docs/06-tasks.md`、`docs/api.md`、`docs/routes.md`、`docs/current-state.md`,新增 T-510,明确用户可见按钮/弹窗/日志统一使用「检查本轮更新」。
- 代码:`app/gui.py` 将③按钮、风险提示、确认框标题、取消/开始/完成状态、完成弹窗和 dry-run 运行日志文案从「预览本轮更新」改为「检查本轮更新」;内部 `preview_update_button`、`preview_update()` 与 `dry_run` 字段保留,不改变执行语义。
- 测试:更新 `tests/test_gui.py` 的按钮文案、状态栏和 dry-run 日志断言。
- 验证:`python -m py_compile app\gui.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p "test_gui.py"` 通过(57 tests);`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(145 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。
- 验证:`python -m py_compile app\gui.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p "test_gui.py"` 通过(57 tests);`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(145 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。
## 【2026-07-01】T-505 完成 · 全流程诊断日志扩展
- 范围:在 T-207 采集诊断和②AI生成诊断基础上,补齐 Excel 导入/回写、③更新shopee、④Chrome 启动/登录检测、⑤AI模型测试连接的业务运行日志与本地脱敏诊断日志。
- 代码:`app/gui.py` 新增安全 run log helper;`CollectTab.import_excel()` 写 `run_type=import`,记录选中文件、缺列、脏行和入库统计;`WriteBackWorker` 写 `run_type=write_back`,记录写入文件、行数和文件锁/保存异常;`ApplyWorker` 的 `run_type=apply` 改为步骤级事件,覆盖预检、Chrome/CDP 检查、登录检测、打开商品页、改标题、换封面、点更新、写库;④「启动登录」写 `run_type=chrome_launch`,登录检测 worker 写 `run_type=login_check`;⑤AI模型测试连接写 `run_type=ai_model_test`。
- CDP:`app/editor.py` 只给 `apply_task()` 增加可选 `on_step` 回调,用于上报 `open_product/change_title/replace_cover/click_update`,不改选择器、上传方式、确认框点击或提交逻辑。
- 安全:DB 业务日志和本地 `logs/cmshopee.log` 均通过现有脱敏工具处理,不记录 Cookie、密码、API Key、token;异常路径本地日志保留脱敏 traceback。
- 测试:新增/更新 `tests/test_gui.py` 覆盖 import/write_back/apply/chrome_launch/login_check/ai_model_test 运行日志和本地日志脱敏;`python -m py_compile app\gui.py app\editor.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p test_gui.py` 通过(63 tests);`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(151 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。