refactor(workflow): enforce typed query boundary

This commit is contained in:
jxxghp
2026-08-28 01:16:08 +08:00
parent 2f41780893
commit b4f8736541
35 changed files with 733 additions and 223 deletions
+10 -7
View File
@@ -1441,8 +1441,8 @@
"runtime_only": true
}
},
"edge_count": 6898,
"edge_sha256": "9bceb8aaa1bb5857ba6ee075c50214455cfb4f59030cee49b3e5af751cc95972",
"edge_count": 6901,
"edge_sha256": "860590c25bd889096c9faa04f35ad3e3312e2c28ab415e57dce1d669d490e0a1",
"edges": [
"app -> app.runtime",
"app -> app.runtime.compat",
@@ -2587,7 +2587,7 @@
"app.agent.tools.impl.query_workflows -> app.agent.tools.base",
"app.agent.tools.impl.query_workflows -> app.agent.tools.tags",
"app.agent.tools.impl.query_workflows -> app.application",
"app.agent.tools.impl.query_workflows -> app.application.agentdata",
"app.agent.tools.impl.query_workflows -> app.application.workflow",
"app.agent.tools.impl.query_workflows -> app.runtime",
"app.agent.tools.impl.query_workflows -> app.runtime.log",
"app.agent.tools.impl.read_file -> app.agent",
@@ -4340,6 +4340,8 @@
"app.application.servarr -> app.schemas.types",
"app.application.server.report -> app.schemas",
"app.application.server.report -> app.schemas.media",
"app.application.server.share -> app.application",
"app.application.server.share -> app.application.workflow",
"app.application.server.share -> app.schemas",
"app.application.server.share -> app.schemas.media",
"app.application.service -> app.schemas",
@@ -4472,6 +4474,8 @@
"app.application.transfer.workflow -> app.schemas.tmdb",
"app.application.transfer.workflow -> app.schemas.transfer",
"app.application.transfer.workflow -> app.schemas.types",
"app.application.workflow -> app.schemas",
"app.application.workflow -> app.schemas.common",
"app.chain -> app.application",
"app.chain -> app.application.chain",
"app.chain -> app.application.chain.context",
@@ -5201,6 +5205,8 @@
"app.db.adapters.workflow -> app.db.oper",
"app.db.adapters.workflow -> app.db.oper.workflow",
"app.db.adapters.workflow -> app.db.uow",
"app.db.adapters.workflow -> app.schemas",
"app.db.adapters.workflow -> app.schemas.common",
"app.db.base -> app.db",
"app.db.base -> app.db.uow",
"app.db.base -> app.runtime",
@@ -7551,6 +7557,7 @@
"app.scheduler -> app.application.plugin.runtime",
"app.scheduler -> app.application.scheduling",
"app.scheduler -> app.application.site",
"app.scheduler -> app.application.workflow",
"app.scheduler -> app.chain",
"app.scheduler -> app.chain.mediaserver",
"app.scheduler -> app.chain.recommend",
@@ -7576,7 +7583,6 @@
"app.scheduler -> app.schemas.message",
"app.scheduler -> app.schemas.system",
"app.scheduler -> app.schemas.types",
"app.scheduler -> app.schemas.workflow",
"app.schemas -> app.schemas.exports",
"app.schemas.agent -> app.schemas",
"app.schemas.agent -> app.schemas.common",
@@ -8167,14 +8173,11 @@
"app.testing.bootstrap -> app.startup.initializers.database",
"app.testing.bootstrap -> app.startup.initializers.domain",
"app.workflow -> app.application",
"app.workflow -> app.application.chain",
"app.workflow -> app.application.chain.data",
"app.workflow -> app.application.workflow",
"app.workflow -> app.foundation",
"app.workflow -> app.foundation.reflection",
"app.workflow -> app.foundation.singleton",
"app.workflow -> app.runtime",
"app.workflow -> app.runtime.config",
"app.workflow -> app.runtime.events",
"app.workflow -> app.runtime.log",
"app.workflow -> app.runtime.stop",
+8 -9
View File
@@ -848,7 +848,7 @@
"arg-type": 7
},
"app/api/dependencies/workflow.py": {
"arg-type": 4,
"arg-type": 3,
"redundant-cast": 2
},
"app/api/endpoints/agent.py": {
@@ -1107,7 +1107,7 @@
"no-any-return": 4
},
"app/application/agentdata.py": {
"attr-defined": 10
"attr-defined": 9
},
"app/application/agenttask.py": {
"type-arg": 1
@@ -1299,7 +1299,6 @@
"type-arg": 5
},
"app/application/server/share.py": {
"no-any-return": 1,
"type-arg": 6
},
"app/application/service.py": {
@@ -1588,13 +1587,13 @@
"index": 1
},
"app/chain/workflow.py": {
"arg-type": 2,
"arg-type": 1,
"assignment": 1,
"call-arg": 1,
"index": 4,
"misc": 1,
"no-any-return": 10,
"no-untyped-def": 3,
"no-any-return": 7,
"no-untyped-def": 2,
"truthy-function": 2,
"type-arg": 17,
"union-attr": 4,
@@ -3232,7 +3231,7 @@
"unused-ignore": 1
},
"app/scheduler.py": {
"arg-type": 8,
"arg-type": 7,
"attr-defined": 1,
"import-untyped": 1,
"misc": 1,
@@ -3406,7 +3405,7 @@
"misc": 1,
"no-any-return": 2,
"no-untyped-call": 33,
"no-untyped-def": 13,
"no-untyped-def": 12,
"return-value": 5
},
"app/startup/initializers/plugins.py": {
@@ -3448,7 +3447,7 @@
"no-untyped-call": 2
},
"app/workflow/__init__.py": {
"arg-type": 2,
"arg-type": 1,
"assignment": 2,
"index": 1,
"no-any-return": 1,
-19
View File
@@ -291,9 +291,6 @@
"F401": 1,
"I001": 1
},
"app/application/agentdata.py": {
"I001": 1
},
"app/application/agenttask.py": {
"I001": 1
},
@@ -380,9 +377,6 @@
"app/application/torrent_cache.py": {
"I001": 1
},
"app/application/workflow.py": {
"I001": 1
},
"app/chain/_music.py": {
"E402": 5
},
@@ -401,9 +395,6 @@
"app/db/adapters/transaction.py": {
"I001": 1
},
"app/db/adapters/workflow.py": {
"I001": 1
},
"app/db/base.py": {
"I001": 1
},
@@ -1056,9 +1047,6 @@
"E402": 27,
"F401": 1
},
"app/workflow/__init__.py": {
"F401": 1
},
"scripts/architecture/task_ownership.py": {
"I001": 1
},
@@ -1362,10 +1350,6 @@
"tests/test_health_probes.py": {
"I001": 1
},
"tests/test_host_runtime_context.py": {
"F401": 1,
"I001": 1
},
"tests/test_indexer_spider_search_url.py": {
"I001": 1
},
@@ -1786,9 +1770,6 @@
"tests/test_workflow_authorization.py": {
"I001": 1
},
"tests/test_workflow_execution.py": {
"I001": 1
},
"tests/test_workflow_runtime_config.py": {
"I001": 1
}
+12 -5
View File
@@ -1184,6 +1184,13 @@
"target_module": "app.runtime.log",
"target_name": "log_settings"
}
},
"app.workflow": {
"WorkFlowManager": {
"replacement": "app.workflow.WorkflowManager",
"target_module": "app.workflow",
"target_name": "WorkflowManager"
}
}
},
"virtual_packages": [
@@ -1440,12 +1447,12 @@
"caller": "app.workflow",
"dynamic": true,
"events": [],
"fingerprint": "042068d816db7e46ab4da6e96f8549af97b57bd9d75ba710cc1ff4fec7e5e188",
"fingerprint": "b99f557080a8ddb6dc9d2870d02c4cabc4b265b0daac086369c3bf1d51073c09",
"handler": "self._handle_event",
"invalid": false,
"method": "add_event_listener",
"priority": "<default>",
"qualname": "WorkFlowManager.register_workflow_event",
"qualname": "WorkflowManager.register_workflow_event",
"receiver_kind": "canonical_singleton",
"registration_kind": "listener"
}
@@ -1836,7 +1843,7 @@
"50704edda70674af0932e769ddda40d2c21d50b134155c975d675035d7c933cd"
],
"producer_fingerprints": [
"611abaaf708f0c2d555d3b963ff540c015f2155ff493ed17b92d7c7f0bd45e96"
"b92d348c57dac3ba348079b4e71d02a0c13933bbf14b7e81188b042c3c5e2db3"
]
}
},
@@ -2980,10 +2987,10 @@
"events": [
"EventType.WorkflowExecute"
],
"fingerprint": "611abaaf708f0c2d555d3b963ff540c015f2155ff493ed17b92d7c7f0bd45e96",
"fingerprint": "b92d348c57dac3ba348079b4e71d02a0c13933bbf14b7e81188b042c3c5e2db3",
"invalid": false,
"method": "send_event",
"qualname": "WorkFlowManager._trigger_workflow",
"qualname": "WorkflowManager._trigger_workflow",
"receiver_kind": "canonical_singleton"
},
{
+2 -2
View File
@@ -300,7 +300,7 @@
},
{
"caller": "app.workflow",
"qualname": "WorkFlowManager.register_workflow_event",
"qualname": "WorkflowManager.register_workflow_event",
"method": "add_event_listener",
"receiver_kind": "canonical_singleton",
"events": [],
@@ -309,7 +309,7 @@
"handler": "self._handle_event",
"registration_kind": "listener",
"priority": "<default>",
"fingerprint": "042068d816db7e46ab4da6e96f8549af97b57bd9d75ba710cc1ff4fec7e5e188",
"fingerprint": "b99f557080a8ddb6dc9d2870d02c4cabc4b265b0daac086369c3bf1d51073c09",
"classification": "approved_dynamic_exception",
"owner": "app.workflow",
"reason": "工作流配置在运行期决定事件类型,receiver 与 handler 仍可静态证明。"