chore(architecture): 刷新宿主架构依赖、契约与启动性能基线

dependency-baseline.json 新增 7 个插件数据库模块及其依赖边,boundary_edges
12 个键仍全为空;runtime-contract-baseline.json 新增 app.sdk.database 的
两项 SDK 导出。app.db.session 起在冷启动路径新增 5 个轻量插件框架模块
(不含 alembic,其导入仍收在 ensure_database 内部),同步刷新
startup-performance-baseline.json 的模块计数;架构文档中引用的模块/边数
量同步更新,保持与快照一致。
This commit is contained in:
Aqr-K
2026-09-01 19:36:49 -04:00
parent 626d8217ba
commit adf4c84136
5 changed files with 211 additions and 163 deletions

View File

@@ -754,8 +754,8 @@ flowchart LR
| 指标 | 当前值 |
|---|---:|
| Python 模块 | 937 |
| 内部导入边 | 7,842 |
| Python 模块 | 944 |
| 内部导入边 | 7,873 |
| 非平凡 SCC | 1(精确 containment 的 TMDB 移植包环) |
| Application / Chain 具体 Adapter 直连 | 0 / 0 |
| Direct egress | 53(债务已清零,53 条精确 containment) |

View File

@@ -94,7 +94,7 @@ ARCH-201 至 ARCH-204 均达到实现、验证、提交、推送和远端门禁
| 指标 | 当前值 | 解释 |
|---|---:|---|
| 宿主 Python 模块 / 内部依赖边 | 937 / 7,842 | `dependency-baseline.json` 当前快照 |
| 宿主 Python 模块 / 内部依赖边 | 944 / 7,873 | `dependency-baseline.json` 当前快照 |
| 非平凡 SCC | 1 | 仅保留精确 containment 的 29 模块 TMDB 移植包环 |
| 跨层 DB 边界债务 | 0 | Application、Chain、API、Agent、Runtime、Workflow 到 DB 的受控债务均为零 |
| Model/Oper 事务债务 | 0 | 自建 Session、自动事务装饰器、直接 commit/rollback 等基线均为零 |

View File

@@ -1089,8 +1089,8 @@
"runtime_only": true
}
},
"edge_count": 7842,
"edge_sha256": "e71d433eeedb7ce13873176f99a593806648c4850ce7db250f7874589bbcd92b",
"edge_count": 7873,
"edge_sha256": "0f2cb35f34e4c4f3e2546e4416595b15ebe804f23f453a40bdda98fda35f2c40",
"edges": [
"app -> app.foundation",
"app -> app.foundation.environment",
@@ -5547,8 +5547,24 @@
"app.db.oper.workflow -> app.db.models.workflow",
"app.db.oper.workflow -> app.db.oper",
"app.db.oper.workflow -> app.db.oper.query",
"app.db.plugin.locator -> app.runtime",
"app.db.plugin.locator -> app.runtime.settings",
"app.db.plugin.migration -> app.db",
"app.db.plugin.migration -> app.db.plugin",
"app.db.plugin.migration -> app.db.plugin.container",
"app.db.plugin.registry -> app.db",
"app.db.plugin.registry -> app.db.engine",
"app.db.plugin.registry -> app.db.plugin",
"app.db.plugin.registry -> app.db.plugin.container",
"app.db.plugin.registry -> app.db.plugin.locator",
"app.db.plugin.registry -> app.db.plugin.migration",
"app.db.plugin.registry -> app.runtime",
"app.db.plugin.registry -> app.runtime.log",
"app.db.plugin.registry -> app.runtime.settings",
"app.db.session -> app.db",
"app.db.session -> app.db.engine",
"app.db.session -> app.db.plugin",
"app.db.session -> app.db.plugin.registry",
"app.db.session -> app.runtime",
"app.db.session -> app.runtime.log",
"app.db.session -> app.runtime.loop",
@@ -7596,6 +7612,9 @@
"app.runtime.extensions.plugin.dependency -> app.schemas",
"app.runtime.extensions.plugin.dependency -> app.schemas.plugin",
"app.runtime.extensions.plugin.lifecycle -> app.runtime",
"app.runtime.extensions.plugin.lifecycle -> app.runtime.extensions",
"app.runtime.extensions.plugin.lifecycle -> app.runtime.extensions.plugin",
"app.runtime.extensions.plugin.lifecycle -> app.runtime.extensions.plugin.database",
"app.runtime.extensions.plugin.lifecycle -> app.runtime.observability",
"app.runtime.extensions.plugin.lifecycle -> app.schemas",
"app.runtime.extensions.plugin.lifecycle -> app.schemas.plugin",
@@ -7659,6 +7678,7 @@
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.admission",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.catalog",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.clone",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.database",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.dependency",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.lifecycle",
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.loader",
@@ -7673,6 +7693,10 @@
"app.runtime.extensions.plugin.runtime -> app.runtime.extensions.plugin.tools",
"app.runtime.extensions.plugin.runtime -> app.schemas",
"app.runtime.extensions.plugin.runtime -> app.schemas.types",
"app.runtime.extensions.plugin.storage -> app.runtime",
"app.runtime.extensions.plugin.storage -> app.runtime.extensions",
"app.runtime.extensions.plugin.storage -> app.runtime.extensions.plugin",
"app.runtime.extensions.plugin.storage -> app.runtime.extensions.plugin.database",
"app.runtime.extensions.plugin.storage -> app.schemas",
"app.runtime.extensions.plugin.storage -> app.schemas.plugin",
"app.runtime.extensions.plugin.storage -> app.schemas.types",
@@ -7992,6 +8016,10 @@
"app.sdk.database -> app.application",
"app.sdk.database -> app.application.backup",
"app.sdk.database -> app.application.database",
"app.sdk.database -> app.db",
"app.sdk.database -> app.db.plugin",
"app.sdk.database -> app.db.plugin.base",
"app.sdk.database -> app.db.plugin.container",
"app.sdk.events -> app.runtime",
"app.sdk.events -> app.runtime.event",
"app.sdk.events -> app.runtime.event.snapshot",
@@ -8629,6 +8657,8 @@
"app.startup.initializers.plugins -> app.db",
"app.startup.initializers.plugins -> app.db.oper",
"app.startup.initializers.plugins -> app.db.oper.plugindata",
"app.startup.initializers.plugins -> app.db.plugin",
"app.startup.initializers.plugins -> app.db.plugin.registry",
"app.startup.initializers.plugins -> app.db.session",
"app.startup.initializers.plugins -> app.db.uow",
"app.startup.initializers.plugins -> app.foundation",
@@ -8641,6 +8671,7 @@
"app.startup.initializers.plugins -> app.runtime.execution",
"app.startup.initializers.plugins -> app.runtime.extensions",
"app.startup.initializers.plugins -> app.runtime.extensions.plugin",
"app.startup.initializers.plugins -> app.runtime.extensions.plugin.database",
"app.startup.initializers.plugins -> app.runtime.extensions.plugin.dependency",
"app.startup.initializers.plugins -> app.runtime.extensions.plugin.manager",
"app.startup.initializers.plugins -> app.runtime.extensions.plugin.runtime",
@@ -8935,7 +8966,7 @@
"app.workflow.actions.transfer_file -> app.workflow",
"app.workflow.actions.transfer_file -> app.workflow.actions"
],
"module_count": 937,
"module_count": 944,
"modules": [
"app",
"app.adapters",
@@ -9439,6 +9470,12 @@
"app.db.oper.user",
"app.db.oper.userconfig",
"app.db.oper.workflow",
"app.db.plugin",
"app.db.plugin.base",
"app.db.plugin.container",
"app.db.plugin.locator",
"app.db.plugin.migration",
"app.db.plugin.registry",
"app.db.session",
"app.db.uow",
"app.db.worker",
@@ -9700,6 +9737,7 @@
"app.runtime.extensions.plugin.catalog",
"app.runtime.extensions.plugin.clone",
"app.runtime.extensions.plugin.contracts",
"app.runtime.extensions.plugin.database",
"app.runtime.extensions.plugin.dependency",
"app.runtime.extensions.plugin.lifecycle",
"app.runtime.extensions.plugin.loader",

View File

@@ -9810,6 +9810,11 @@
"name": "BackupVerification",
"target": "app.application.backup.BackupVerification"
},
{
"kind": "import",
"name": "PluginDatabaseHandle",
"target": "app.db.plugin.container.PluginDatabaseHandle"
},
{
"kind": "FunctionDef",
"name": "create_backup",
@@ -9820,6 +9825,11 @@
"name": "list_backups",
"target": ""
},
{
"kind": "import",
"name": "plugin_declarative_base",
"target": "app.db.plugin.base.plugin_declarative_base"
},
{
"kind": "FunctionDef",
"name": "verify_backup",

View File

@@ -1,41 +1,41 @@
{
"schema_version": 2,
"generated_at": "2026-09-01T09:42:57.922376+00:00",
"platform": "macOS-26.5.2-arm64-arm-64bit-Mach-O",
"python": "3.14.3",
"generated_at": "2026-09-01T23:19:26.497070+00:00",
"platform": "Linux-6.1.0-35-amd64-x86_64-with-glibc2.36",
"python": "3.14.7",
"repeat": 3,
"targets": {
"app.startup.lifecycle": {
"loaded_app_module_count": 510,
"max_ms": 1115.407,
"median_ms": 1106.606,
"min_ms": 1098.166,
"loaded_app_module_count": 515,
"max_ms": 1794.267,
"median_ms": 1762.863,
"min_ms": 1708.563,
"samples_ms": [
1115.407,
1098.166,
1106.606
1794.267,
1762.863,
1708.563
]
},
"app.factory": {
"loaded_app_module_count": 522,
"max_ms": 1140.393,
"median_ms": 1134.83,
"min_ms": 1119.004,
"loaded_app_module_count": 527,
"max_ms": 1737.73,
"median_ms": 1647.82,
"min_ms": 1639.15,
"samples_ms": [
1119.004,
1140.393,
1134.83
1737.73,
1647.82,
1639.15
]
},
"app.main": {
"loaded_app_module_count": 524,
"max_ms": 1180.675,
"median_ms": 1165.915,
"min_ms": 1161.859,
"loaded_app_module_count": 529,
"max_ms": 1786.613,
"median_ms": 1712.973,
"min_ms": 1698.844,
"samples_ms": [
1180.675,
1165.915,
1161.859
1786.613,
1698.844,
1712.973
]
}
},
@@ -47,32 +47,32 @@
{
"mode": "normal",
"enabled_component_count": 32,
"startup_ms": 0.716,
"full_lifespan_ms": 1.819,
"startup_ms": 0.929,
"full_lifespan_ms": 1.366,
"stage_ms": {
"文件日志": 0.067,
"后台任务登记器": 0.035,
"数据库准备": 0.03,
"HTTP 基础能力": 0.022,
"站点访问端口": 0.021,
"Chain 外部端口": 0.02,
"Chain 网络端口": 0.019,
"领域依赖装配": 0.019,
"数据库引擎预热": 0.016,
"数据库连接预算": 0.019,
"路由": 0.021,
"插件运行时装配": 0.019,
"模块服务": 0.023,
"插件服务装配": 0.02,
"消息队列": 0.02,
"插件备份恢复": 0.02,
"插件": 0.02,
"定时器": 0.02,
"监控器": 0.02,
"待处理整理回放": 0.02,
"命令服务": 0.02,
"工作流": 0.02,
"插件同步与启动收尾": 0.016
"文件日志": 0.078,
"后台任务登记器": 0.048,
"数据库准备": 0.039,
"HTTP 基础能力": 0.036,
"站点访问端口": 0.033,
"Chain 外部端口": 0.032,
"Chain 网络端口": 0.031,
"领域依赖装配": 0.031,
"数据库引擎预热": 0.031,
"数据库连接预算": 0.031,
"路由": 0.032,
"插件运行时装配": 0.031,
"模块服务": 0.031,
"插件服务装配": 0.03,
"消息队列": 0.03,
"插件备份恢复": 0.03,
"插件": 0.03,
"定时器": 0.03,
"监控器": 0.03,
"待处理整理回放": 0.029,
"命令服务": 0.03,
"工作流": 0.029,
"插件同步与启动收尾": 0.03
},
"threads_before": 1,
"threads_started": 1,
@@ -85,32 +85,32 @@
{
"mode": "normal",
"enabled_component_count": 32,
"startup_ms": 0.729,
"full_lifespan_ms": 1.879,
"startup_ms": 0.993,
"full_lifespan_ms": 1.445,
"stage_ms": {
"文件日志": 0.07,
"后台任务登记器": 0.036,
"数据库准备": 0.028,
"HTTP 基础能力": 0.024,
"站点访问端口": 0.023,
"Chain 外部端口": 0.023,
"Chain 网络端口": 0.02,
"领域依赖装配": 0.022,
"数据库引擎预热": 0.02,
"数据库连接预算": 0.02,
"路由": 0.022,
"插件运行时装配": 0.021,
"模块服务": 0.021,
"插件服务装配": 0.019,
"消息队列": 0.023,
"插件备份恢复": 0.021,
"插件": 0.019,
"定时器": 0.02,
"监控器": 0.021,
"待处理整理回放": 0.021,
"命令服务": 0.02,
"工作流": 0.02,
"插件同步与启动收尾": 0.02
"文件日志": 0.082,
"后台任务登记器": 0.051,
"数据库准备": 0.041,
"HTTP 基础能力": 0.039,
"站点访问端口": 0.035,
"Chain 外部端口": 0.034,
"Chain 网络端口": 0.033,
"领域依赖装配": 0.032,
"数据库引擎预热": 0.031,
"数据库连接预算": 0.031,
"路由": 0.032,
"插件运行时装配": 0.031,
"模块服务": 0.031,
"插件服务装配": 0.031,
"消息队列": 0.031,
"插件备份恢复": 0.031,
"插件": 0.031,
"定时器": 0.031,
"监控器": 0.031,
"待处理整理回放": 0.031,
"命令服务": 0.031,
"工作流": 0.03,
"插件同步与启动收尾": 0.035
},
"threads_before": 1,
"threads_started": 1,
@@ -123,32 +123,32 @@
{
"mode": "normal",
"enabled_component_count": 32,
"startup_ms": 0.758,
"full_lifespan_ms": 1.909,
"startup_ms": 0.987,
"full_lifespan_ms": 1.426,
"stage_ms": {
"文件日志": 0.068,
"后台任务登记器": 0.037,
"数据库准备": 0.028,
"HTTP 基础能力": 0.029,
"站点访问端口": 0.025,
"Chain 外部端口": 0.023,
"Chain 网络端口": 0.023,
"领域依赖装配": 0.022,
"数据库引擎预热": 0.022,
"数据库连接预算": 0.021,
"路由": 0.023,
"插件运行时装配": 0.022,
"模块服务": 0.024,
"插件服务装配": 0.022,
"消息队列": 0.021,
"插件备份恢复": 0.021,
"插件": 0.021,
"定时器": 0.021,
"监控器": 0.021,
"待处理整理回放": 0.021,
"命令服务": 0.021,
"工作流": 0.021,
"插件同步与启动收尾": 0.022
"文件日志": 0.081,
"后台任务登记器": 0.048,
"数据库准备": 0.039,
"HTTP 基础能力": 0.037,
"站点访问端口": 0.034,
"Chain 外部端口": 0.033,
"Chain 网络端口": 0.032,
"领域依赖装配": 0.031,
"数据库引擎预热": 0.031,
"数据库连接预算": 0.031,
"路由": 0.031,
"插件运行时装配": 0.03,
"模块服务": 0.031,
"插件服务装配": 0.031,
"消息队列": 0.031,
"插件备份恢复": 0.032,
"插件": 0.03,
"定时器": 0.03,
"监控器": 0.031,
"待处理整理回放": 0.031,
"命令服务": 0.03,
"工作流": 0.045,
"插件同步与启动收尾": 0.04
},
"threads_before": 1,
"threads_started": 1,
@@ -159,8 +159,8 @@
"database_connections_started": 0
}
],
"median_startup_ms": 0.729,
"median_full_lifespan_ms": 1.879,
"median_startup_ms": 0.987,
"median_full_lifespan_ms": 1.426,
"enabled_component_count": 32,
"enabled_components": [
"文件日志",
@@ -202,25 +202,25 @@
{
"mode": "safe",
"enabled_component_count": 20,
"startup_ms": 0.552,
"full_lifespan_ms": 1.178,
"startup_ms": 0.829,
"full_lifespan_ms": 1.141,
"stage_ms": {
"文件日志": 0.065,
"后台任务登记器": 0.032,
"数据库准备": 0.028,
"HTTP 基础能力": 0.024,
"站点访问端口": 0.02,
"Chain 外部端口": 0.021,
"Chain 网络端口": 0.019,
"领域依赖装配": 0.021,
"数据库引擎预热": 0.021,
"数据库连接预算": 0.02,
"路由": 0.021,
"插件运行时装配": 0.016,
"模块服务": 0.018,
"插件服务装配": 0.018,
"消息队列": 0.019,
"插件同步与启动收尾": 0.018
"文件日志": 0.094,
"后台任务登记器": 0.058,
"数据库准备": 0.042,
"HTTP 基础能力": 0.037,
"站点访问端口": 0.034,
"Chain 外部端口": 0.034,
"Chain 网络端口": 0.037,
"领域依赖装配": 0.034,
"数据库引擎预热": 0.032,
"数据库连接预算": 0.031,
"路由": 0.03,
"插件运行时装配": 0.031,
"模块服务": 0.03,
"插件服务装配": 0.03,
"消息队列": 0.03,
"插件同步与启动收尾": 0.031
},
"threads_before": 1,
"threads_started": 1,
@@ -233,25 +233,25 @@
{
"mode": "safe",
"enabled_component_count": 20,
"startup_ms": 0.558,
"full_lifespan_ms": 1.2,
"startup_ms": 0.712,
"full_lifespan_ms": 1.02,
"stage_ms": {
"文件日志": 0.067,
"后台任务登记器": 0.036,
"数据库准备": 0.025,
"HTTP 基础能力": 0.024,
"站点访问端口": 0.02,
"Chain 外部端口": 0.02,
"Chain 网络端口": 0.019,
"领域依赖装配": 0.019,
"数据库引擎预热": 0.015,
"数据库连接预算": 0.019,
"路由": 0.021,
"插件运行时装配": 0.02,
"模块服务": 0.02,
"插件服务装配": 0.02,
"消息队列": 0.02,
"插件同步与启动收尾": 0.02
"文件日志": 0.076,
"后台任务登记器": 0.053,
"数据库准备": 0.04,
"HTTP 基础能力": 0.037,
"站点访问端口": 0.035,
"Chain 外部端口": 0.033,
"Chain 网络端口": 0.031,
"领域依赖装配": 0.031,
"数据库引擎预热": 0.031,
"数据库连接预算": 0.03,
"路由": 0.03,
"插件运行时装配": 0.03,
"模块服务": 0.03,
"插件服务装配": 0.03,
"消息队列": 0.029,
"插件同步与启动收尾": 0.03
},
"threads_before": 1,
"threads_started": 1,
@@ -264,25 +264,25 @@
{
"mode": "safe",
"enabled_component_count": 20,
"startup_ms": 0.579,
"full_lifespan_ms": 1.211,
"startup_ms": 0.728,
"full_lifespan_ms": 1.026,
"stage_ms": {
"文件日志": 0.062,
"后台任务登记器": 0.042,
"数据库准备": 0.027,
"HTTP 基础能力": 0.028,
"站点访问端口": 0.021,
"Chain 外部端口": 0.022,
"Chain 网络端口": 0.021,
"领域依赖装配": 0.021,
"数据库引擎预热": 0.019,
"数据库连接预算": 0.021,
"路由": 0.022,
"插件运行时装配": 0.02,
"模块服务": 0.023,
"插件服务装配": 0.02,
"消息队列": 0.02,
"插件同步与启动收尾": 0.02
"文件日志": 0.076,
"后台任务登记器": 0.055,
"数据库准备": 0.039,
"HTTP 基础能力": 0.037,
"站点访问端口": 0.035,
"Chain 外部端口": 0.036,
"Chain 网络端口": 0.035,
"领域依赖装配": 0.032,
"数据库引擎预热": 0.031,
"数据库连接预算": 0.03,
"路由": 0.031,
"插件运行时装配": 0.03,
"模块服务": 0.03,
"插件服务装配": 0.031,
"消息队列": 0.031,
"插件同步与启动收尾": 0.03
},
"threads_before": 1,
"threads_started": 1,
@@ -293,8 +293,8 @@
"database_connections_started": 0
}
],
"median_startup_ms": 0.558,
"median_full_lifespan_ms": 1.2,
"median_startup_ms": 0.728,
"median_full_lifespan_ms": 1.026,
"enabled_component_count": 20,
"enabled_components": [
"文件日志",