fix(vector-stores): approve config gRPC stores with prefixed providers

approve_configured_connection only stamped the admin marker when the
provider was exactly "milvus", while gRPC detection and the managed
rejection both normalize prefixed values such as "milvus/team", so a
config-defined gRPC store with a prefixed provider was rejected with 403
on every search. Normalize the provider the same way before stamping

Also give VectorStoreRegistry and VectorStoreIndexRegistry their own
list per instance instead of a shared mutable default, which made every
registry built without an explicit list see the stores loaded into any
other one. The budget files are ratcheted from the merge-base values, so
the earlier merge commit's double-lowered limits are corrected here
This commit is contained in:
mateo-berri 2026-09-05 13:07:46 -07:00
parent 6af361c4bb
commit 7ffa8eb1d0
7 changed files with 35 additions and 19 deletions

View file

@ -1,9 +1,9 @@
{
"reportAny": {
"limit": 13422
"limit": 13427
},
"reportArgumentType": {
"limit": 2137
"limit": 2187
},
"reportAssignmentType": {
"limit": 319
@ -24,7 +24,7 @@
"limit": 19
},
"reportExplicitAny": {
"limit": 3363
"limit": 3368
},
"reportFunctionMemberAccess": {
"limit": 7
@ -57,7 +57,7 @@
"limit": 5570
},
"reportMissingTypeArgument": {
"limit": 15246
"limit": 15275
},
"reportMissingTypeStubs": {
"limit": 40
@ -99,19 +99,19 @@
"limit": 0
},
"reportUnknownArgumentType": {
"limit": 42551
"limit": 44133
},
"reportUnknownLambdaType": {
"limit": 109
},
"reportUnknownMemberType": {
"limit": 38191
"limit": 38267
},
"reportUnknownParameterType": {
"limit": 19576
"limit": 19582
},
"reportUnknownVariableType": {
"limit": 29814
"limit": 29826
},
"reportUnnecessaryCast": {
"limit": 110
@ -123,7 +123,7 @@
"limit": 4
},
"reportUnnecessaryIsInstance": {
"limit": 810
"limit": 815
},
"reportUntypedBaseClass": {
"limit": 0

View file

@ -125,6 +125,6 @@ def managed_connection_fields(custom_llm_provider: object) -> frozenset[str]:
def approve_configured_connection(
custom_llm_provider: object, litellm_params: Mapping[str, object]
) -> Mapping[str, object]:
if custom_llm_provider == "milvus" and litellm_params.get("milvus_transport") == "grpc":
if _normalize_provider(custom_llm_provider) == "milvus" and litellm_params.get("milvus_transport") == "grpc":
return MappingProxyType({**litellm_params, MILVUS_ADMIN_CONFIGURED_CONNECTION: True})
return litellm_params

View file

@ -58,8 +58,10 @@ def _normalized_vector_store(vector_store: LiteLLM_ManagedVectorStore) -> LiteLL
class VectorStoreIndexRegistry:
def __init__(self, vector_store_indexes: list[LiteLLM_ManagedVectorStoreIndex] = []):
self.vector_store_indexes: list[LiteLLM_ManagedVectorStoreIndex] = vector_store_indexes
def __init__(self, vector_store_indexes: list[LiteLLM_ManagedVectorStoreIndex] | None = None):
self.vector_store_indexes: list[LiteLLM_ManagedVectorStoreIndex] = (
vector_store_indexes if vector_store_indexes is not None else []
)
def get_vector_store_indexes(self) -> list[LiteLLM_ManagedVectorStoreIndex]:
"""
@ -127,8 +129,8 @@ class VectorStoreIndexRegistry:
class VectorStoreRegistry:
def __init__(self, vector_stores: list[LiteLLM_ManagedVectorStore] = []):
self.vector_stores: list[LiteLLM_ManagedVectorStore] = vector_stores
def __init__(self, vector_stores: list[LiteLLM_ManagedVectorStore] | None = None):
self.vector_stores: list[LiteLLM_ManagedVectorStore] = vector_stores if vector_stores is not None else []
self.vector_store_ids_to_vector_store_map: dict[str, LiteLLM_ManagedVectorStore] = {}
self.config_vector_store_ids: frozenset[str] = frozenset()

View file

@ -33,7 +33,7 @@
"limit": 2
},
"B006": {
"limit": 176
"limit": 174
},
"B008": {
"limit": 503
@ -246,7 +246,7 @@
"limit": 109
},
"TRY300": {
"limit": 848
"limit": 851
},
"UP028": {
"limit": 2

View file

@ -21,6 +21,6 @@
"limit": 117
},
"TQ008": {
"limit": 10972
"limit": 10990
}
}

View file

@ -794,13 +794,14 @@ async def test_unmarked_managed_milvus_connection_requires_admin_resave():
@pytest.mark.asyncio
async def test_config_loaded_milvus_grpc_connection_is_trusted():
@pytest.mark.parametrize("custom_llm_provider", ["milvus", "milvus/probe"])
async def test_config_loaded_milvus_grpc_connection_is_trusted(custom_llm_provider: str):
registry = VectorStoreRegistry()
source = {
"vector_store_name": "configured",
"litellm_params": {
"vector_store_id": "configured",
"custom_llm_provider": "milvus",
"custom_llm_provider": custom_llm_provider,
"milvus_transport": "grpc",
"api_base": "https://configured-milvus:19530",
"litellm_embedding_model": "team-embedding-alias",

View file

@ -105,6 +105,19 @@ def test_get_credentials_for_vector_store():
assert result == {}
def test_fresh_registries_do_not_share_config_loaded_stores():
VectorStoreRegistry().load_vector_stores_from_config(
[
{
"vector_store_name": "configured",
"litellm_params": {"vector_store_id": "configured", "custom_llm_provider": "openai"},
}
]
)
assert VectorStoreRegistry().get_litellm_managed_vector_store_from_registry("configured") is None
def test_add_vector_store_to_registry():
"""Test that add_vector_store_to_registry adds vector store correctly when there are pre-existing stores"""
# Create pre-existing vector stores