Skip to content

[CI/CD] Wire mypy into CI as a baseline-gated regression check #430

Description

@squid-protocol

🎯 Objective

Add mypy as a required CI check, gated against a committed baseline so it fails only on new type errors -- not the existing 235 (see #429 for the measured breakdown). Same pattern as `tests/dead_key_audit.py`.

🛠️ Implementation

  • `tests/mypy_audit.py`: runs `mypy gitgalaxy/ --ignore-missing-imports`, parses output into `{file}:{line}: {code}` keys, diffs against a committed `tests/mypy_audit_baseline.json`.
  • Baseline entries no longer reproduced should be reported as FYI (encourage shrinking the baseline in the same PR that fixes them), mirroring `dead_key_audit.py`'s `run_ci_check()`.
  • New workflow (or a job in an existing one) running `python tests/mypy_audit.py --ci`.
  • Seed the baseline with the current 235 errors so this lands with zero required fixes -- the fixing work is [CI/CD] Wire mypy into CI as a baseline-gated regression check #430/[REFACTOR] Fix root-cause type annotations causing mypy error fan-out #431 (or equivalent numbers once filed).

Known limitation to document

Baseline keys include line numbers, so unrelated edits elsewhere in a file can shift them and produce spurious "new" errors needing a baseline refresh, even when nothing type-relevant changed. This is a standard, accepted tradeoff for line-based mypy baselining (not a bug) -- document it in the script's docstring like dead_key_audit.py's own "SCOPE & LIMITATIONS" section.

Parent: #429

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci-cdContinuous integration, delivery, and automated runnerspythonPython-specific runtime or environment optimizationstestingUnit, integration, and E2E pipeline verification

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions