feat(orchestration): enforce verified completion and cross-department fan-out
Deploy Canina / deploy (push) Successful in 2m8s
Deploy Canina / deploy (push) Successful in 2m8s
This commit is contained in:
1 parent
624f58c723
commit
4c3f8de1fb
6 files changed
+551
-1
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import json
|
||||
import unittest
|
||||
|
||||
from orchestration_worker import (
|
||||
build_child_tasks,
|
||||
determine_parent_status,
|
||||
parse_structured_response,
|
||||
)
|
||||
|
||||
|
||||
class OrchestrationWorkerTests(unittest.TestCase):
|
||||
def test_unverified_model_response_can_never_be_done(self):
|
||||
self.assertEqual(
|
||||
determine_parent_status(has_children=False, deliverable_url=None, verified=False),
|
||||
"TEST",
|
||||
)
|
||||
self.assertEqual(
|
||||
determine_parent_status(has_children=False, deliverable_url="https://canina.ir/x", verified=False),
|
||||
"TEST",
|
||||
)
|
||||
|
||||
def test_verified_live_deliverable_may_be_done(self):
|
||||
self.assertEqual(
|
||||
determine_parent_status(has_children=False, deliverable_url="https://canina.ir/x", verified=True),
|
||||
"DONE",
|
||||
)
|
||||
|
||||
def test_children_force_waiting_dependencies(self):
|
||||
self.assertEqual(
|
||||
determine_parent_status(has_children=True, deliverable_url=None, verified=False),
|
||||
"WAITING_DEPENDENCIES",
|
||||
)
|
||||
|
||||
def test_parse_json_code_fence(self):
|
||||
payload = parse_structured_response('```json\n{"summary":"ok","child_tasks":[]}\n```')
|
||||
self.assertEqual(payload["summary"], "ok")
|
||||
|
||||
def test_child_task_codes_are_deterministic_and_include_parent(self):
|
||||
proposal = {
|
||||
"child_tasks": [
|
||||
{
|
||||
"department": "CONTENT",
|
||||
"title": "تدوین مقاله",
|
||||
"description": "مقاله مستند",
|
||||
"priority": "HIGH",
|
||||
"acceptance_criteria": ["پیشنویس موجود باشد"],
|
||||
}
|
||||
]
|
||||
}
|
||||
first = build_child_tasks("TSK-390939", proposal, depth=0)
|
||||
second = build_child_tasks("TSK-390939", proposal, depth=0)
|
||||
self.assertEqual(first[0]["code"], second[0]["code"])
|
||||
self.assertEqual(first[0]["acceptanceCriteria"]["parentTaskCode"], "TSK-390939")
|
||||
self.assertEqual(first[0]["acceptanceCriteria"]["depth"], 1)
|
||||
|
||||
def test_depth_limit_blocks_recursive_fanout(self):
|
||||
proposal = {"child_tasks": [{"department": "SEO", "title": "x"}]}
|
||||
self.assertEqual(build_child_tasks("TSK-1", proposal, depth=2), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user