mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-10-31 12:24:39 +08:00
chore(types): gate watcher and streaming callback contracts
This commit is contained in:
@@ -70,12 +70,14 @@ uv run --locked --no-sync python scripts/architecture/complexity.py
|
||||
- `app/startup/lifecycle/components.py`:组件启动与关闭。
|
||||
|
||||
三个文件及完整严格清单实测通过,不增加忽略规则或类型债务。全宿主 mypy ratchet 继续保留。
|
||||
严格清单当前仍采用 `follow_imports = skip` 和 `ignore_missing_imports = True`,不能等同于
|
||||
传递依赖全部严格。Agent session/lifecycle 与 Scheduler lifecycle 的扩围需要一起处理父类、
|
||||
严格清单默认采用 `follow_imports = skip` 和 `ignore_missing_imports = True`,不能等同于
|
||||
传递依赖全部严格。流式回调使用的 `app.chain.base` 和 `app.schemas.notification` 在导入时
|
||||
采用 `follow_imports = silent`,读取真实父类和渠道能力签名;这两个依赖未纳入严格清单,
|
||||
其存量错误仍由全宿主显式扫描完整报告并逐文件检查低水位。Agent session/lifecycle 与 Scheduler lifecycle 的扩围需要一起处理父类、
|
||||
回调和返回值类型;全仓错误计数为零并不保证单独纳入 strict frontier 后也为零。
|
||||
|
||||
2026-10-16 开始逐文件清理类型债务,`app/domain/title.py` 通过局部可空类型声明保留
|
||||
既有搜索解析行为,并纳入严格清单;当前清单共 206 个文件(205 个生产文件和 1 个脚本)。
|
||||
既有搜索解析行为,并纳入严格清单;当前清单共 208 个文件(207 个生产文件和 1 个脚本)。
|
||||
每个生产文件完成针对性测试后独立提交,并纳入严格门禁。每批集中同步真实下降的
|
||||
类型基线和指标文档,运行完整本地单测与适用门禁后统一推送;不逐文件等待远端 CI。
|
||||
验收同时检查完整严格清单与全宿主 Linux 分析,避免 `follow_imports = skip` 隐藏依赖
|
||||
|
||||
@@ -106,9 +106,9 @@ ARCH-201 至 ARCH-204 均达到实现、验证、提交、推送和远端门禁
|
||||
| Model/Oper 事务债务 | 0 | 自建 Session、自动事务装饰器、直接 commit/rollback 等基线均为零 |
|
||||
| Module Contract | 215 specs / 211 methods / 263 calls | 动态方法名为 0;分类事实富化通过显式合同进入插件调度,旧 YAML 分类方法已移除;download 新增 custom_words 可选参数,旧 provider 签名通过显式合同兼容 |
|
||||
| Event Contract | 53 | 均已有 payload model,但当前全部是 diagnostic enforcement |
|
||||
| Python 源码量 | 373,087 行 | 本次重新扫描物理行数,排除 `app/plugins/**`;74 个文件超过 1,000 行,12 个超过 2,000 行;源码尺寸仅作观察 |
|
||||
| Python 源码量 | 373,100 行 | 本次重新扫描物理行数,排除 `app/plugins/**`;74 个文件超过 1,000 行,12 个超过 2,000 行;源码尺寸仅作观察 |
|
||||
| 长方法 | 309 个超过 80 行 | 本次 AST 扫描排除 `app/plugins/**`;61 个超过 150 行,17 个超过 250 行;新增函数仍受 C901/嵌套深度门禁约束 |
|
||||
| 全量 mypy 历史债务 | 7,186 / 369 文件 | 通知排版补齐 Slack 消息块类型,历史债务减少 2 项;工作流资源过滤改用领域对象调用过滤链,恢复的节点输出在消费前归一化,并收紧可空资源列表的类型低水位;消息媒体交互类型债务已清零,canonical Facade 与 endpoint 类型边界已补齐,低水位只允许继续下降;微信 ClawBot 入站 item_list 媒体解析改为按子项键名分派后,类型错误减少 4 项;站点解析器分享率改用浮点初值,类型错误减少 20 项;本次下载与文件安全修复再减少 3 项;Transmission 进度回退值归一化再减少 2 项,逐文件逐错误码无增长 |
|
||||
| 全量 mypy 历史债务 | 7,157 / 367 文件 | 通知排版补齐 Slack 消息块类型,历史债务减少 2 项;工作流资源过滤改用领域对象调用过滤链,恢复的节点输出在消费前归一化,并收紧可空资源列表的类型低水位;消息媒体交互类型债务已清零,canonical Facade 与 endpoint 类型边界已补齐,低水位只允许继续下降;微信 ClawBot 入站 item_list 媒体解析改为按子项键名分派后,类型错误减少 4 项;站点解析器分享率改用浮点初值,类型错误减少 20 项;本次下载与文件安全修复再减少 3 项;Transmission 进度回退值归一化再减少 2 项,逐文件逐错误码无增长 |
|
||||
| Ruff 历史诊断 | 98 | 低水位门禁通过,但规则集只覆盖 `E4/E7/E9/F/I` |
|
||||
| 覆盖率固定基线 | Application 80.00%,Domain 80.00% | Chain、Runtime、Agent、Adapter、Startup 未进入包级覆盖率门禁 |
|
||||
|
||||
|
||||
7
mypy.ini
7
mypy.ini
@@ -7,6 +7,8 @@ follow_imports = skip
|
||||
show_error_codes = True
|
||||
pretty = True
|
||||
files =
|
||||
app/monitor/watcher.py,
|
||||
app/agent/callback/__init__.py,
|
||||
app/adapters/external/wechat.py,
|
||||
app/modules/thetvdb/client.py,
|
||||
app/domain/site.py,
|
||||
@@ -213,3 +215,8 @@ files =
|
||||
app/modules/themoviedb/tmdbv3api/objs/find.py,
|
||||
app/modules/themoviedb/tmdbv3api/objs/account.py,
|
||||
scripts/architecture/async_blocking.py
|
||||
|
||||
# 读取已治理调用方依赖的真实接口,避免 skip 将父类和渠道能力降为 Any。
|
||||
# 这两个依赖尚有存量债务,不属于严格清单;全宿主显式扫描仍报告全部错误并执行低水位门禁。
|
||||
[mypy-app.chain.base,app.schemas.notification]
|
||||
follow_imports = silent
|
||||
|
||||
14
tests/fixtures/architecture/mypy-baseline.json
vendored
14
tests/fixtures/architecture/mypy-baseline.json
vendored
@@ -84,11 +84,6 @@
|
||||
"app/adapters/web/plugin/routes.py": {
|
||||
"type-arg": 1
|
||||
},
|
||||
"app/agent/callback/__init__.py": {
|
||||
"no-untyped-call": 3,
|
||||
"no-untyped-def": 8,
|
||||
"type-arg": 1
|
||||
},
|
||||
"app/agent/llm/capability.py": {
|
||||
"no-any-return": 4,
|
||||
"no-untyped-def": 6,
|
||||
@@ -165,7 +160,7 @@
|
||||
"attr-defined": 7,
|
||||
"dict-item": 1,
|
||||
"no-any-return": 7,
|
||||
"no-untyped-call": 3,
|
||||
"no-untyped-call": 2,
|
||||
"no-untyped-def": 13,
|
||||
"type-arg": 12,
|
||||
"union-attr": 3,
|
||||
@@ -1846,7 +1841,7 @@
|
||||
"arg-type": 8,
|
||||
"assignment": 1,
|
||||
"attr-defined": 5,
|
||||
"no-untyped-call": 8,
|
||||
"no-untyped-call": 2,
|
||||
"no-untyped-def": 2,
|
||||
"type-arg": 4,
|
||||
"union-attr": 1,
|
||||
@@ -1864,11 +1859,6 @@
|
||||
"app/monitor/syslimits.py": {
|
||||
"attr-defined": 1
|
||||
},
|
||||
"app/monitor/watcher.py": {
|
||||
"no-untyped-call": 1,
|
||||
"no-untyped-def": 8,
|
||||
"type-arg": 1
|
||||
},
|
||||
"app/runtime/cache.py": {
|
||||
"arg-type": 8,
|
||||
"assignment": 1,
|
||||
|
||||
Reference in New Issue
Block a user