refactor: separate semantic architecture baselines

This commit is contained in:
jxxghp
2026-08-21 19:28:31 +08:00
parent 7bc3ea831f
commit 37c442b042
6 changed files with 872 additions and 630 deletions
+13 -3
View File
@@ -41,9 +41,10 @@ def test_official_plugin_baseline_records_external_source():
baseline_path = BASELINE_ROOT / "official-plugin-baseline.json"
baseline = json.loads(baseline_path.read_text(encoding="utf-8"))
assert baseline["source"]["repository"] == "MoviePilot-Plugins"
assert len(baseline["source"]["head"]) == 40
assert baseline["source"]["roots"] == ["plugins.v2", "plugins.v3"]
assert baseline["schema_version"] == 3
assert baseline["scope"]["repository"] == "MoviePilot-Plugins"
assert baseline["scope"]["roots"] == ["plugins.v2", "plugins.v3"]
assert len(baseline["provenance"]["head"]) == 40
assert all(
not path.startswith("app/plugins/")
for contract in (*baseline["imports"].values(), *baseline["hooks"].values())
@@ -95,6 +96,15 @@ def test_startup_performance_baseline_records_all_cold_import_targets():
assert contract["loaded_module_count"] > 0
def test_runtime_contract_baseline_excludes_diagnostic_line_numbers():
"""运行契约 fixture 只保存稳定语义,源码位置必须按需诊断。"""
baseline_path = BASELINE_ROOT / "runtime-contract-baseline.json"
baseline = json.loads(baseline_path.read_text(encoding="utf-8"))
assert baseline["schema_version"] == 2
assert '"line"' not in json.dumps(baseline)
def test_startup_performance_baseline_records_normal_and_safe_lifecycle_resources():
"""非功能基线必须同时记录正常/安全模式和隔离资源增量。"""
baseline_path = BASELINE_ROOT / "startup-performance-baseline.json"