fix(plugin): 修复坏插件模块声明击穿模块调度导致接口大面积报错

- projection 只接受映射类型的 get_module 声明,非法值跳过并记日志
- dispatcher 同步/异步路径防御非映射方法表,单个坏插件被隔离
- media 端点改用 application 层插件运行时门面,消除分层违规依赖
- 图片能力测试打桩 models.dev 目录边界,适配仓库内离线目录留空

Closes #6346
This commit is contained in:
jxxghp
2026-08-18 15:53:28 +08:00
parent dc23977b0c
commit 8d62f33155
8 changed files with 124 additions and 16 deletions
+17
View File
@@ -80,6 +80,23 @@ def test_projection_preserves_services_modules_actions_and_pid_filter():
}]
def test_projection_modules_skips_none_and_non_mapping_declarations():
"""get_module 未返回映射的插件被跳过并记日志,不污染整体模块投影。"""
errors = []
log = SimpleNamespace(error=lambda message: errors.append(message))
projection = PluginProjection(
{
"NoDecl": _Plugin(get_module=lambda: None),
"ListDecl": _Plugin(get_module=lambda: ["not-a-mapping"]),
"Healthy": _Plugin(get_module=lambda: {"recognize": "handler"}),
},
log=log,
)
assert projection.modules() == {("Healthy", "测试插件"): {"recognize": "handler"}}
assert any("ListDecl" in message for message in errors)
def test_projection_collects_enabled_media_source_declarations():
"""只投影启用插件的媒体来源声明,并附带插件 ID 便于诊断。"""
demo = _Plugin(