File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232ENTRY_POINT_GROUP = BACKEND_PLUGIN_ENTRY_POINT_GROUP
3333_DEFAULT_CORE_VERSION = "0.1.0"
3434
35+ # Entry point names removed from optional oauth-connectors but still present in
36+ # older installed distributions; skip without loading or logging a failure.
37+ _RETIRED_BACKEND_PLUGIN_ENTRY_POINTS : frozenset [str ] = frozenset ({"anthropic-oauth" })
38+
3539
3640def discover_plugin_backends (entry_point_group : str = ENTRY_POINT_GROUP ) -> list [str ]:
3741 """Discover and register optional plugin backends.
@@ -58,6 +62,14 @@ def discover_plugin_backends(entry_point_group: str = ENTRY_POINT_GROUP) -> list
5862 plugin_load_error_first_ep : dict [tuple [str , str ], str ] = {}
5963 seen_backend_names : set [str ] = set ()
6064 for entry_point in entry_points :
65+ if entry_point .name in _RETIRED_BACKEND_PLUGIN_ENTRY_POINTS :
66+ if logger .isEnabledFor (logging .DEBUG ):
67+ logger .debug (
68+ "Skipping retired backend plugin entry point %r." ,
69+ entry_point .name ,
70+ )
71+ continue
72+
6173 provider = _load_provider (entry_point , plugin_load_error_first_ep )
6274 if provider is None :
6375 continue
Original file line number Diff line number Diff line change @@ -60,6 +60,28 @@ def test_no_entry_points_is_valid_optional_absence(self) -> None:
6060
6161 assert discovered == []
6262
63+ def test_retired_entry_point_is_silently_skipped (self , caplog : Any ) -> None :
64+ """Stale setuptools metadata must not trigger load or WARNING."""
65+ retired = _entry_point (
66+ name = "anthropic-oauth" ,
67+ load_error = RuntimeError ("load must not be called for retired entry points" ),
68+ )
69+ with (
70+ patch (
71+ "src.core.services.backend_plugin_discovery._resolve_core_version" ,
72+ return_value = "0.1.0" ,
73+ ),
74+ patch (
75+ "src.core.services.backend_plugin_discovery._load_entry_points" ,
76+ return_value = [retired ],
77+ ),
78+ caplog .at_level ("WARNING" ),
79+ ):
80+ discovered = discover_plugin_backends ()
81+
82+ assert discovered == []
83+ assert "Failed to load backend plugin entry point" not in caplog .text
84+
6385 def test_entry_point_load_failure_is_fail_open (self , caplog : Any ) -> None :
6486 broken = _entry_point (
6587 name = "broken-oauth" , load_error = ImportError ("Cannot import plugin module" )
You can’t perform that action at this time.
0 commit comments