Files
Luis Novo 8c85728de2 ci: gate PRs on mypy, start ignore_errors burn-down (#1076)
* ci: gate PRs on mypy, start ignore_errors burn-down

Add a backend-typecheck CI job running uv run python -m mypy . and bring
the repo-wide baseline from 197 errors to 0 so the gate blocks new type
errors from now on:

- enable the pydantic mypy plugin (resolves 138 false positives on
  models whose fields have Field(None, ...) defaults)
- fix the remaining errors with real annotations; the only new type:
  ignore comments cover a genuine langgraph typing limitation (partial
  state dicts are valid at runtime but the overloads require the full
  state type) and tests that intentionally pass invalid input
- start the ignore_errors burn-down: open_notebook.graphs.transformation,
  open_notebook.graphs.ask and api.routers.models are now type-checked;
  stale blocks for the deleted api.client and api.podcast_api_service
  modules removed. Only open_notebook.domain.notebook remains exempt
  (DB layer is migrating to surreal-basics)
- fix the mypy.ini header comment to describe what the config does

* test: use typing.get_args on the registry literal check

The registry test landed in parallel using Literal.__args__, which the
mypy gate in this branch rejects; align it with the get_args() idiom
used by the rest of the file.
2026-07-11 19:25:29 -03:00

20 lines
615 B
INI

[mypy]
# Lenient baseline config, enforced in CI (backend-typecheck job).
# `mypy .` must exit 0: new type errors are blocked while the
# remaining `ignore_errors = True` modules below are burned down
# over time. Remove a module's block, fix its errors, repeat.
plugins = pydantic.mypy
warn_return_any = False
warn_unused_configs = True
ignore_missing_imports = True
no_implicit_optional = False
check_untyped_defs = True
explicit_package_bases = True
mypy_path = .
# Modules still exempt from type checking (burn-down list - shrink it,
# don't grow it)
[mypy-open_notebook.domain.notebook]
ignore_errors = True