Skip to content

Clear all 6 mypy errors in llm_recorder.py (#432 session 12) - #458

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

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

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

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

_build_markdown() is one large function (~1100 lines), and three short-lived local variable names got reused across unrelated blocks within its single scope, each colliding with a type already established for that name elsewhere in the function:

  • s at line 809 (Optional[Dict[str, Any]] from file_map.get(p)) collided with the for s in parsed_files convention (non-Optional Dict[str, Any]) used throughout the rest of the function. Renamed to matched_file at its point of use.
  • struct_hits at line 1081 (List[Tuple[str, int]]) collided with an earlier struct_hits: List[str] accumulator at line 924. Renamed to struct_signal_hits. This is also what caused the "Unpacking a string is disallowed" error a few lines down -- for k, v in struct_hits[:4] was unpacking the old List[str] binding, not the tuple list actually being built at that point.
  • p = file_data.get("path") (line 1411) was missing the default every other .get("path", ...) call in this file supplies. A parsed_files entry with no "path" key would silently produce p = None, later crashing Path(p).name with a TypeError. Added the same "" default used at lines 91/107 -- a genuine latent-bug fix, not cosmetic.

Baseline: 41 -> 35 unique entries.

Test plan

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

_build_markdown() is one large function (~1100 lines), and three
short-lived local variable names got reused across unrelated blocks
within its single scope, each time colliding with a type already
established for that name elsewhere in the function:

- `s` at line 809 (Optional[Dict[str, Any]] from file_map.get(p))
  collided with the `for s in parsed_files` convention (non-Optional
  Dict[str, Any]) used throughout the rest of the function. Renamed
  to `matched_file` at its point of use.
- `struct_hits` at line 1081 (List[Tuple[str, int]]) collided with
  an earlier `struct_hits: List[str]` accumulator at line 924.
  Renamed to `struct_signal_hits`. This is also what caused the
  "Unpacking a string is disallowed" error a few lines down --
  `for k, v in struct_hits[:4]` was unpacking the OLD List[str]
  binding, not the tuple list actually being built here.
- `p = file_data.get("path")` (line 1411) was missing the default
  every other `.get("path", ...)` call in this file supplies,
  meaning a parsed_files entry with no "path" key would silently
  produce `p = None`, later crashing `Path(p).name` with a
  TypeError. Added the same `""` default used at line 91/107.

Baseline: 41 -> 35 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 50165ac into main Jul 25, 2026
26 checks passed
@squid-protocol
squid-protocol deleted the fix/432-llm-recorder-typing branch July 25, 2026 19:28
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