🎯 Objective
A small number of type-annotation root causes are responsible for a disproportionate share of the 235 mypy errors measured in #429. Fix these first, before the file-by-file cleanup in the other sub-issues -- the fan-out should shrink the total error count significantly with a handful of targeted, low-risk changes.
🛠️ Known root causes (confirmed, not guessed)
- `RECORDING_SCHEMAS` values typed as `Collection[str]` instead of `List[str]` (`gitgalaxy/standards/analysis_lens.py`) -- `SIGNAL_SCHEMA`/`RISK_SCHEMA` are built via `config.RECORDING_SCHEMAS.get(...)`, and `Collection` doesn't guarantee `.index()`. This alone produces ~15+ `"Collection[str]" has no attribute "index"` errors across `galaxyscope.py`, `record_keeper.py`, `signal_processor.py`, and others.
- `import importlib` without `import importlib.util` (`gitgalaxy/galaxyscope.py:70`) -- `importlib.util.find_spec` is used but only `importlib` is imported; works at runtime today only because something else transitively imports `importlib.util` first, which is fragile. One-line fix.
- Heterogeneous dict literals without a TypedDict (e.g. `record_keeper.py`'s `folder_stats[p]` -- a dict mixing `int`, `float`, and `list` values) -- mypy collapses per-key access to `object`, producing `"object" has no attribute "append"` / `Unsupported operand types for +` errors. Needs a small local `TypedDict` per such structure, not a real bug fix.
Note
Not everything under the `assignment`/`arg-type`/`return-value` codes is mechanical -- at least one (`record_keeper.py:512`, `None` assigned to a `float`-typed variable) looks like it could be a genuine latent bug. Review each individually rather than blanket-suppressing.
Parent: #429
🎯 Objective
A small number of type-annotation root causes are responsible for a disproportionate share of the 235 mypy errors measured in #429. Fix these first, before the file-by-file cleanup in the other sub-issues -- the fan-out should shrink the total error count significantly with a handful of targeted, low-risk changes.
🛠️ Known root causes (confirmed, not guessed)
Note
Not everything under the `assignment`/`arg-type`/`return-value` codes is mechanical -- at least one (`record_keeper.py:512`, `None` assigned to a `float`-typed variable) looks like it could be a genuine latent bug. Review each individually rather than blanket-suppressing.
Parent: #429