feat(types): Resolve strict mypy errors in conductor subsystem

This commit is contained in:
2026-03-04 01:13:42 -05:00
parent 6ebbf40d9d
commit c5ee50ff0b
4 changed files with 17 additions and 16 deletions

View File

@@ -2,8 +2,9 @@ import json
import ai_client
import mma_prompts
import re
from typing import Any
def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict]:
def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict[str, Any]]:
"""
Tier 2 (Tech Lead) call.
Breaks down a Track Brief and module skeletons into discrete Tier 3 Tickets.
@@ -18,7 +19,7 @@ def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict]:
)
# Set custom system prompt for this call
old_system_prompt = ai_client._custom_system_prompt
ai_client.set_custom_system_prompt(system_prompt)
ai_client.set_custom_system_prompt(system_prompt or "")
ai_client.current_tier = "Tier 2"
try:
# 3. Call Tier 2 Model
@@ -38,20 +39,20 @@ def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict]:
match = re.search(r'\[\s*\{.*\}\s*\]', json_match, re.DOTALL)
if match:
json_match = match.group(0)
tickets = json.loads(json_match)
tickets: list[dict[str, Any]] = json.loads(json_match)
return tickets
except Exception as e:
print(f"Error parsing Tier 2 response: {e}")
return []
finally:
# Restore old system prompt and clear tier tag
ai_client.set_custom_system_prompt(old_system_prompt)
ai_client.set_custom_system_prompt(old_system_prompt or "")
ai_client.current_tier = None
from dag_engine import TrackDAG
from models import Ticket
def topological_sort(tickets: list[dict]) -> list[dict]:
def topological_sort(tickets: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""
Sorts a list of tickets based on their 'depends_on' field.
Raises ValueError if a circular dependency or missing internal dependency is detected.
@@ -76,4 +77,3 @@ if __name__ == "__main__":
test_skeletons = "class NewFeature: pass"
tickets = generate_tickets(test_brief, test_skeletons)
print(json.dumps(tickets, indent=2))