-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
julesTask for Jules AITask for Jules AImediumMedium priorityMedium priorityrefactorCode refactoringCode refactoring
Description
Task Type
refactor - Type safety improvement
Component
Multiple modules
Problem Description
15+ instances of Any type used where specific types should be defined. This defeats the purpose of type hints and allows type errors at runtime.
Files to Modify (Top Priority)
vertice_cli/core/resilience.py- Multiple Any returnsvertice_cli/core/metrics.py- Dict[str, Any] overusevertice_cli/handlers/tool_execution_handler.py- Any parametersvertice_tui/core/llm_client.py- Response typing
Current Code (Problematic)
# Common patterns to fix:
def process(self, data: Any) -> Any: # What is data? What is returned?
...
config: Dict[str, Any] = {} # What keys? What value types?Expected Code (Fix)
from typing import TypedDict, Union
from dataclasses import dataclass
# Option 1: TypedDict for structured dicts
class MetricsConfig(TypedDict):
enabled: bool
interval: float
exporters: list[str]
config: MetricsConfig = {"enabled": True, "interval": 60.0, "exporters": []}
# Option 2: Dataclass for complex types
@dataclass
class ProcessResult:
success: bool
data: str
errors: list[str]
def process(self, data: InputData) -> ProcessResult:
...
# Option 3: Union for known variants
ResponseType = Union[TextResponse, StreamResponse, ErrorResponse]Validation Commands
# Run mypy to check types
mypy vertice_cli/core/resilience.py --ignore-missing-imports
# Count remaining Any usage (should decrease)
grep -rn ": Any" vertice_cli/ --include="*.py" | wc -l
# Run tests
pytest tests/unit/ -vPriority
medium
References
- Python typing best practices
- Audit ID: TYPE-001
Metadata
Metadata
Assignees
Labels
julesTask for Jules AITask for Jules AImediumMedium priorityMedium priorityrefactorCode refactoringCode refactoring