Skip to content

Clear all 8 mypy errors in security_lens.py, plus a leftover spatial_mapper.py fix (#432 session 9) - #452

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

squid-protocol merged 1 commit into
mainfrom
fix/432-security-lens-typing

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Session 9 of the mypy cleanup epic (#432).

security_lens.py (8 errors): five missing local annotations in scan_content() (counts: Dict[str, int], snippets/entropy_snippets/taint_snippets as List[str]-shaped), and threats: Dict[str, Any] in scan_binary() -- that last one is genuinely heterogeneous (int flags alongside a str "threat_snippet" message in the same dict), confirmed against its consumers (galaxyscope.py, binary_anomaly_detector.py), which read both shapes generically via .get().

spatial_mapper.py (1 error, incidental): a leftover from session 8 (#450). That PR's fix resolved 12 of that file's 13 errors, but my verification grep was piped through head -20 and silently truncated the file list, so I never noticed 1 remained -- it was harmlessly preserved unchanged in the regenerated baseline the whole time. Now fixed for real: an outer for b in bins_to_check loop variable (int, a bin index) was being reused a few lines later for an unrelated quadratic-formula coefficient (float). Harmless in practice since the two uses don't interact, but a real naming collision worth removing. Renamed the coefficient to qb.

Baseline: 66 -> 57 unique entries.

Test plan

  • mypy gitgalaxy/ --ignore-missing-imports (fresh .mypy_cache) in the CI-matching minimal venv: both files' errors resolved, no fan-out regressions elsewhere
  • python tests/mypy_audit.py --ci: passes against the regenerated 57-entry baseline
  • flake8 . --count --select=E9,F63,F7,F82: 0
  • python tests/dead_key_audit.py --ci: no new findings
  • Full pytest tests/ -q in the full-precision venv: run in progress, will confirm green before merge

🤖 Generated with Claude Code

…mapper.py naming collision (#432 session 9)

security_lens.py: five missing local annotations (counts: Dict[str,
int], snippets/entropy_snippets/taint_snippets: List[str]-shaped)
in scan_content(), and threats: Dict[str, Any] in scan_binary() --
that last one is genuinely heterogeneous (int flags alongside a str
"threat_snippet" message under the same dict), confirmed by its
consumers (galaxyscope.py, binary_anomaly_detector.py) reading both
shapes via .get() generically.

spatial_mapper.py: a leftover from session 8 (#450) -- that PR's
mypy fix resolved 12 of that file's 13 errors, but my verification
grep was piped through `head -20` and silently truncated the file
list, so I never noticed 1 remained (harmlessly preserved unchanged
in the regenerated baseline the whole time). Now fixed for real: an
outer `for b in bins_to_check` loop variable (int, a bin index) was
being reused a few lines later for an unrelated quadratic-formula
coefficient (float), which is what mypy was actually flagging.
Harmless in practice since the two uses don't interact, but a real
naming collision worth removing regardless. Renamed the coefficient
to `qb`.

Baseline: 66 -> 57 unique entries.
@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 8227697 into main Jul 25, 2026
26 checks passed
@squid-protocol
squid-protocol deleted the fix/432-security-lens-typing branch July 25, 2026 19:07
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