From 5ea3bdb6fd0f4be18bee1c145b27ed8e829ba317 Mon Sep 17 00:00:00 2001 From: zhi Date: Wed, 18 Mar 2026 03:08:42 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20add=20round=2027=20dev=20status=20?= =?UTF-8?q?=E2=80=94=20P13.1=20test=20infrastructure=20+=2017=20milestone?= =?UTF-8?q?=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/milestone-propose-requirements.md | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/milestone-propose-requirements.md b/docs/milestone-propose-requirements.md index 5f0b749..64861f6 100644 --- a/docs/milestone-propose-requirements.md +++ b/docs/milestone-propose-requirements.md @@ -904,6 +904,42 @@ - 或 P13.1 开始编写 milestone/task 后端测试骨架 - 或前端排查是否有调用 batch transition 的地方需要适配新请求体 +### 2026-03-18 03:00 UTC(第 27 轮:P13.1 Milestone 后端测试基础设施 + 17 个测试) + +本轮做了什么: +- 搭建后端测试基础设施(P13.1),使用 SQLite 内存数据库 + FastAPI TestClient +- 新建 `tests/conftest.py`: + - SQLite in-memory 引擎 + StaticPool(共享连接) + - 自动建表/销表 fixture(每测试隔离) + - 工厂 fixture:`make_user` / `make_project` / `make_milestone` / `make_task` / `make_member` + - `seed_roles_and_permissions`:创建 admin/mgr/dev 角色 + 18 个权限 + 角色-权限映射 + - `auth_header`:JWT token 生成,用于 TestClient 请求认证 +- 新建 `tests/test_milestone_actions.py`(17 个测试): + - **TestFreeze**(4 个):成功冻结 / 缺 release task 失败 / 多 release task 失败 / 非 open 状态拒绝 + - **TestStart**(3 个):成功启动 + started_at 写入 / 依赖未完成拒绝 / 非 freeze 状态拒绝 + - **TestClose**(5 个):open/freeze/undergoing → closed 成功 / completed/closed 终态拒绝 + - **TestAutoComplete**(3 个):release task 完成自动触发 completed / 非 release task 不触发 / 非 undergoing 不触发 + - **TestPreflight**(2 个):有 release task 时 allowed=true / 无 release task 时 allowed=false + +改了哪些关键文件: +- `HarborForge.Backend/tests/__init__.py` — 新增 +- `HarborForge.Backend/tests/conftest.py` — 新增(~220 行) +- `HarborForge.Backend/tests/test_milestone_actions.py` — 新增(~400 行) + +验证结果: +- `python3 -m pytest tests/test_milestone_actions.py -v` — **17 passed**,0 failed +- 已 commit:backend `011a226`,parent `faad815` + +当前阻塞/风险: +- 安装了 pytest/httpx/python-multipart 等测试依赖到系统 Python(非 venv),仅用于本地开发验证 +- passlib + bcrypt 5.x 存在兼容性问题,测试中用预计算 hash 绕过 +- P13.2 task 测试、P13.3 propose 测试尚未编写 +- P14 收尾验收未开始 + +下一轮最建议继续做什么: +- P13.2 Task 后端测试(状态流转合法性 + assignee 校验 + comment 强制 + 编辑限制) +- 或 P13.3 Propose 后端测试(accept/reject/reopen + feat_task_id 生成 + code 递增) + --- ## 1. 背景