Skip to content

Clear all 22 mypy errors in signal_processor.py (#432 session 5) - #444

Merged
squid-protocol merged 1 commit into
mainfrom
fix/432-signal-processor-typing
Jul 25, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/432-signal-processor-typing

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Part of #429/#432, one file per session. This session: `signal_processor.py` (the largest remaining file, 22 errors).

Two `TypedDict`s plus six annotations -- no shared/exported schema this time, so most of these stayed function-local:

  • `ai_topology`: mixes a `str`, a `List[str]`, and later a `Dict[str, float]` in one literal, widening to `Sequence[str]` (the structural ancestor of `str` and `List[str]`) under mypy -- which has no `.append()`. Local to one function, so annotated `Dict[str, Any]` rather than adding a dedicated `TypedDict`, matching `galaxyscope.py`'s `observation` precedent from session 2.
  • `directory_group_data`: same "object" widening as `record_keeper.py`'s `folder_stats` (int/float/`List[float]` mix). Added a `DirectoryGroupData` `TypedDict` this time since it's used across more of the function.
  • `fingerprint`/`local_fingerprint` → `Dict[str, float]`, `archetype_counts`/`static_counts` → `Dict[str, int]`, `ecosystem_fingerprint` → `Dict[str, Dict[str, Any]]`, `bottlenecks` → `Dict[str, List[Dict[str, Any]]]`, `report` → `Dict[str, Any]` (a wide result structure whose sibling values are different nested shapes -- not worth a `TypedDict`).

126 → 104 unique baseline entries.

Test plan

  • `signal_processor.py`: `Success: no issues found in 1 source file`
  • Baseline regenerated in the minimal env `mypy-audit.yml` actually uses
  • `flake8`, `dead_key_audit.py --ci`, full `pytest tests/` (866 passed, 1 deselected, 1 pre-existing xfail) all clean

Two TypedDicts plus six annotations:

- `ai_topology`: mixes a str, a List[str], and later a Dict[str, float]
  in one literal, widening to Sequence[str] (the structural ancestor of
  str and List[str]) under mypy -- which has no .append(). Since this
  shape is local to one function (not a shared schema like #431's
  RECORDING_SCHEMAS/LENS_CONFIG), annotated Dict[str, Any] rather than
  adding a dedicated TypedDict, matching galaxyscope.py's `observation`
  precedent.

- `directory_group_data`: mixes int/float/List[float] per entry, same
  "object" widening as record_keeper.py's folder_stats. Added a
  DirectoryGroupData TypedDict this time (used across a longer stretch
  of the function than ai_topology, worth naming).

- `fingerprint`/`local_fingerprint`: Dict[str, float], matching
  _classify_archetype's own declared Tuple[str, float, Dict[str, float]]
  return type.

- `archetype_counts`/`static_counts`: Dict[str, int] tallies.

- `ecosystem_fingerprint`: Dict[str, Dict[str, Any]].

- `bottlenecks`: Dict[str, List[Dict[str, Any]]], matching what's later
  .append()'d into each of its three keys.

- `report`: Dict[str, Any] -- a wide result structure whose sibling
  literal values (file_impact, function_impact, systemic_bottlenecks,
  ...) are different nested shapes; mypy's per-key inference on a plain
  dict literal doesn't keep them distinct, and a TypedDict for
  something this wide isn't worth it.

126 -> 104 unique baseline entries.

Verified: signal_processor.py reports zero mypy errors after this
change ("Success: no issues found in 1 source file"). flake8,
dead_key_audit.py --ci, full pytest suite (866 passed, 1 deselected,
1 pre-existing xfail) all clean.
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 3849798 into main Jul 25, 2026
26 checks passed
@squid-protocol
squid-protocol deleted the fix/432-signal-processor-typing branch July 25, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant