You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REFACTOR] Fix root-cause type annotations causing mypy error fan-out #431
priority: highCore feature broken, but workarounds existpythonPython-specific runtime or environment optimizationsrefactorStructural cleanup or optimization without altering behavior
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.
All of this issue's explicitly-named root causes are fixed:
`RECORDING_SCHEMAS` (`analysis_lens.py`) -- added a `RecordingSchemas` `TypedDict`. Resolved 42 fan-out errors across `galaxyscope.py`, `signal_processor.py`, `record_keeper.py`, `prism.py` without touching those files.
`import importlib` without `import importlib.util` (`galaxyscope.py:70`) -- fixed.
Heterogeneous dict literals needing a `TypedDict` -- `record_keeper.py`'s `folder_stats[p]` (the example this issue named directly) got a `FolderStats` `TypedDict`, resolving 15 errors. The same pattern also showed up in `language_lens.py`'s `LENS_CONFIG` (not yet discovered when this issue was filed) -- same fix, `LensConfig` `TypedDict`, resolved 20 more.
The `record_keeper.py:512` `None`-assigned-to-`float` case flagged as "review individually, don't blanket-suppress" -- confirmed genuine and intentional (zero-dependency mode maps to real SQL `NULL`, not `0.0`, to avoid an unavailable metric looking like a measured "zero risk"). Annotated `Optional[float]` rather than changing the `None`.
Net effect on the baseline: 228 → 126 unique entries (45%) since this epic started, though not all of that reduction is root-cause fan-out specifically -- some came from fixing files directly (see #432's progress).
Closing this one -- the specifically-scoped root-cause hunt is done. Any new root causes turned up while working through #432/#433 are the same class of fix, so I'll just apply them inline rather than reopening this.
priority: highCore feature broken, but workarounds existpythonPython-specific runtime or environment optimizationsrefactorStructural cleanup or optimization without altering behavior
Activity
Wire mypy into CI as a baseline-gated regression check (#430) (#434)
Type RECORDING_SCHEMAS as a TypedDict, resolving 42 fan-out mypy erro…
Clear all 14 mypy errors in galaxyscope.py (#431 session 2) (#438)
Clear all 16 mypy errors in record_keeper.py (#431 session 3)
Clear all 16 mypy errors in record_keeper.py (#431 session 3) (#440)
Clear all 27 mypy errors in language_lens.py (#431 session 4)
Clear all 27 mypy errors in language_lens.py (#431 session 4) (#442)
squid-protocol commentedon Jul 25, 2026
All of this issue's explicitly-named root causes are fixed:
Net effect on the baseline: 228 → 126 unique entries (45%) since this epic started, though not all of that reduction is root-cause fan-out specifically -- some came from fixing files directly (see #432's progress).
Closing this one -- the specifically-scoped root-cause hunt is done. Any new root causes turned up while working through #432/#433 are the same class of fix, so I'll just apply them inline rather than reopening this.
Clear all 22 mypy errors in signal_processor.py (#432 session 5) (#444)
Clear all 18 mypy errors in detector.py (#432 session 6) (#446)
Clear all 8 mypy errors in prism.py (#432 session 7) (#448)