fix(imports): break models<->dag_engine circular dependency
Track.get_executable_tickets (in models.py) called TrackDAG at runtime, forcing a top-level import of src.dag_engine into models.py and creating a 2-cycle that broke whichever module loaded second (Ticket was not yet defined when models.py loaded first; TrackDAG was not yet defined when dag_engine.py loaded first). Fix: hoist the method out of the Track dataclass and into a free function get_executable_tickets(track) in dag_engine.py. models.py no longer needs TrackDAG at all, so the cycle is one-directional (models -> dag_engine) and resolves cleanly in any import order. Tests updated: - tests/test_mma_models.py: import get_executable_tickets and call it instead of track.get_executable_tickets() (4 call sites) - tests/test_conductor_engine_v2.py: comment update Verified both import orders resolve cleanly: forward: import src.models; import src.dag_engine -> OK reverse: import src.dag_engine; import src.models -> OK 34 tests pass (test_mma_models, test_dag_engine, test_execution_engine, test_arch_boundary_phase3, test_track_state_schema).
This commit is contained in:
@@ -55,7 +55,7 @@ def test_conductor_engine_run_executes_tickets_in_order(monkeypatch: pytest.Monk
|
||||
vlogger.log_state("T1 Status Final", "todo", ticket1.status)
|
||||
vlogger.log_state("T2 Status Final", "todo", ticket2.status)
|
||||
|
||||
# Track.get_executable_tickets() should be called repeatedly until all are done
|
||||
# get_executable_tickets(track) should be called repeatedly until all are done
|
||||
# T1 should run first, then T2.
|
||||
assert mock_lifecycle.call_count == 2
|
||||
assert ticket1.status == "completed"
|
||||
|
||||
Reference in New Issue
Block a user