zcbot/web/routers
caoqianming fd79edb344 test(web): DB 面路由测试(tasks CRUD/files DB-aware/upload)+ 修 restore 500
测试库基建落地(docker postgres:16-alpine @5433 + migration 0001-0022,
RUN.md 补一键命令),tests/test_web_routes_db.py 10 用例补齐 nodb 套件留待面:
- tasks CRUD 全链:建(默认模型/working_dir)/列(分页壳)/详(上下文压力
  字段)/PATCH 校验/软删→列表消失→恢复/同 wd 共享 + folders 计数
- files 顶层目录 DB-aware(§7.4):rename 级联改 tasks.working_dir(tasks_
  updated=1 且 DB 生效)、running→409、move 被引用→409、递归删被引用→409、
  软删 task 后放行
- upload 配额 gate 路径 + 根目录列表(system_wd_names)+ 非法文件名 400
- clear/cancel 状态闸、models 档位列表、schedules 404 路径

修 bug(本套件抓出的存量缺陷,重构前即有):POST /v1/tasks/{id}/restore
用 ORM 脏标记恢复,updated_at 是 server-side onupdate,flush 后列被标记
expired,session 关闭后序列化读它抛 DetachedInstanceError——真软删过的
任务恢复必 500(幂等路径无脏标记故此前未暴露)。修法:flush+refresh 后
在 session 内完成 task_dict 序列化。

带测试库全量 344 全过;未设 ZCBOT_TEST_DB_URL 时干净 skip;测试库零残留。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 13:50:57 +08:00
..
__init__.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
asr.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
authroutes.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
files.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
kb.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
messages.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
misc.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
models.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
schedules.py refactor(storage): 计费读侧收口 core/storage/usage_report.py + 首批 DB 级测试 2026-07-23 10:33:13 +08:00
skills_memory.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00
tasks.py test(web): DB 面路由测试(tasks CRUD/files DB-aware/upload)+ 修 restore 500 2026-07-23 13:50:57 +08:00
wechat.py refactor(web): app.py 拆分——73 路由迁 11 个 router 模块,3972 行减至 732 2026-07-23 10:18:57 +08:00