auto-sync: 2026-05-18 16:12:44
This commit is contained in:
+16
-17
@@ -345,23 +345,23 @@ class TestE5ParentAggregation:
|
|||||||
|
|
||||||
def _create_child(self, cid: str, status: str = "pending", stage: str = None):
|
def _create_child(self, cid: str, status: str = "pending", stage: str = None):
|
||||||
self.bb.create_task(Task(
|
self.bb.create_task(Task(
|
||||||
id=cid, title=f"子-{cid}", status=status,
|
id=cid, title=f"子-{cid}", status="pending",
|
||||||
parent_task=self.parent_id, stage=stage,
|
parent_task=self.parent_id, stage=stage,
|
||||||
))
|
))
|
||||||
# 如果不是 pending,需要走合法转换
|
if status == "pending":
|
||||||
if status != "pending":
|
return
|
||||||
for s in ["claimed", "working"]:
|
# Walk state machine to target status
|
||||||
if s in VALID_TRANSITIONS.get("pending", set()):
|
path_map = {
|
||||||
self.bb.update_task_status(cid, s, agent="test")
|
"claimed": ["claimed"],
|
||||||
if status == "review":
|
"working": ["claimed", "working"],
|
||||||
self.bb.update_task_status(cid, "review", agent="test")
|
"review": ["claimed", "working", "review"],
|
||||||
elif status == "done":
|
"done": ["claimed", "working", "review", "done"],
|
||||||
self.bb.update_task_status(cid, "review", agent="test")
|
"failed": ["claimed", "working", "failed"],
|
||||||
self.bb.update_task_status(cid, "done", agent="test")
|
"blocked": ["claimed", "working", "blocked"],
|
||||||
elif status == "failed":
|
"cancelled": ["cancelled"],
|
||||||
self.bb.update_task_status(cid, "failed", agent="test")
|
}
|
||||||
elif status == "cancelled":
|
for s in path_map.get(status, []):
|
||||||
self.bb.update_task_status(cid, "cancelled", agent="test")
|
self.bb.update_task_status(cid, s, agent="test")
|
||||||
|
|
||||||
def test_e51_all_done_parent_done(self):
|
def test_e51_all_done_parent_done(self):
|
||||||
self._create_child("c1", "done")
|
self._create_child("c1", "done")
|
||||||
@@ -377,8 +377,7 @@ class TestE5ParentAggregation:
|
|||||||
|
|
||||||
def test_e53_has_working_parent_working(self):
|
def test_e53_has_working_parent_working(self):
|
||||||
self._create_child("c5", "done")
|
self._create_child("c5", "done")
|
||||||
self._create_child("c6", "claimed")
|
self._create_child("c6", "working")
|
||||||
self.bb.update_task_status("c6", "working", agent="test")
|
|
||||||
result = self.q.compute_parent_status(self.parent_id)
|
result = self.q.compute_parent_status(self.parent_id)
|
||||||
assert result == "working"
|
assert result == "working"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user