refactor(sdm): Global pass with refined 'External Only' SDM tags. Pruned redundant internal references and fixed indentation logic in injector. Verified full project compilation.
This commit is contained in:
+20
-11
@@ -9,7 +9,8 @@ from src.dag_engine import TrackDAG
|
||||
|
||||
def test_get_ready_tasks_linear():
|
||||
"""
|
||||
Verifies ready tasks detection in a simple linear dependency chain.
|
||||
|
||||
Verifies ready tasks detection in a simple linear dependency chain.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -20,8 +21,9 @@ def test_get_ready_tasks_linear():
|
||||
|
||||
def test_get_ready_tasks_branching():
|
||||
"""
|
||||
Verifies ready tasks detection in a branching dependency graph where multiple tasks
|
||||
are unlocked simultaneously after a prerequisite is met.
|
||||
|
||||
Verifies ready tasks detection in a branching dependency graph where multiple tasks
|
||||
are unlocked simultaneously after a prerequisite is met.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="completed", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -35,7 +37,8 @@ def test_get_ready_tasks_branching():
|
||||
|
||||
def test_has_cycle_no_cycle():
|
||||
"""
|
||||
Validates that an acyclic graph is correctly identified as not having cycles.
|
||||
|
||||
Validates that an acyclic graph is correctly identified as not having cycles.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -44,7 +47,8 @@ def test_has_cycle_no_cycle():
|
||||
|
||||
def test_has_cycle_direct_cycle():
|
||||
"""
|
||||
Validates that a direct cycle (A depends on B, B depends on A) is correctly detected.
|
||||
|
||||
Validates that a direct cycle (A depends on B, B depends on A) is correctly detected.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1", depends_on=["T2"])
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -53,7 +57,8 @@ def test_has_cycle_direct_cycle():
|
||||
|
||||
def test_has_cycle_indirect_cycle():
|
||||
"""
|
||||
Validates that an indirect cycle (A->B->C->A) is correctly detected.
|
||||
|
||||
Validates that an indirect cycle (A->B->C->A) is correctly detected.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1", depends_on=["T3"])
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -63,7 +68,8 @@ def test_has_cycle_indirect_cycle():
|
||||
|
||||
def test_has_cycle_complex_no_cycle():
|
||||
"""
|
||||
Validates cycle detection in a complex graph that merges branches but remains acyclic.
|
||||
|
||||
Validates cycle detection in a complex graph that merges branches but remains acyclic.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -74,7 +80,8 @@ def test_has_cycle_complex_no_cycle():
|
||||
|
||||
def test_get_ready_tasks_multiple_deps():
|
||||
"""
|
||||
Validates that a task is not marked ready until ALL of its dependencies are completed.
|
||||
|
||||
Validates that a task is not marked ready until ALL of its dependencies are completed.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="completed", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1")
|
||||
@@ -87,7 +94,8 @@ def test_get_ready_tasks_multiple_deps():
|
||||
|
||||
def test_topological_sort():
|
||||
"""
|
||||
Verifies that tasks are correctly ordered by dependencies regardless of input order.
|
||||
|
||||
Verifies that tasks are correctly ordered by dependencies regardless of input order.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
@@ -98,10 +106,11 @@ def test_topological_sort():
|
||||
|
||||
def test_topological_sort_cycle():
|
||||
"""
|
||||
Verifies that topological sorting safely aborts and raises ValueError when a cycle is present.
|
||||
|
||||
Verifies that topological sorting safely aborts and raises ValueError when a cycle is present.
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="desc", status="todo", assigned_to="worker1", depends_on=["T2"])
|
||||
t2 = Ticket(id="T2", description="desc", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
dag = TrackDAG([t1, t2])
|
||||
with pytest.raises(ValueError, match="Dependency cycle detected"):
|
||||
dag.topological_sort()
|
||||
dag.topological_sort()
|
||||
Reference in New Issue
Block a user