# Track Specification: Strict Static Analysis & Type Safety (strict_static_analysis_and_typing_20260302)

## Overview
The codebase currently suffers from massive type-safety debt (512+ `mypy` errors across 64 files) and lingering `ruff` violations. This track will harden the foundation by resolving all violations, enforcing strict typing (especially in `gui_2.py` and `api_hook_client.py`), and integrating pre-commit checks. This is a prerequisite for safe AI-driven refactoring.

## Architectural Constraints: The "Strict Typing Contract"
- **No Implicit Any**: Variables and function returns must have explicit types.
- **No Ignored Errors**: Do not use `# type: ignore` unless absolutely unavoidable (e.g., for poorly typed third-party C bindings). If used, it must include a specific error code.
- **Strict Optionals**: All optional types must be explicitly defined (e.g., `str | None`).

## Functional Requirements
- **Mypy Resolution**: Fix all 512+ existing `mypy` errors.
- **Ruff Resolution**: Fix all remaining `ruff` linting violations.
- **Configuration**: Update `pyproject.toml` or `mypy.ini` to enforce strict type checking globally.
- **CI/Automation**: Implement a pre-commit hook or script (`scripts/check_hints.py` equivalent) to block untyped code.

## Acceptance Criteria
- [ ] `uv run mypy --strict .` returns 0 errors.
- [ ] `uv run ruff check .` returns 0 violations.
- [ ] No new `# type: ignore` comments are added without justification.
- [ ] Pre-commit hook or validation script is documented and active.