fix(proxy): forward every method on the typesafe pass-through route

#41607 registered the typesafe pass-through with a route that only accepted
GET and POST, so a PUT, DELETE or PATCH to /typesafe/... came back 405
before reaching the upstream. CircleCI's pass-through method test caught it,
but that lane does not run on the PR gate, so the mapped unit test now
covers the same invariant for typesafe

The same CircleCI run also failed test_models_by_provider because typesafe
is not a key of models_by_provider. Registering it there would satisfy the
assertion without changing behaviour: typesafe has no LlmProviders member,
so a typesafe/* deployment never loads and get_valid_models returns nothing,
and its spend is priced straight from model_cost. The test already skips
search-mode providers for that reason, so it now skips evaluation mode too
This commit is contained in:
Yuneng Jiang 2026-09-17 18:00:51 -07:00
parent 85fe646776
commit acc375a2a9
No known key found for this signature in database
3 changed files with 6 additions and 3 deletions

View file

@ -527,7 +527,7 @@ async def mistral_proxy_route(
@router.api_route(
"/typesafe/{endpoint:path}",
methods=["GET", "POST"], # mutable-ok: FastAPI route metadata requires a list
methods=["GET", "POST", "PUT", "DELETE", "PATCH"], # mutable-ok: FastAPI route metadata requires a list
tags=["TypeSafe AI Pass-through", "pass-through"], # mutable-ok: FastAPI route metadata requires a list
)
async def typesafe_proxy_route(

View file

@ -1360,8 +1360,7 @@ def test_models_by_provider():
or v["litellm_provider"] == "bedrock_converse"
):
continue
elif v.get("mode") == "search":
# Skip search providers as they don't have traditional models
elif v.get("mode") in ("search", "evaluation"):
continue
else:
providers.add(v["litellm_provider"])

View file

@ -6149,6 +6149,10 @@ class TestTypeSafePassthroughRoute:
request.json = AsyncMock(return_value=body)
return request
@pytest.mark.parametrize("method", ["GET", "POST", "PUT", "DELETE", "PATCH"])
def test_route_serves_every_method(self, method: str):
assert _resolve_route_name(method, "/typesafe/v1/systemone") == "typesafe_proxy_route"
@pytest.mark.asyncio
async def test_forwards_target_auth_headers_provider_and_query(self, monkeypatch):
monkeypatch.setenv("TYPESAFE_API_KEY", "typesafe-test-key")