fix(version_pipeline): 添加 mark_failed() 方法 + 测试用例
TesterAgent 测试失败时需调用 mark_failed() 将版本状态置为 abandoned, 补充缺失的 anti-hallucination 门控方法(使用 done_at 字段记录时间戳)。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -144,6 +144,16 @@ class VersionPipeline:
|
||||
)
|
||||
logger.info("[%s] %s 测试通过,已完成", project, version)
|
||||
|
||||
def mark_failed(self, project: str, version: str, issue: str = "") -> None:
|
||||
"""测试失败,标记为 abandoned(由 TesterAgent 调用)。"""
|
||||
with self._connect() as conn:
|
||||
conn.execute(
|
||||
"UPDATE versions SET status='abandoned', done_at=? "
|
||||
"WHERE project=? AND version=?",
|
||||
(self._now(), project, version),
|
||||
)
|
||||
logger.info("[%s] %s 测试失败: %s", project, version, issue[:100])
|
||||
|
||||
# ─── 查询 ──────────────────────────────────────────────────────
|
||||
|
||||
def get_status(self, project: str) -> list[dict]:
|
||||
|
||||
@@ -31,6 +31,18 @@ def test_tester_agent_can_mark_version_done(tmp_path):
|
||||
assert status[0]["status"] == "done"
|
||||
|
||||
|
||||
def test_mark_failed_sets_abandoned(tmp_path):
|
||||
"""TesterAgent 调用 mark_failed 后版本状态变为 abandoned。"""
|
||||
vp = VersionPipeline(db_path=tmp_path / "vp.db")
|
||||
vp.start_version("antishake", "v1", "test")
|
||||
vp.start_testing("antishake", "v1")
|
||||
vp.mark_failed("antishake", "v1", issue="jitter_px=8 超限")
|
||||
|
||||
status = vp.get_status("antishake")
|
||||
assert status[0]["status"] == "abandoned"
|
||||
assert status[0]["done_at"] is not None
|
||||
|
||||
|
||||
def test_dev_agent_cannot_directly_mark_done(tmp_path):
|
||||
"""开发 agent 的 [测试通过] 标签应被系统忽略(不能直接调 mark_done)。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user