diff --git a/app/startup/initializers/scheduler.py b/app/startup/initializers/scheduler.py index 10f4db6a1..8de96012f 100644 --- a/app/startup/initializers/scheduler.py +++ b/app/startup/initializers/scheduler.py @@ -1,7 +1,7 @@ """调度器业务能力装配与生命周期入口。""" import asyncio -from typing import Awaitable, Optional +from typing import Awaitable, Callable, Optional from app.application.agenttask import AgentTaskRepository from app.application.image import WallpaperHelper @@ -33,8 +33,8 @@ def reset_scheduler_runtime() -> None: def reset_scheduler_bindings() -> None: """在 Scheduler 已停止后撤销当前 lifespan 的仓储、业务能力和类登记。""" - # Singleton 元类保留旧动态接口,当前 owner 在此精确收窄为 Scheduler。 - scheduler = Scheduler.get_existing_instance() # type: ignore[no-untyped-call] + existing_scheduler: Callable[[], Optional[Scheduler]] = Scheduler.get_existing_instance + scheduler = existing_scheduler() if scheduler is not None: scheduler.reset_runtime_bindings() reset_scheduler_runtime() diff --git a/docs/code-quality.md b/docs/code-quality.md index 7817362be..2f18c02cb 100644 --- a/docs/code-quality.md +++ b/docs/code-quality.md @@ -75,7 +75,7 @@ uv run --locked --no-sync python scripts/architecture/complexity.py 回调和返回值类型;全仓错误计数为零并不保证单独纳入 strict frontier 后也为零。 2026-10-16 开始逐文件清理类型债务,`app/domain/title.py` 通过局部可空类型声明保留 -既有搜索解析行为,并纳入严格清单;当前清单共 59 个文件(58 个生产文件和 1 个脚本)。 +既有搜索解析行为,并纳入严格清单;当前清单共 60 个文件(59 个生产文件和 1 个脚本)。 每个治理提交聚焦一个生产文件及其必要测试、门禁配置、真实下降基线和指标文档。 验收同时检查完整严格清单与全宿主 Linux 分析,避免 `follow_imports = skip` 隐藏依赖 签名冲突;不通过忽略诊断或放宽类型合同接受回退。最新文件清单以 `mypy.ini` 为准, diff --git a/mypy.ini b/mypy.ini index b526ace41..cba35ad13 100644 --- a/mypy.ini +++ b/mypy.ini @@ -57,6 +57,7 @@ files = app/db/uow.py, app/startup/composition/context.py, app/startup/composition/configuration.py, + app/startup/initializers/scheduler.py, app/startup/lifecycle/components.py, app/scheduler/registry.py, app/db/adapters/outbox.py,