test(stabilization): Resolve run_linear API drift and implement vlogger high-signal reporting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import pytest
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
import json
|
||||
from typing import Any
|
||||
@@ -56,7 +56,8 @@ def test_topological_sort_circular() -> None:
|
||||
{"id": "T-001", "depends_on": ["T-002"]},
|
||||
{"id": "T-002", "depends_on": ["T-001"]}
|
||||
]
|
||||
with pytest.raises(ValueError, match="Circular dependency detected"):
|
||||
# Align with conductor_tech_lead.py wrapping of DAG errors
|
||||
with pytest.raises(ValueError, match="DAG Validation Error"):
|
||||
conductor_tech_lead.topological_sort(tickets)
|
||||
|
||||
def test_track_executable_tickets() -> None:
|
||||
@@ -73,25 +74,34 @@ def test_track_executable_tickets() -> None:
|
||||
assert executable[0].id == "T2"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_conductor_engine_run_linear() -> None:
|
||||
async def test_conductor_engine_run(vlogger) -> None:
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="user")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="user", depends_on=["T1"])
|
||||
track = Track(id="track_1", description="desc", tickets=[t1, t2])
|
||||
engine = multi_agent_conductor.ConductorEngine(track)
|
||||
engine = multi_agent_conductor.ConductorEngine(track, auto_queue=True)
|
||||
|
||||
vlogger.log_state("T1 Initial Status", "todo", t1.status)
|
||||
vlogger.log_state("T2 Initial Status", "todo", t2.status)
|
||||
|
||||
with patch("multi_agent_conductor.run_worker_lifecycle") as mock_worker:
|
||||
# Mock worker to complete tickets
|
||||
|
||||
def complete_ticket(ticket, context, **kwargs):
|
||||
def complete_ticket(ticket, context, *args, **kwargs):
|
||||
ticket.status = "completed"
|
||||
mock_worker.side_effect = complete_ticket
|
||||
await engine.run_linear()
|
||||
await engine.run()
|
||||
|
||||
vlogger.log_state("T1 Final Status", "todo", t1.status)
|
||||
vlogger.log_state("T2 Final Status", "todo", t2.status)
|
||||
|
||||
assert t1.status == "completed"
|
||||
assert t2.status == "completed"
|
||||
assert mock_worker.call_count == 2
|
||||
vlogger.finalize("Orchestration Logic - Conductor Engine", "PASS", "Dependency order honored during run.")
|
||||
|
||||
def test_conductor_engine_parse_json_tickets() -> None:
|
||||
track = Track(id="track_1", description="desc")
|
||||
engine = multi_agent_conductor.ConductorEngine(track)
|
||||
engine = multi_agent_conductor.ConductorEngine(track, auto_queue=True)
|
||||
json_data = json.dumps([
|
||||
{"id": "T1", "description": "desc 1", "depends_on": []},
|
||||
{"id": "T2", "description": "desc 2", "depends_on": ["T1"]}
|
||||
@@ -109,3 +119,4 @@ def test_run_worker_lifecycle_blocked(mock_ai_client: Any) -> None:
|
||||
multi_agent_conductor.run_worker_lifecycle(ticket, context)
|
||||
assert ticket.status == "blocked"
|
||||
assert ticket.blocked_reason == "BLOCKED because of missing info"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user