Skip to content

ci: gate on mypy, so #266's ungating cannot quietly come undone - #268

Merged
eaitbrahim merged 1 commit into
mainfrom
ci/gate-on-mypy
Aug 13, 2026
Merged

ci: gate on mypy, so #266's ungating cannot quietly come undone#268
eaitbrahim merged 1 commit into
mainfrom
ci/gate-on-mypy

Conversation

@eaitbrahim

Copy link
Copy Markdown
Contributor

mypy ran in no workflow before this — it appeared only in a passing comment in code-quality.yml. #266 brought keel.* under the checker, but nothing enforced it: a type error in keel/ was a clean CI run.

Why a step, not a job

Added to the existing test job rather than as a typecheck: job of its own. The main ruleset requires the status context test, which comes from that job's id — a separate job would report a context nothing requires, so a red mypy would not block a merge. That is the same failure shape ci.yml's own header already warns about for renamed jobs. As a step, it inherits the gate.

release.yml gets it too, and deliberately re-runs it rather than trusting CI's result: that workflow is dispatched against whatever main is at the time, which need not be a commit any CI run went green on.

Neither workflow repeats the paths — they come from [tool.mypy]'s files in pyproject.toml, so a package moving in or out of the checked set stays a one-line edit there instead of one mirrored across two workflows.

CI only closes half the hole

Running mypy catches a type error in keel/. It cannot catch keel.* being re-added to an ignore_errors override — that silences the package wholesale, mypy exits 0 while checking nothing there, and #266's ungating is reverted with a green build to show for it.

test_keel_is_not_exempt_from_type_checking closes that. Both halves verified:

scenario mypy exit suite
type error injected into keel/sim/report.py 1 (fails CI)
keel.* restored to ignore_errors 0 (CI green) new test fails
neither 0 green

The middle row is the point: the guard catches exactly what CI cannot see.

tests.* and keel_core.* remain legitimately exempt, per the comments beside each in pyproject.toml. The guard pins only the module that was deliberately brought under the checker.

Verification

  • mypy — clean, 224 source files
  • ruff check keel tests packages — clean
  • pytest2727 passed, 1 skipped (2726 + the new guard)

🤖 Generated with Claude Code

`mypy` ran in NO workflow before this -- it appeared only in a passing comment
in `code-quality.yml`. #266 brought `keel.*` under the checker, but nothing
enforced that: a type error there was a clean CI run.

Added as a STEP in the existing `test` job, not a job of its own. The `main`
ruleset requires the status context `test`, which comes from that job's id, so
a separate `typecheck:` job would report a context nothing requires and a red
mypy would not block a merge -- the same failure shape `ci.yml`'s header
already warns about for renamed jobs. `release.yml` gets it too, and re-runs it
rather than trusting CI's: that workflow is dispatched against whatever `main`
is at the time, which need not be a commit any CI run went green on.

Neither workflow repeats the paths; they come from `[tool.mypy]`'s `files`.

CI closes only half the hole, though. It catches a type ERROR in `keel/`. It
cannot catch `keel.*` being re-added to an `ignore_errors` override, which
silences the package wholesale -- mypy then exits 0 while checking nothing
there, and the ungating is reverted with a green build to show for it. Verified
both halves: with a type error injected, mypy exits 1; with the exemption
restored, mypy exits 0 and only the new
`test_keel_is_not_exempt_from_type_checking` fails.

`tests.*` and `keel_core.*` stay legitimately exempt; the guard pins only the
module that was deliberately brought under the checker.

2726 -> 2727 tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@eaitbrahim
eaitbrahim merged commit 29d9b20 into main Aug 13, 2026
1 check passed
@eaitbrahim
eaitbrahim deleted the ci/gate-on-mypy branch August 13, 2026 16:47
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