Skip to content

Clear all 8 mypy errors in prism.py (#432 session 7) - #448

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

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

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Session 7 of the mypy cleanup epic (#432), following the same one-file-per-session pattern as sessions 1-6.

  • PRISM_CONFIG in language_standards.py had mixed str/set/dict values that mypy widened to Collection[str], breaking every .get()/re.compile() call on it in prism.py -- the same shape of problem LENS_CONFIG had in [REFACTOR] Fix root-cause type annotations causing mypy error fan-out #431. Fixed with a PrismConfigSchema TypedDict, mirroring the existing LensConfig pattern.
  • _find_balanced_end's limit is declared to return int, but EMBEDDED_LOOKAHEAD_LIMIT (sourced from LENS_CONFIG["THRESHOLDS"], typed Dict[str, float]) made the min() expression a float. Wrapped in int(...) -- the value is a character offset, so this matches intent and isn't just a cosmetic silence.
  • string_cache in _strip_nested_comments needed an explicit Dict[str, str] annotation.

Baseline: 86 -> 78 unique entries.

Test plan

  • mypy gitgalaxy/ --ignore-missing-imports in the CI-matching minimal venv: all 8 prism.py errors resolved, no fan-out regressions elsewhere
  • python tests/mypy_audit.py --ci: passes against the regenerated 78-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

PRISM_CONFIG (language_standards.py) mixed str/set/dict values were
widening to Collection[str] under mypy, the same problem LENS_CONFIG
had in #431 -- every .get()/re.compile() call on it in prism.py
errored. Fixed with a PrismConfigSchema TypedDict, mirroring the
LensConfig pattern.

Two smaller fixes in prism.py itself:
- _find_balanced_end's `limit` is declared to return int, but
  EMBEDDED_LOOKAHEAD_LIMIT (LENS_CONFIG["THRESHOLDS"], typed
  Dict[str, float]) made the min() expression a float. Wrapped in
  int() -- the value is a character offset, so this matches intent.
- string_cache in _strip_nested_comments needed an explicit
  Dict[str, str] annotation.

Baseline: 86 -> 78 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 70fcf98 into main Jul 25, 2026
26 checks passed
@squid-protocol
squid-protocol deleted the fix/432-prism-typing branch July 25, 2026 18:51
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