Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test: replace recording model client subclass with real clients (#43414)
Asuka Minato236b37c373e4
diff --git a/api/tests/unit_tests/core/plugin/test_model_runtime_adapter.py b/api/tests/unit_tests/core/plugin/test_model_runtime_adapter.pyindex 6ef33cf0539..ec55237688e 100644--- a/api/tests/unit_tests/core/plugin/test_model_runtime_adapter.py+++ b/api/tests/unit_tests/core/plugin/test_model_runtime_adapter.py@@ -31,48 +31,43 @@ from graphon.model_runtime.entities.model_entities import AIModelEntity, FetchFrfrom graphon.model_runtime.entities.provider_entities import ConfigurateMethod, ProviderEntity-class _RecordingModelClient(PluginModelClient):- """Record adapter calls and return explicit results without daemon access.-- An unconfigured operation fails immediately. Calls preserve omitted keyword- arguments so tests can distinguish an absent app_id from an explicit None.- """-- def __init__(self) -> None:- self.results: dict[str, object] = {}- self.calls: dict[str, list[tuple[tuple[object, ...], dict[str, object]]]] = defaultdict(list)-- def _record(self, method: Callable[..., object], *args: object, **kwargs: object) -> object:- inspect.signature(method).bind(self, *args, **kwargs)+def _recording_model_client(+ monkeypatch: pytest.MonkeyPatch,+) -> tuple[+ PluginModelClient,+ dict[str, object],+ dict[str, list[tuple[tuple[object, ...], dict[str, object]]]],+]:+ """Use a real client with isolated provider I/O and exact invocation records."""+ client = PluginModelClient()+ results: dict[str, object] = {}+ calls: dict[str, list[tuple[tuple[object, ...], dict[str, object]]]] = defaultdict(list)++ def recorder(method: Callable[..., object]) -> Callable[..., object]:+ signature = inspect.signature(method)operation = method.__name__- self.calls[operation].append((args, kwargs))- if operation not in self.results:- raise AssertionError(f"No result configured for {operation}")- return self.results[operation]-- def fetch_model_providers(self, tenant_id: str):- return self._record(PluginModelClient.fetch_model_providers, tenant_id)-- def validate_provider_credentials(self, **kwargs):- return self._record(PluginModelClient.validate_provider_credentials, **kwargs)-- def invoke_llm(self, **kwargs):- return self._record(PluginModelClient.invoke_llm, **kwargs)-- def start_llm_polling(self, **kwargs):- return self._record(PluginModelClient.start_llm_polling, **kwargs)- def check_llm_polling(self, **kwargs):- return self._record(PluginModelClient.check_llm_polling, **kwargs)-- def invoke_tts(self, **kwargs):- return self._record(PluginModelClient.invoke_tts, **kwargs)-- def get_model_schema(self, **kwargs):- return self._record(PluginModelClient.get_model_schema, **kwargs)-- def get_llm_num_tokens(self, **kwargs):- return self._record(PluginModelClient.get_llm_num_tokens, **kwargs)+ def record(*args: object, **kwargs: object) -> object:+ signature.bind(*args, **kwargs)+ calls[operation].append((args, kwargs))+ if operation not in results:+ raise AssertionError(f"No result configured for {operation}")+ return results[operation]++ return record++ for method in (+ client.fetch_model_providers,+ client.validate_provider_credentials,+ client.invoke_llm,+ client.start_llm_polling,+ client.check_llm_polling,+ client.invoke_tts,+ client.get_model_schema,+ client.get_llm_num_tokens,+ ):+ monkeypatch.setattr(client, method.__name__, recorder(method))+ return client, results, callsdef _redis_cache(monkeypatch: pytest.MonkeyPatch) -> tuple[Redis, list[tuple[str, int, str]]]:@@ -138,9 +133,9 @@ def _build_plugin_model_provider(*, tenant_id: str, provider: str = "openai") ->class TestPluginModelRuntime:"""Validate the adapter keeps plugin-specific routing out of the runtime port."""- def test_fetch_model_providers_returns_runtime_entities(self) -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+ def test_fetch_model_providers_returns_runtime_entities(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),@@ -166,11 +161,13 @@ class TestPluginModelRuntime:assert providers[0].provider == "langgenius/openai/openai"assert providers[0].provider_name == "openai"assert providers[0].label.en_us == "OpenAI"- assert client.calls["fetch_model_providers"] == [call("tenant")]+ assert client_calls["fetch_model_providers"] == [call("tenant")]- def test_fetch_model_providers_only_exposes_short_name_for_canonical_provider(self) -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+ def test_fetch_model_providers_only_exposes_short_name_for_canonical_provider(+ self, monkeypatch: pytest.MonkeyPatch+ ) -> None:+ client, client_results, _client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),@@ -212,9 +209,11 @@ class TestPluginModelRuntime:assert provider_aliases["acme/openai/openai"] == ""assert provider_aliases["langgenius/openai/openai"] == "openai"- def test_fetch_model_providers_keeps_google_alias_on_canonical_gemini_provider(self) -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+ def test_fetch_model_providers_keeps_google_alias_on_canonical_gemini_provider(+ self, monkeypatch: pytest.MonkeyPatch+ ) -> None:+ client, client_results, _client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),@@ -239,9 +238,9 @@ class TestPluginModelRuntime:assert providers[0].provider == "langgenius/gemini/google"assert providers[0].provider_name == "google"- def test_validate_provider_credentials_resolves_plugin_fields(self) -> None:- client = _RecordingModelClient()- client.results["validate_provider_credentials"] = True+ def test_validate_provider_credentials_resolves_plugin_fields(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["validate_provider_credentials"] = Trueruntime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)runtime.validate_provider_credentials(@@ -249,7 +248,7 @@ class TestPluginModelRuntime:credentials={"api_key": "secret"},)- assert client.calls["validate_provider_credentials"] == [+ assert client_calls["validate_provider_credentials"] == [call(tenant_id="tenant",user_id="user",@@ -259,10 +258,10 @@ class TestPluginModelRuntime:)]- def test_invoke_llm_resolves_plugin_fields(self) -> None:- client = _RecordingModelClient()+ def test_invoke_llm_resolves_plugin_fields(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)usage = LLMUsage.empty_usage()- client.results["invoke_llm"] = iter(+ client_results["invoke_llm"] = iter([LLMResultChunk(model="gpt-4o-mini",@@ -304,7 +303,7 @@ class TestPluginModelRuntime:assert result.message.content == "plugin response"assert result.usage == usageassert result.system_fingerprint == "fp-plugin"- assert client.calls["invoke_llm"] == [+ assert client_calls["invoke_llm"] == [call(tenant_id="tenant",user_id="user",@@ -320,9 +319,9 @@ class TestPluginModelRuntime:)]- def test_invoke_llm_forwards_string_app_id_from_request_metadata(self) -> None:- client = _RecordingModelClient()- client.results["invoke_llm"] = iter([])+ def test_invoke_llm_forwards_string_app_id_from_request_metadata(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["invoke_llm"] = iter([])runtime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.invoke_llm(@@ -338,7 +337,7 @@ class TestPluginModelRuntime:)assert list(result) == []- assert client.calls["invoke_llm"] == [+ assert client_calls["invoke_llm"] == [call(tenant_id="tenant",user_id="user",@@ -355,9 +354,9 @@ class TestPluginModelRuntime:)]- def test_invoke_llm_ignores_non_string_app_id_request_metadata(self) -> None:- client = _RecordingModelClient()- client.results["invoke_llm"] = iter([])+ def test_invoke_llm_ignores_non_string_app_id_request_metadata(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["invoke_llm"] = iter([])runtime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.invoke_llm(@@ -372,13 +371,13 @@ class TestPluginModelRuntime:request_metadata={"app_id": 123},)- assert result is client.results["invoke_llm"]- assert "app_id" not in client.calls["invoke_llm"][-1][1]+ assert result is client_results["invoke_llm"]+ assert "app_id" not in client_calls["invoke_llm"][-1][1]- def test_invoke_llm_returns_plugin_stream_directly(self) -> None:- client = _RecordingModelClient()+ def test_invoke_llm_returns_plugin_stream_directly(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)stream_result = iter([])- client.results["invoke_llm"] = stream_result+ client_results["invoke_llm"] = stream_resultruntime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.invoke_llm(@@ -393,7 +392,7 @@ class TestPluginModelRuntime:)assert result is stream_result- assert client.calls["invoke_llm"] == [+ assert client_calls["invoke_llm"] == [call(tenant_id="tenant",user_id="user",@@ -409,14 +408,14 @@ class TestPluginModelRuntime:)]- def test_start_llm_polling_resolves_plugin_fields(self) -> None:- client = _RecordingModelClient()+ def test_start_llm_polling_resolves_plugin_fields(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)polling_result = LLMPollingResult(status=LLMPollingStatus.RUNNING,plugin_state={"task_id": "poll-1"},next_check_after_seconds=2,)- client.results["start_llm_polling"] = polling_result+ client_results["start_llm_polling"] = polling_resultruntime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.start_llm_polling(@@ -431,7 +430,7 @@ class TestPluginModelRuntime:)assert result == polling_result- assert client.calls["start_llm_polling"] == [+ assert client_calls["start_llm_polling"] == [call(tenant_id="tenant",user_id="user",@@ -447,8 +446,8 @@ class TestPluginModelRuntime:)]- def test_check_llm_polling_resolves_plugin_fields(self) -> None:- client = _RecordingModelClient()+ def test_check_llm_polling_resolves_plugin_fields(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)polling_result = LLMPollingResult(status=LLMPollingStatus.SUCCEEDED,result=model_runtime_module.LLMResult(@@ -458,7 +457,7 @@ class TestPluginModelRuntime:usage=LLMUsage.empty_usage(),),)- client.results["check_llm_polling"] = polling_result+ client_results["check_llm_polling"] = polling_resultruntime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.check_llm_polling(@@ -469,7 +468,7 @@ class TestPluginModelRuntime:)assert result == polling_result- assert client.calls["check_llm_polling"] == [+ assert client_calls["check_llm_polling"] == [call(tenant_id="tenant",user_id="user",@@ -481,9 +480,9 @@ class TestPluginModelRuntime:)]- def test_invoke_llm_rejects_per_call_user_override(self) -> None:- client = _RecordingModelClient()- client.results["invoke_llm"] = sentinel.result+ def test_invoke_llm_rejects_per_call_user_override(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["invoke_llm"] = sentinel.resultruntime = PluginModelRuntime(tenant_id="tenant", user_id="bound-user", client=client, plugin_service=PluginService)@@ -501,11 +500,11 @@ class TestPluginModelRuntime:user_id="request-user",)- assert not client.calls["invoke_llm"]+ assert not client_calls["invoke_llm"]- def test_invoke_tts_uses_bound_runtime_user_when_runtime_is_unbound(self) -> None:- client = _RecordingModelClient()- client.results["invoke_tts"] = iter([b"chunk"])+ def test_invoke_tts_uses_bound_runtime_user_when_runtime_is_unbound(self, monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["invoke_tts"] = iter([b"chunk"])runtime = PluginModelRuntime(tenant_id="tenant", user_id=None, client=client, plugin_service=PluginService)result = runtime.invoke_tts(@@ -517,7 +516,7 @@ class TestPluginModelRuntime:)assert list(result) == [b"chunk"]- assert client.calls["invoke_tts"] == [+ assert client_calls["invoke_tts"] == [call(tenant_id="tenant",user_id=None,@@ -533,8 +532,8 @@ class TestPluginModelRuntime:def test_fetch_model_providers_does_not_keep_bound_runtime_cache(self, monkeypatch: pytest.MonkeyPatch, config_overrides: Callable[..., None]) -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = []+ client, client_results, client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = []from core.plugin import plugin_service as plugin_service_moduleredis = Redis()@@ -553,7 +552,7 @@ class TestPluginModelRuntime:runtime.fetch_model_providers()runtime.fetch_model_providers()- assert len(client.calls["fetch_model_providers"]) == 2+ assert len(client_calls["fetch_model_providers"]) == 2def test_fetch_model_providers_uses_tenant_ttl_cache_across_runtime_instances(self, monkeypatch: pytest.MonkeyPatch, config_overrides: Callable[..., None]@@ -563,9 +562,9 @@ class TestPluginModelRuntime:from core.plugin import plugin_service as plugin_service_modulemonkeypatch.setattr(plugin_service_module, "redis_client", redis)- first_client = _RecordingModelClient()- first_client.results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant")]- second_client = _RecordingModelClient()+ first_client, first_client_results, first_client_calls = _recording_model_client(monkeypatch)+ first_client_results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant")]+ second_client, _second_client_results, second_client_calls = _recording_model_client(monkeypatch)first_runtime = PluginModelRuntime(tenant_id="tenant", user_id="user-a", client=first_client, plugin_service=PluginService)@@ -578,8 +577,8 @@ class TestPluginModelRuntime:assert [provider.provider for provider in first_providers] == ["langgenius/openai/openai"]assert [provider.provider for provider in second_providers] == ["langgenius/openai/openai"]- assert first_client.calls["fetch_model_providers"] == [call("tenant")]- assert not second_client.calls["fetch_model_providers"]+ assert first_client_calls["fetch_model_providers"] == [call("tenant")]+ assert not second_client_calls["fetch_model_providers"]assert writes[0][1] == 300def test_fetch_model_providers_cache_is_tenant_isolated(@@ -590,10 +589,10 @@ class TestPluginModelRuntime:from core.plugin import plugin_service as plugin_service_modulemonkeypatch.setattr(plugin_service_module, "redis_client", redis)- first_client = _RecordingModelClient()- first_client.results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant-a")]- second_client = _RecordingModelClient()- second_client.results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant-b")]+ first_client, first_client_results, first_client_calls = _recording_model_client(monkeypatch)+ first_client_results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant-a")]+ second_client, second_client_results, second_client_calls = _recording_model_client(monkeypatch)+ second_client_results["fetch_model_providers"] = [_build_plugin_model_provider(tenant_id="tenant-b")]first_runtime = PluginModelRuntime(tenant_id="tenant-a", user_id="user", client=first_client, plugin_service=PluginService)@@ -606,14 +605,14 @@ class TestPluginModelRuntime:assert [provider.provider for provider in first_providers] == ["langgenius/openai/openai"]assert [provider.provider for provider in second_providers] == ["langgenius/openai/openai"]- assert first_client.calls["fetch_model_providers"] == [call("tenant-a")]- assert second_client.calls["fetch_model_providers"] == [call("tenant-b")]+ assert first_client_calls["fetch_model_providers"] == [call("tenant-a")]+ assert second_client_calls["fetch_model_providers"] == [call("tenant-b")]assert len(writes) == 2def test_fetch_model_providers_delegates_cache_to_injected_plugin_service(self, monkeypatch: pytest.MonkeyPatch) -> None:- client = _RecordingModelClient()+ client, _client_results, client_calls = _recording_model_client(monkeypatch)service_result = [ProviderEntity(provider="langgenius/openai/openai",@@ -636,7 +635,7 @@ class TestPluginModelRuntime:assert result is service_resultassert calls == [("tenant", client)]- assert not client.calls["fetch_model_providers"]+ assert not client_calls["fetch_model_providers"]def test_create_plugin_model_runtime_without_user_context() -> None:@@ -655,13 +654,13 @@ def test_plugin_model_runtime_requires_plugin_service() -> None:PluginModelRuntime(tenant_id="tenant",user_id="user",- client=_RecordingModelClient(),+ client=PluginModelClient(),plugin_service=None, # type: ignore[arg-type])def test_get_model_schema_uses_cached_schema_without_hitting_client(monkeypatch: pytest.MonkeyPatch) -> None:- client = _RecordingModelClient()+ client, _client_results, client_calls = _recording_model_client(monkeypatch)schema = _build_model_schema()redis = Redis()monkeypatch.setattr(redis, "get", lambda _key: schema.model_dump_json())@@ -676,7 +675,7 @@ def test_get_model_schema_uses_cached_schema_without_hitting_client(monkeypatch:)assert result == schema- assert not client.calls["get_model_schema"]+ assert not client_calls["get_model_schema"]def test_structured_output_adapter_invokes_bound_runtime_streaming(monkeypatch: pytest.MonkeyPatch) -> None:@@ -760,7 +759,7 @@ def test_structured_output_adapter_invokes_bound_runtime_non_streaming(monkeypatdef test_invoke_llm_with_structured_output_delegates_with_bound_adapter(monkeypatch: pytest.MonkeyPatch) -> None:- client = _RecordingModelClient()+ client, _client_results, _client_calls = _recording_model_client(monkeypatch)runtime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)schema = _build_model_schema()schema_calls: list[dict[str, object]] = []@@ -809,7 +808,7 @@ def test_invoke_llm_with_structured_output_delegates_with_bound_adapter(monkeypadef test_invoke_llm_with_structured_output_raises_when_model_schema_is_missing(monkeypatch: pytest.MonkeyPatch) -> None:- client = _RecordingModelClient()+ client, _client_results, _client_calls = _recording_model_client(monkeypatch)runtime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)monkeypatch.setattr(runtime, "get_model_schema", lambda **_kwargs: None)@@ -830,7 +829,7 @@ def test_get_model_schema_deletes_invalid_cache_and_refetches(monkeypatch: pytest.MonkeyPatch, config_overrides: Callable[..., None]) -> None:config_overrides(PLUGIN_MODEL_SCHEMA_CACHE_TTL=300)- client = _RecordingModelClient()+ client, client_results, client_calls = _recording_model_client(monkeypatch)schema = _build_model_schema()redis = Redis()deleted: list[str] = []@@ -843,7 +842,7 @@ def test_get_model_schema_deletes_invalid_cache_and_refetches(monkeypatch.setattr(redis, "delete", deleted.append)monkeypatch.setattr(redis, "setex", setex)monkeypatch.setattr(model_runtime_module, "redis_client", redis)- client.results["get_model_schema"] = schema+ client_results["get_model_schema"] = schemaruntime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)result = runtime.get_model_schema(@@ -855,7 +854,7 @@ def test_get_model_schema_deletes_invalid_cache_and_refetches(assert result == schemaassert len(deleted) == 1- assert client.calls["get_model_schema"] == [+ assert client_calls["get_model_schema"] == [call(tenant_id="tenant",user_id="user",@@ -871,8 +870,9 @@ def test_get_model_schema_deletes_invalid_cache_and_refetches(def test_get_llm_num_tokens_returns_zero_when_plugin_counting_is_disabled(config_overrides: Callable[..., None],+ monkeypatch: pytest.MonkeyPatch,) -> None:- client = _RecordingModelClient()+ client, _client_results, client_calls = _recording_model_client(monkeypatch)config_overrides(PLUGIN_BASED_TOKEN_COUNTING_ENABLED=False)runtime = PluginModelRuntime(tenant_id="tenant", user_id="user", client=client, plugin_service=PluginService)@@ -887,12 +887,12 @@ def test_get_llm_num_tokens_returns_zero_when_plugin_counting_is_disabled()== 0)- assert not client.calls["get_llm_num_tokens"]+ assert not client_calls["get_llm_num_tokens"]def test_get_provider_icon_reads_requested_variant_and_detects_svg_mime(monkeypatch: pytest.MonkeyPatch) -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+ client, client_results, _client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),@@ -932,9 +932,9 @@ def test_get_provider_icon_reads_requested_variant_and_detects_svg_mime(monkeypaassert asset_calls == [("tenant", "logo.svg")]-def test_get_provider_icon_rejects_unsupported_types_and_missing_variants() -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+def test_get_provider_icon_rejects_unsupported_types_and_missing_variants(monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, _client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),@@ -971,7 +971,7 @@ def test_get_provider_icon_rejects_unsupported_types_and_missing_variants() -> Ndef test_get_schema_cache_key_is_stable_across_credential_order() -> None:runtime = PluginModelRuntime(- tenant_id="tenant", user_id="user", client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id="user", client=PluginModelClient(), plugin_service=PluginService)first = runtime._get_schema_cache_key(@@ -992,10 +992,10 @@ def test_get_schema_cache_key_is_stable_across_credential_order() -> None:def test_get_schema_cache_key_separates_distinct_user_scopes() -> None:first_runtime = PluginModelRuntime(- tenant_id="tenant", user_id="user-a", client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id="user-a", client=PluginModelClient(), plugin_service=PluginService)second_runtime = PluginModelRuntime(- tenant_id="tenant", user_id="user-b", client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id="user-b", client=PluginModelClient(), plugin_service=PluginService)first = first_runtime._get_schema_cache_key(@@ -1016,10 +1016,10 @@ def test_get_schema_cache_key_separates_distinct_user_scopes() -> None:def test_get_schema_cache_key_separates_tenant_scope_from_user_scope() -> None:tenant_runtime = PluginModelRuntime(- tenant_id="tenant", user_id=None, client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id=None, client=PluginModelClient(), plugin_service=PluginService)user_runtime = PluginModelRuntime(- tenant_id="tenant", user_id="user-a", client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id="user-a", client=PluginModelClient(), plugin_service=PluginService)tenant_key = tenant_runtime._get_schema_cache_key(@@ -1041,10 +1041,10 @@ def test_get_schema_cache_key_separates_tenant_scope_from_user_scope() -> None:def test_get_schema_cache_key_separates_tenant_scope_from_empty_string_user_scope() -> None:tenant_runtime = PluginModelRuntime(- tenant_id="tenant", user_id=None, client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id=None, client=PluginModelClient(), plugin_service=PluginService)empty_user_runtime = PluginModelRuntime(- tenant_id="tenant", user_id="", client=_RecordingModelClient(), plugin_service=PluginService+ tenant_id="tenant", user_id="", client=PluginModelClient(), plugin_service=PluginService)tenant_key = tenant_runtime._get_schema_cache_key(@@ -1065,9 +1065,9 @@ def test_get_schema_cache_key_separates_tenant_scope_from_empty_string_user_scopassert TENANT_SCOPE_SCHEMA_CACHE_USER_ID not in empty_user_key-def test_get_provider_schema_supports_short_alias_and_rejects_invalid_provider() -> None:- client = _RecordingModelClient()- client.results["fetch_model_providers"] = [+def test_get_provider_schema_supports_short_alias_and_rejects_invalid_provider(monkeypatch: pytest.MonkeyPatch) -> None:+ client, client_results, _client_calls = _recording_model_client(monkeypatch)+ client_results["fetch_model_providers"] = [PluginModelProviderEntity(id=uuid.uuid4().hex,created_at=datetime.datetime.now(),