refactor: unify download chain data ports

This commit is contained in:
jxxghp
2026-08-24 04:36:56 +08:00
parent fb08e06277
commit f93ecf65d3
6 changed files with 64 additions and 16 deletions
+21
View File
@@ -501,6 +501,27 @@ def test_mediaserver_chain_uses_explicit_data_port_getter():
assert violations == []
def test_download_chain_uses_explicit_data_port_getters():
"""下载链不得把三个迁移期 PortProxy 伪装成数据库 Oper。"""
path = APP_ROOT / "chain" / "download.py"
tree = ast.parse(path.read_text(encoding="utf-8-sig"), filename=str(path))
forbidden = {
"DownloadFailurePortProxy",
"DownloadHistoryPortProxy",
"MediaServerPortProxy",
}
violations = [
f"{path.relative_to(PROJECT_ROOT).as_posix()}:{node.lineno}:{alias.name}"
for node in ast.walk(tree)
if isinstance(node, ast.ImportFrom)
and node.module == "app.application.chain.data"
for alias in node.names
if alias.name in forbidden
]
assert violations == []
def test_plugin_components_do_not_reexport_legacy_abi_names():
"""新插件组件只提供 canonical 能力,不得复制旧 Helper、Manager 或 Oper 导出。"""
violations: list[str] = []