fix: 修复运行时配置递归与插件兼容入口

This commit is contained in:
jxxghp
2026-08-23 08:57:39 +08:00
parent 4d1be26a31
commit 557f2f18a9
7 changed files with 95 additions and 3 deletions
+11
View File
@@ -19,6 +19,7 @@ from app.application.configuration import (
get_api_runtime_config_snapshot,
get_transfer_retry_config,
)
from app.runtime.settings import RuntimeSettingsCompat, configure_runtime_settings_compat
class _MutableSettings:
@@ -62,6 +63,16 @@ def test_runtime_settings_service_hides_mutable_settings_implementation() -> Non
assert service.get("VALUE") == "final"
def test_runtime_settings_compat_delegates_to_concrete_service_backend() -> None:
"""兼容 Settings 代理委托到真实设置对象时不会在 model_dump 中递归。"""
service = RuntimeSettingsService(_MutableSettings())
configure_runtime_settings_compat(service)
assert RuntimeSettingsCompat().model_dump(include={"VALUE"}) == {
"VALUE": "before"
}
def test_system_config_service_supports_separate_reader_and_writer() -> None:
"""应用服务可以分别注入只读与写入适配器。"""
reader = MagicMock()