refactor: unify scheduler service access

This commit is contained in:
jxxghp
2026-08-23 23:50:19 +08:00
parent 2372b1236e
commit 066757888c
4 changed files with 23 additions and 3 deletions
+2 -2
View File
@@ -14,7 +14,7 @@
"workflow_to_db": []
},
"edge_count": 6500,
"edge_sha256": "f16cc04898ae0fc7602f2d154321035040c6e64155c59b0b0d72a7d707f59ec9",
"edge_sha256": "7afa6e61ca564c1ec0c5981304cdb219afa99eb3318bb1703e8acf363cab9aae",
"edges": [
"app -> app.runtime",
"app -> app.runtime.compat",
@@ -3485,6 +3485,7 @@
"app.command -> app.application.messaging.skill",
"app.command -> app.application.plugin",
"app.command -> app.application.plugin.runtime",
"app.command -> app.application.scheduling",
"app.command -> app.chain",
"app.command -> app.chain.download",
"app.command -> app.chain.message",
@@ -3500,7 +3501,6 @@
"app.command -> app.runtime.events",
"app.command -> app.runtime.log",
"app.command -> app.runtime.thread",
"app.command -> app.scheduler",
"app.command -> app.schemas",
"app.command -> app.schemas.event",
"app.command -> app.schemas.message",
+16
View File
@@ -861,6 +861,22 @@ def test_agent_tools_do_not_import_entrypoint_internals():
assert violations == {}
def test_runtime_consumers_use_scheduler_application_facade():
"""非组合根消费者必须经 application Facade 访问进程级 Scheduler。"""
allowed = {
"app.scheduler",
"app.startup.initializers.modules",
"app.startup.initializers.scheduler",
}
violations = {
module_name: dependencies & {"app.scheduler"}
for module_name, dependencies in _build_module_graph().items()
if module_name not in allowed and "app.scheduler" in dependencies
}
assert violations == {}
def test_api_does_not_import_factory():
"""装配器(factory)只允许 app.main 使用,HTTP 端点不得回引。"""
violations: dict[str, set[str]] = {}