fix: clean mypy errors in schemas, models, auth, exceptions layers
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
CLI Tests / test-cli (push) Has been cancelled
Coverage Phase 1 (70% Target) / test-coverage-70 (push) Has been cancelled
Coverage Phase 2 (85% Target) / test-coverage-85 (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Package Tests / Python package - aitbc-agent-sdk (push) Has been cancelled
Package Tests / Python package - aitbc-core (push) Has been cancelled
Package Tests / Python package - aitbc-crypto (push) Has been cancelled
Package Tests / Python package - aitbc-sdk (push) Has been cancelled
Package Tests / JavaScript package - aitbc-sdk-js (push) Has been cancelled
Package Tests / JavaScript package - aitbc-token (push) Has been cancelled
Production Tests / Production Integration Tests (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

schemas/ — 0 errors (11 files):
- federated_learning, decentralized_memory, dao_governance, atomic_swap:
  fix self-imports to import enums from domain layer
- pricing.py: add timezone import, fix default_factory lambda, annotate validator
- __init__.py: remove invalid ser_json_tuples from ConfigDict

models/ — 0 errors (10 files):
- registry.py: add timezone import, fix default_factory lambda, annotate validator,
  add items field to ParameterDefinition (used at callsites)
- services.py: annotate validators with proper types, use ValidationInfo,
  fix no-any-return with explicit typed local
- confidential.py: rename metadata->extra_metadata (conflicts with SQLModel),
  add mypy disable for pydantic-field (raw SQLAlchemy Column pattern)

auth.py: add -> str return type
exceptions.py: fix Optional param defaults to use X | None annotations

pyproject.toml:
- Add pydantic.mypy plugin (fixes false Pydantic v2 positive errors)
- Remove models.* from ignore_errors override (layer now clean)
- Update clean-layer comment

51 source files now pass mypy with no errors.
Remaining ignore_errors: routers, services, storage, utils, contexts (coordinator-api)
and all blanket-suppressed apps.
This commit is contained in:
aitbc
2026-05-25 10:32:34 +02:00
parent 814c2ce891
commit 3d66d34173
12 changed files with 25 additions and 24 deletions

View File

@@ -127,6 +127,7 @@ ensure_newline_before_comments = true
[tool.mypy]
python_version = "3.13"
plugins = ["pydantic.mypy"]
exclude = "^apps/(agent-management|agent-coordinator|agent-services|blockchain-node|computing-node|identity-node|marketplace|mining-pool)/.*"
warn_return_any = true
warn_unused_configs = true
@@ -157,16 +158,13 @@ ignore_missing_imports = true
# Tech debt: these modules still have type errors that require per-file annotation work.
# Tracked in gap analysis. Remove entries as each module is fixed.
# Clean (no override needed): domain.*, schemas.*, auth, exceptions, models.*
[[tool.mypy.overrides]]
module = [
"apps.coordinator-api.src.app.routers.*",
"apps.coordinator-api.src.app.services.*",
"apps.coordinator-api.src.app.storage.*",
"apps.coordinator-api.src.app.utils.*",
"apps.coordinator-api.src.app.schemas.*",
"apps.coordinator-api.src.app.models.*",
"apps.coordinator-api.src.app.auth",
"apps.coordinator-api.src.app.exceptions",
"apps.coordinator-api.src.app.contexts.*",
]
ignore_errors = true