Skip to content

Wire mypy into CI as a baseline-gated regression check - #434

Merged
squid-protocol merged 1 commit into
mainfrom
ci/430-mypy-baseline-gate
Jul 25, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
ci/430-mypy-baseline-gate

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Part 1 of #429 (mypy type-safety epic; #431-#433 are the actual fix-up work). This PR only wires the gate.

  • `tests/mypy_audit.py` mirrors `tests/dead_key_audit.py`'s already-established pattern: run the real checker, diff against a committed baseline, fail only on genuinely new hits.
  • Seeded `tests/mypy_audit_baseline.json` with the 228 unique `{file}:{line}:{code}` errors `mypy gitgalaxy/ --ignore-missing-imports` currently reports (235 raw hits collapse to 228 unique keys -- 5 lines carry multiple distinct errors of the same code on one line; documented as a known limitation rather than engineered around with a more fragile per-occurrence key).
  • New `.github/workflows/mypy-audit.yml`, same shape as `dead-key-audit.yml`.
  • Fixed `.gitignore`'s blanket `.json` rule, which was silently blocking `git add` on the new baseline file (added `!tests/_baseline.json`).

Test plan

  • `python tests/mypy_audit.py --ci` reports clean against the fresh baseline
  • Temporarily removed one baseline entry -- correctly flagged as exactly 1 new error, exit 1; restored -- back to clean, exit 0
  • Verified against a from-scratch venv matching the workflow's exact install steps
  • `flake8`, `dead_key_audit.py --ci`, full `pytest tests/` (866 passed, 1 deselected, 1 pre-existing xfail) all clean

Adds tests/mypy_audit.py, mirroring tests/dead_key_audit.py's already-
established pattern: run the real checker, diff against a committed
baseline, fail only on genuinely new hits so this doesn't block every
unrelated PR on day one.

Seeded the baseline with the 228 unique {file}:{line}:{code} errors
`mypy gitgalaxy/ --ignore-missing-imports` currently reports (235 raw
hits, collapsing to 228 unique keys -- 5 lines carry multiple distinct
errors of the same code; documented as a known, accepted limitation
in the module docstring rather than over-engineered around).

Verified: --ci reports clean against the freshly-generated baseline;
temporarily removing one baseline entry correctly flags exactly one
new error and exits 1; restoring it returns to a clean exit 0. Also
fixed .gitignore's blanket `*.json` rule silently blocking `git add`
on the new baseline file (same rule that would have blocked
dead_key_audit_baseline.json too, had it not predated the rule) --
added an explicit `!tests/*_baseline.json` carve-out.

Fixing the actual 228 errors is #431 (root-cause fan-out fixes),
#432 (core engine), and #433 (long tail) -- this PR only wires the gate.
Comment thread tests/mypy_audit.py
import subprocess
import sys
from pathlib import Path
from typing import Dict, List
@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 57d1a61 into main Jul 25, 2026
26 checks passed
@squid-protocol
squid-protocol deleted the ci/430-mypy-baseline-gate branch July 25, 2026 15:40
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.

2 participants