From d6c11119307f7303d8b4fa249cbef94123c39fae Mon Sep 17 00:00:00 2001 From: InfinityPacer Date: Sat, 12 Sep 2026 19:20:55 +0800 Subject: [PATCH] test(plugin): align local source projection contract --- tests/test_plugin_candidate_inventory.py | 6 +++--- tests/test_plugin_install_admission.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_plugin_candidate_inventory.py b/tests/test_plugin_candidate_inventory.py index 4ec1796de..8fb95a51c 100644 --- a/tests/test_plugin_candidate_inventory.py +++ b/tests/test_plugin_candidate_inventory.py @@ -222,8 +222,8 @@ def test_local_scan_preserves_absent_present_and_failed_states() -> None: assert failed.local_read.error == "local repository unavailable" -def test_local_candidates_never_expose_path_in_inventory_projection() -> None: - """本地候选可参与库存,但公共投影永不携带本地仓库路径。""" +def test_local_candidates_keep_source_marker_in_inventory_projection() -> None: + """本地候选可参与库存,并保留可供来源选择使用的来源标识。""" reader = PluginCandidateInventoryReader( market_loader=lambda *_args: {}, local_candidate_loader=lambda: { @@ -244,10 +244,10 @@ def test_local_candidates_never_expose_path_in_inventory_projection() -> None: assert public["local_candidates"] == [{ "plugin_id": "LocalPlugin", "source_type": "local", + "repo_url": "local://LocalPlugin?path=/private/local&version=v3", "package_generation": "v3", "plugin_version": "3.0.0", }] - assert "/private/local" not in str(public) def test_invalid_local_candidate_does_not_abort_online_inventory() -> None: diff --git a/tests/test_plugin_install_admission.py b/tests/test_plugin_install_admission.py index c6bf5a7a3..2da28a9a8 100644 --- a/tests/test_plugin_install_admission.py +++ b/tests/test_plugin_install_admission.py @@ -322,8 +322,8 @@ def test_first_local_payload_creates_local_only_identity() -> None: assert target.trusted_source_type is TrustedPluginSourceType.UNKNOWN -def test_sanitized_local_reference_selects_configured_candidate_without_path() -> None: - """脱敏本地来源标识仍能选择配置内候选,但公共投影不暴露路径。""" +def test_local_reference_selects_configured_candidate_with_source_marker() -> None: + """本地来源标识仍能选择配置内候选,并保留可回传的来源标识。""" local = PluginLocalCandidate( plugin_id="DemoPlugin", repo_url=( @@ -350,10 +350,10 @@ def test_sanitized_local_reference_selects_configured_candidate_without_path() - assert public == { "plugin_id": "DemoPlugin", "source_type": "local", + "repo_url": "local://DemoPlugin?path=/private/secret/plugins&version=v3", "package_generation": "v3", "plugin_version": "2.0.0-dev", } - assert "/private/secret/plugins" not in str(public) def test_legacy_identity_can_bind_explicit_online_source() -> None: