Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

chore: merge latest staging into JWT E2E foundation

Yuneng Jiang4dd6af5722e6
diff --cc tests/e2e/coverage_registry/mgmt.yaml
index c3d7892aa79,c8d7037d2fd..d1227fe7c0c
--- a/tests/e2e/coverage_registry/mgmt.yaml
+++ b/tests/e2e/coverage_registry/mgmt.yaml
@@@ -74,7 -76,13 +76,17 @@@
- {id: mgmt.credential_migration.check.happy_path, module: mgmt, tier: P2, surface: api, assertions: [happy_path], source: "key_management_endpoints.py:4252", rationale: "Encryption migration (smoke)"}
- {id: mgmt.credential.new.serves_request, module: mgmt, tier: P1, surface: api, assertions: [serves_request], source: "credential_endpoints/endpoints.py:42", rationale: "Stored credential resolves into a deployment and serves a live /messages request"}
- {id: mgmt.model.test_connection.happy_path, module: mgmt, tier: P0, surface: api, assertions: [happy_path], source: "_health_endpoints.py:1785", rationale: "Test Connection for a responses-mode Bedrock Mantle deployment reaches the live provider and reports success; this exact shape 500ed on an acompletion partial before v1.91.0", fail_before_fix: proven}
+
+- {id: mgmt.key.jwt.lifecycle, module: mgmt, tier: P0, surface: api, assertions: [lifecycle], source: "management_endpoints/key_management_endpoints.py", rationale: "An IdP-issued admin JWT creates, reads, updates, clears and deletes a key; omitted fields survive updates"}
+- {id: mgmt.key.jwt.member_denied, module: mgmt, tier: P0, surface: api, assertions: [member_denied], source: "auth/handle_jwt.py", rationale: "A valid member JWT cannot update an admin-managed key and denial leaves it unchanged"}
+- {id: mgmt.key.jwt.other_team_denied, module: mgmt, tier: P0, surface: api, assertions: [other_team_denied], source: "auth/handle_jwt.py", rationale: "A valid JWT for another existing team cannot read the key"}
+ - {id: mgmt.mcp_server.new.persists, module: mgmt, tier: P0, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:1577", rationale: "Every field of an admin-created MCP server reads back verbatim, by id and in the list, on every replica"}
+ - {id: mgmt.mcp_server.list.persists, module: mgmt, tier: P1, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:1112", rationale: "The MCP page grid lists a created server with the same field values its detail view reports"}
+ - {id: mgmt.mcp_server.update.preserves_unrelated_fields, module: mgmt, tier: P0, surface: api, assertions: [preserves_unrelated_fields], source: "mcp_management_endpoints.py:2665", rationale: "A dashboard edit of one field leaves the others intact and is visible on every replica after one save; edits that took several saves to stick were a customer defect"}
+ - {id: mgmt.mcp_server.update.clear_persists, module: mgmt, tier: P0, surface: api, assertions: [clear_persists], source: "mcp_management_endpoints.py:2665", rationale: "An explicit null clears the stored field (absent keeps, null clears)"}
+ - {id: mgmt.mcp_server.delete.persists, module: mgmt, tier: P0, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:2139", rationale: "A deleted server is gone by id and from the list on every replica"}
+ - {id: mgmt.mcp_toolset.new.persists, module: mgmt, tier: P0, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:3009", rationale: "Toolset tools read back under the exact server_id and tool_name written; a toolset stored under one name and read under another granted nothing"}
+ - {id: mgmt.mcp_toolset.update.preserves_unrelated_fields, module: mgmt, tier: P0, surface: api, assertions: [preserves_unrelated_fields], source: "mcp_management_endpoints.py:3098", rationale: "Editing the description leaves the tools and name intact"}
+ - {id: mgmt.mcp_toolset.update.persists, module: mgmt, tier: P0, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:3098", rationale: "Narrowing the tools to one entry reads back exactly that entry"}
+ - {id: mgmt.mcp_toolset.update.clear_persists, module: mgmt, tier: P0, surface: api, assertions: [clear_persists], source: "mcp_management_endpoints.py:3098", fail_before_fix: proven, rationale: "An explicit null clears the stored description; the update used to drop null and keep the old value"}
+ - {id: mgmt.mcp_toolset.delete.persists, module: mgmt, tier: P0, surface: api, assertions: [persists], source: "mcp_management_endpoints.py:3149", rationale: "A deleted toolset is gone by id and from the list on every replica"}
diff --cc tests/e2e/e2e_http.py
index 061fbc23fde,415c72bbb3c..ce069720c6e
--- a/tests/e2e/e2e_http.py
+++ b/tests/e2e/e2e_http.py
@@@ -266,8 -257,15 +271,14 @@@ def assert_auth_denied(result: Streamin
f"{context}: expected 401/403, got {result.status_code}: {result.body[:300]}"
)
-
+ def wire_body(json: BaseModel) -> dict[str, object]:
+ if isinstance(json, PartialBody):
+ return json.model_dump(by_alias=True, exclude_unset=True)
+ return json.model_dump(by_alias=True, exclude_none=True)
+
+
-def _headers(headers: BaseModel) -> dict[str, str]:
- dumped: dict[str, object] = headers.model_dump(by_alias=True, exclude_none=True)
+def _flat(model: BaseModel) -> dict[str, str]:
+ dumped: dict[str, object] = model.model_dump(by_alias=True, exclude_none=True)
return {key: str(value) for key, value in dumped.items()}
@@@ -398,65 -413,9 +427,65 @@@ def get_external[R: BaseModel]
)
except requests.RequestException as exc:
return NetworkError(message=str(exc))
- return _classify(resp, response_type)
+ return classify(resp, response_type)
+def post_form_external[R: BaseModel](
+ url: str,
+ *,
+ form: BaseModel,
+ response_type: type[R],
+ headers: BaseModel | None = None,
+ timeout: float = 30.0,
+) -> Result[R]:
+ """POST an absolute URL outside the proxy as `application/x-www-form-urlencoded`,
+ the encoding OAuth 2 token endpoints take. Like get_external: no proxy base url,
+ no proxy auth, and the same tagged-union classification as every other call."""
+ try:
+ resp = requests.post(
+ url,
+ data=_flat(form),
+ headers=_headers(headers) if headers is not None else None,
+ timeout=timeout,
+ )
+ except requests.RequestException as exc:
+ return NetworkError(message=str(exc))
- return _classify(resp, response_type)
++ return classify(resp, response_type)
+
+
+def post_json_external(
+ url: str,
+ *,
+ headers: BaseModel,
+ json: BaseModel,
+ timeout: float = 30.0,
+) -> ExternalWrite:
+ """POST an absolute URL outside the proxy under its own bearer, for an API that
+ answers a create with a status and a Location header rather than a JSON body."""
+ try:
+ resp = requests.post(
+ url,
+ headers=_headers(headers),
+ json=json.model_dump(by_alias=True, exclude_none=True),
+ timeout=timeout,
+ )
+ except requests.RequestException as exc:
+ return ExternalWrite(status_code=-1, body=str(exc))
+ return ExternalWrite(
+ status_code=resp.status_code,
+ location=resp.headers.get("Location", ""),
+ body=resp.text,
+ )
+
+
+def delete_external(url: str, *, headers: BaseModel, timeout: float = 30.0) -> ExternalWrite:
+ try:
+ resp = requests.delete(url, headers=_headers(headers), timeout=timeout)
+ except requests.RequestException as exc:
+ return ExternalWrite(status_code=-1, body=str(exc))
+ return ExternalWrite(status_code=resp.status_code, body=resp.text)
+
+
def delete[R: BaseModel](
url: URL,
*,
diff --cc tests/e2e/proxy_client.py
index 5292f56b324,1bac5116a9d..506edd22d72
--- a/tests/e2e/proxy_client.py
+++ b/tests/e2e/proxy_client.py
@@@ -66,11 -72,9 +72,14 @@@ from models import
SpendLogsPage,
SpendLogsPageParams,
SpendLogsParams,
+ TeamDeleteBody,
+ TeamNewBody,
+ TeamNewResponse,
+ UserDeleteBody,
+ UserDeleteResponse,
+ ToolsetCreateBody,
+ ToolsetRow,
+ ToolsetUpdateBody,
)
from e2e_config import (
CONTROL_PLANE_BASE_URL,