mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor: unify user chain data port access
This commit is contained in:
@@ -428,6 +428,30 @@ def test_workflow_domain_uses_explicit_chain_data_port_getters():
|
||||
assert violations == []
|
||||
|
||||
|
||||
def test_user_and_messaging_chains_use_explicit_data_port_getters():
|
||||
"""用户、交互和消息链不得把迁移期 UserPortProxy 伪装成 UserOper。"""
|
||||
paths = [
|
||||
APP_ROOT / "chain" / "user.py",
|
||||
APP_ROOT / "chain" / "interaction.py",
|
||||
APP_ROOT / "chain" / "_messaging.py",
|
||||
]
|
||||
violations: list[str] = []
|
||||
for path in paths:
|
||||
tree = ast.parse(path.read_text(encoding="utf-8-sig"), filename=str(path))
|
||||
for node in ast.walk(tree):
|
||||
if not isinstance(node, ast.ImportFrom):
|
||||
continue
|
||||
if node.module != "app.application.chain.data":
|
||||
continue
|
||||
for alias in node.names:
|
||||
if alias.name == "UserPortProxy":
|
||||
violations.append(
|
||||
f"{path.relative_to(PROJECT_ROOT).as_posix()}:{node.lineno}"
|
||||
)
|
||||
|
||||
assert violations == []
|
||||
|
||||
|
||||
def test_plugin_components_do_not_reexport_legacy_abi_names():
|
||||
"""新插件组件只提供 canonical 能力,不得复制旧 Helper、Manager 或 Oper 导出。"""
|
||||
violations: list[str] = []
|
||||
|
||||
Reference in New Issue
Block a user