You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by gs...@apache.org on 2026/08/10 03:57:23 UTC

(tooling-llmao) branch main updated: Remove litellm mock/proxy app mode; mock is tests-only.

This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-llmao.git


The following commit(s) were added to refs/heads/main by this push:
     new 3afbeb3  Remove litellm mock/proxy app mode; mock is tests-only.
3afbeb3 is described below

commit 3afbeb36546e752b93c5e71374f0667a3ee66cfc
Author: Greg Stein <gs...@gmail.com>
AuthorDate: Sun Aug 9 22:57:18 2026 -0500

    Remove litellm mock/proxy app mode; mock is tests-only.
    
    Always construct LiteLLMBackend so local run matches production (LiteLLM +
    Postgres). Drop litellm.mode, require_proxy_mode, and UI mode gates. Move
    MockBackend to tests/mock_backend.py for offline seam tests only.
    
    Co-authored-by: Grok <gr...@x.ai>
---
 README.md               |  18 ++++-----
 api.py                  |   2 +-
 config.yaml.example     |   5 +--
 docs/ARCHITECTURE.md    |   7 ++--
 docs/STATUS.md          |  11 +++---
 llmao/litellm_client.py | 101 +++--------------------------------------------
 llmao/seam.py           |  22 -----------
 llmao/store.py          |   7 ++--
 pages.py                |  20 +++-------
 templates/footer.ezt    |   1 -
 tests/mock_backend.py   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/test_phase1.py    |  35 ++++------------
 12 files changed, 144 insertions(+), 188 deletions(-)

diff --git a/README.md b/README.md
index 4199658..ebf270e 100644
--- a/README.md
+++ b/README.md
@@ -61,14 +61,9 @@ cp model_list.yaml.example model_list.yaml
 make run                               # uv run python main.py
 ```
 
-Open `https://localhost.apache.org:8443/` (port from `config.yaml`), sign in
-with ASF. Default `litellm.mode: mock` needs no LiteLLM process (still needs
-`model_list.yaml` for inventory).
-
-### Real LiteLLM (proxy mode)
-
-Needs **system PostgreSQL** (Ubuntu packages; same idea as production — not
-containers) and the **prisma** client from `litellm[proxy,extra-proxy]`.
+Local run is **production-shaped**: LiteLLM + system Postgres (not an in-app
+mock mode). Needs **system PostgreSQL** and **prisma** from
+`litellm[proxy,extra-proxy]`.
 
 ```bash
 # Postgres running (e.g. apt install postgresql; service started)
@@ -78,11 +73,13 @@ make db                                # bin/setup_litellm_db.py
 #   litellm.yaml  → general_settings.master_key
 #   config.yaml   → litellm.master_key
 # set api keys in model_list.yaml (eyaml in production)
-# config.yaml → litellm.mode: proxy
 make proxy                             # litellm --config litellm.yaml
 make run
 ```
 
+Open `https://localhost.apache.org:8443/` (port from `config.yaml`), sign in
+with ASF.
+
 PAT metadata lives in LiteLLM’s Postgres. Model inventory is **only**
 `model_list.yaml` (not DB `STORE_MODEL_IN_DB`). Provider **API keys** in that
 file come from eyaml in production; **`api_base` is cleartext** (not shown in UX).
@@ -106,7 +103,8 @@ make test          # offline seam + model_list tests (no OAuth session automatio
 
 ASF login (asfquart), project membership from LDAP, LiteLLM admin via async
 httpx, **`model_list.yaml`** inventory (include + UX), system Postgres + Prisma
-setup, and **PAT UX** in proxy mode (personal keys; provisional automation keys).
+setup, and **PAT UX** against live LiteLLM (personal keys; provisional automation keys).
+Unit tests use `tests/mock_backend.py` only.
 
 Full status, edge cases, and backlog: **[`docs/STATUS.md`](docs/STATUS.md)**.  
 Architecture: **[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)**.  
diff --git a/api.py b/api.py
index def66e9..2234f7a 100644
--- a/api.py
+++ b/api.py
@@ -38,7 +38,7 @@ def _err(status: int, message: str) -> Response:
 
 @APP.get("/healthz")
 async def healthz():
-    return jsonify({"status": "ok", "llm_mode": APP.cfg.litellm.mode})
+    return jsonify({"status": "ok"})
 
 
 @APP.get("/v1/projects/<project>/usage")
diff --git a/config.yaml.example b/config.yaml.example
index 19a2572..d70bb4a 100644
--- a/config.yaml.example
+++ b/config.yaml.example
@@ -21,9 +21,8 @@ server:
   keyfile: localhost.apache.org+3-key.pem
 
 litellm:
-  # mock = in-process fake teams/usage (no LiteLLM process).
-  # proxy = real LiteLLM admin API at base_url (requires litellm.yaml + Postgres).
-  mode: mock
+  # Always talks to a real LiteLLM admin API (same shape as production).
+  # Local: make db && make proxy (system Postgres + litellm.yaml).
   base_url: http://127.0.0.1:4000
   # Same value as litellm.yaml → general_settings.master_key (must start with sk-).
   # Bearer token for /team/* and /key/* from this process.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index fecc5c3..7f1bc32 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -26,7 +26,7 @@ both bind to `asfquart.APP` after construct. Standalone: `python main.py`
 
 Local TLS: `config.yaml` `server.certfile` / `keyfile` under `certs/`, typically
 mkcert for **`localhost.apache.org`**. `config.yaml` is gitignored (secrets).
-Loaded as **`APP.cfg`** (EasyDict); use dotted access (`APP.cfg.litellm.mode`).
+Loaded as **`APP.cfg`** (EasyDict); use dotted access (`APP.cfg.litellm.base_url`).
 
 ## The two halves
 
@@ -57,8 +57,9 @@ metadata in LiteLLM.
 
 Build status and backlog: **`docs/STATUS.md`**.
 
-`litellm.mode: mock` in config is only an offline stand-in for team/usage
-storage in tests and laptop work without a proxy—not a second auth system.
+The app **always** uses **LiteLLMBackend** against a real LiteLLM admin API.
+Offline **MockBackend** lives under `tests/` and is injected only by unit
+tests—not a second runtime mode.
 
 ## The seam
 
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 212e636..bd625ff 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -16,11 +16,12 @@ Detailed “where we are.” Top-level README stays short and links here.
 | asfquart always | OAuth + LDAP session; no auth-mode split |
 | Run | `main.py` (TLS/`certs`) + ASGI `llmao_app` (Hypercorn) |
 | Config | `APP.cfg` EasyDict from `config.yaml` (dotted access) |
-| LiteLLM admin client | Async **httpx** |
+| LiteLLM admin client | Async **httpx** → **LiteLLMBackend** always (no app mock mode) |
 | Model inventory SoT | **`model_list.yaml`** + LiteLLM `include`; flat `model_info`; **no** `STORE_MODEL_IN_DB` for inventory |
 | Secrets | On-disk YAML; prod **hiera/eyaml**; same `master_key` in `config.yaml` + `litellm.yaml`; provider **API keys** in `model_list.yaml`; **api_base** cleartext |
 | Postgres / Prisma | `litellm[proxy,extra-proxy]`; system PostgreSQL; `make db` |
-| **PAT UX (proxy)** | `/keys` list/create/revoke; personal + admin automation; secret once; revoke modal |
+| **PAT UX** | `/keys` list/create/revoke; personal + admin automation; secret once; revoke modal |
+| Tests | Offline **`tests/mock_backend.py`** injected into Seam — not a config mode |
 
 ### Credential rules (as implemented)
 
@@ -37,9 +38,9 @@ Detailed “where we are.” Top-level README stays short and links here.
 
 **RAI decision pending.** Options: (A) RAI / proxy admins only, (B) PMC Chair/VP (or nominated role), (C) any PMC member (**current code**). Documented in design; tooling may tighten after RAI decides.
 
-### Local proxy path
+### Local path (production-shaped)
 
-Copy three YAMLs from `*.example` → system Postgres + `make db` → matching master keys → `litellm.mode: proxy` → `make proxy` + `make run`.
+Copy three YAMLs from `*.example` → system Postgres + `make db` → matching master keys → `make proxy` + `make run`. There is **no** mock app mode; LiteLLM must be up for PAT UX (else `BackendUnavailable`).
 
 ---
 
@@ -47,7 +48,7 @@ Copy three YAMLs from `*.example` → system Postgres + `make db` → matching m
 
 | Issue | Notes |
 |-------|--------|
-| mock mode | PAT pages refuse; need proxy + DB |
+| LiteLLM down | PAT / admin API pages surface `BackendUnavailable` |
 | Last used | Best-effort; may be `—` or `updated_at` |
 | Model cost $0 | LiteLLM default without pricing metadata |
 | Site admin = `rai` PMC | Not automatic; `site_admins` + isRoot |
diff --git a/llmao/litellm_client.py b/llmao/litellm_client.py
index 2eeb445..2d2b1e2 100644
--- a/llmao/litellm_client.py
+++ b/llmao/litellm_client.py
@@ -1,14 +1,14 @@
 """LiteLLM admin backend (async httpx).
 
-ProxyBackend talks to a real LiteLLM proxy. MockBackend is offline CI only.
+LiteLLMBackend talks to a real LiteLLM proxy. The running app always uses this
+client. Tests inject a mock from tests/mock_backend.py — never selected by config.
 PATs are virtual keys; list/create/delete go through admin APIs. Team ensure
 stores team_id only (not a product PAT).
 """
 from __future__ import annotations
 
 import time
-import uuid
-from dataclasses import dataclass, field
+from dataclasses import dataclass
 from typing import Any, Dict, List, Optional, Protocol
 
 import httpx
@@ -128,96 +128,7 @@ def _normalize_key_obj(raw: Any) -> KeyInfo:
     )
 
 
-class MockBackend:
-    """Offline CI only — not used for product PAT UX."""
-
-    def __init__(self, cfg: Any, store: StateStore):
-        self._cfg = cfg
-        self._store = store
-
-    async def ensure_team(self, project: str, budget_usd: float, duration: str) -> TeamInfo:
-        def _mut(data):
-            teams = data.setdefault("teams", {})
-            if project not in teams:
-                teams[project] = {
-                    "team_id": f"team-{uuid.uuid4().hex[:12]}",
-                    "max_budget": budget_usd,
-                    "spend": 0.0,
-                    "duration": duration,
-                    "created_at": time.time(),
-                }
-            t = teams[project]
-            return TeamInfo(t["team_id"], t.get("max_budget", 0.0), t.get("spend", 0.0))
-        return self._store.update(_mut)
-
-    async def team_info(self, project: str) -> Optional[TeamInfo]:
-        t = self._store.snapshot().get("teams", {}).get(project)
-        if not t:
-            return None
-        return TeamInfo(t["team_id"], t.get("max_budget", 0.0), t.get("spend", 0.0))
-
-    async def list_keys(
-        self,
-        *,
-        user_id: Optional[str] = None,
-        team_id: Optional[str] = None,
-        size: int = 100,
-    ) -> List[KeyInfo]:
-        keys = self._store.snapshot().get("keys", [])
-        out = []
-        for k in keys:
-            if user_id is not None and k.get("user_id") != user_id:
-                continue
-            if team_id is not None and k.get("team_id") != team_id:
-                continue
-            out.append(_normalize_key_obj(k))
-            if len(out) >= size:
-                break
-        return out
-
-    async def create_key(
-        self,
-        *,
-        team_id: str,
-        key_alias: str,
-        user_id: Optional[str] = None,
-        metadata: Optional[Dict] = None,
-    ) -> CreatedKey:
-        secret = f"sk-mock-{uuid.uuid4().hex}"
-        token = f"tok-{uuid.uuid4().hex[:16]}"
-        row = {
-            "token": token,
-            "key_alias": key_alias,
-            "team_id": team_id,
-            "user_id": user_id,
-            "spend": 0.0,
-            "max_budget": None,
-            "created_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
-            "last_used": None,
-            "metadata": metadata or {},
-        }
-
-        def _mut(data):
-            data.setdefault("keys", []).append(row)
-        self._store.update(_mut)
-        return CreatedKey(secret=secret, info=_normalize_key_obj(row))
-
-    async def delete_key(self, token: str) -> None:
-        def _mut(data):
-            data["keys"] = [k for k in data.get("keys", []) if k.get("token") != token]
-        self._store.update(_mut)
-
-    async def usage(self, project: Optional[str]) -> List[Dict]:
-        rows = self._store.snapshot().get("usage", [])
-        if project is None:
-            return list(rows)
-        return [r for r in rows if r.get("project") == project]
-
-    async def aclose(self) -> None:
-        return None
-
-
-class ProxyBackend:
+class LiteLLMBackend:
     """Talks to a running litellm proxy via httpx.AsyncClient."""
 
     def __init__(self, cfg: Any, store: StateStore):
@@ -413,6 +324,4 @@ class ProxyBackend:
 
 
 def make_backend(cfg: Any, store: StateStore) -> Backend:
-    if cfg.litellm.mode != "proxy":
-        return MockBackend(cfg, store)
-    return ProxyBackend(cfg, store)
+    return LiteLLMBackend(cfg, store)
diff --git a/llmao/seam.py b/llmao/seam.py
index 8cb8d0f..b32868b 100644
--- a/llmao/seam.py
+++ b/llmao/seam.py
@@ -16,23 +16,6 @@ class AuthzError(Exception):
     """Caller is not allowed to perform this action on the project."""
 
 
-class ConfigError(Exception):
-    """Wrong runtime mode or configuration for this feature."""
-
-
-def require_proxy_mode(fn):
-    @functools.wraps(fn)
-    async def wrapper(self, *args, **kwargs):
-        if self._cfg.litellm.mode != "proxy":
-            raise ConfigError(
-                "PAT management requires litellm.mode: proxy "
-                "(and a running LiteLLM with database_url)."
-            )
-        return await fn(self, *args, **kwargs)
-
-    return wrapper
-
-
 def require_member(fn):
     """Expects (self, identity, project, ...)."""
     @functools.wraps(fn)
@@ -89,11 +72,9 @@ class Seam:
     async def team_status(self, identity: Identity, project: str) -> Optional[TeamInfo]:
         return await self._backend.team_info(project)
 
-    @require_proxy_mode
     async def list_my_keys(self, identity: Identity) -> List[KeyInfo]:
         return await self._backend.list_keys(user_id=identity.uid, size=100)
 
-    @require_proxy_mode
     @require_admin
     async def list_automation_keys(self, identity: Identity, project: str) -> List[KeyInfo]:
         """Automation keys for a project (admin / PMC only)."""
@@ -101,7 +82,6 @@ class Seam:
         keys = await self._backend.list_keys(team_id=team.team_id, size=100)
         return [k for k in keys if k.kind == "automation"]
 
-    @require_proxy_mode
     @require_member
     async def create_personal_key(
         self,
@@ -120,7 +100,6 @@ class Seam:
             metadata={"project": project, "kind": "personal"},
         )
 
-    @require_proxy_mode
     @require_admin
     async def create_automation_key(
         self,
@@ -144,7 +123,6 @@ class Seam:
             },
         )
 
-    @require_proxy_mode
     async def revoke_key(self, identity: Identity, token: str) -> None:
         token = (token or "").strip()
         if not token:
diff --git a/llmao/store.py b/llmao/store.py
index 70c67e3..ad94363 100644
--- a/llmao/store.py
+++ b/llmao/store.py
@@ -1,9 +1,8 @@
 """Minimal JSON-file state store.
 
-Phase 1 keeps the seam's project->team mapping and the mock backend's usage
-log in a single JSON file so the app runs with zero infrastructure. The
-interface is deliberately small (get/set/update under a lock) so it can be
-swapped for a real database later without touching callers.
+LiteLLMBackend uses this as a local project→team_id cache (and legacy usage
+rows). Tests reuse it for MockBackend. Not a second “app mode”—the running
+app still requires LiteLLM for admin APIs.
 """
 from __future__ import annotations
 
diff --git a/pages.py b/pages.py
index 32085c6..b168e3e 100644
--- a/pages.py
+++ b/pages.py
@@ -30,7 +30,7 @@ from easydict import EasyDict as edict
 
 from llmao.auth import current_identity
 from llmao.litellm_client import BackendUnavailable, KeyInfo
-from llmao.seam import AuthzError, ConfigError
+from llmao.seam import AuthzError
 
 APP = asfquart.APP
 
@@ -49,8 +49,6 @@ async def basic_info() -> edict:
     basic.title = "llmao"
     basic.flashes = []
     basic.error = None
-    basic.llm_mode = APP.cfg.litellm.mode
-    basic.is_proxy = APP.cfg.litellm.mode == "proxy"
 
     # Form defaults for create page
     basic.form_project = ""
@@ -132,12 +130,6 @@ async def keys_list():
     result.title = "API keys (PATs)"
     result.keys = []
     result.error = None
-    if not result.is_proxy:
-        result.error = (
-            "PAT management requires litellm.mode: proxy and a running LiteLLM "
-            "with Postgres. Set that in config.yaml and run make proxy."
-        )
-        return result
     try:
         ident = await current_identity(APP.cfg)
         assert ident is not None
@@ -152,10 +144,10 @@ async def keys_list():
             try:
                 for k in await seam.list_automation_keys(ident, p):
                     by_tok.setdefault(k.token, k)
-            except (AuthzError, BackendUnavailable, ConfigError):
+            except (AuthzError, BackendUnavailable):
                 continue
         result.keys = _key_rows(list(by_tok.values()))
-    except (ConfigError, AuthzError, BackendUnavailable) as e:
+    except (AuthzError, BackendUnavailable) as e:
         result.error = str(e)
     return result
 
@@ -166,8 +158,6 @@ async def keys_list():
 async def keys_new_form():
     result = await basic_info()
     result.title = "Create API key"
-    if not result.is_proxy:
-        result.error = "PAT management requires litellm.mode: proxy."
     return result
 
 
@@ -187,7 +177,7 @@ async def keys_new_submit():
             created = await seam.create_automation_key(ident, project, purpose)
         else:
             created = await seam.create_personal_key(ident, project, purpose)
-    except (ConfigError, AuthzError, BackendUnavailable) as e:
+    except (AuthzError, BackendUnavailable) as e:
         result = await basic_info()
         result.title = "Create API key"
         result.error = str(e)
@@ -216,7 +206,7 @@ async def keys_revoke():
         seam = APP.config["LLMAO_SEAM"]
         await seam.revoke_key(ident, token)
         await quart.flash("Key revoked.", "success")
-    except (ConfigError, AuthzError, BackendUnavailable) as e:
+    except (AuthzError, BackendUnavailable) as e:
         await quart.flash(str(e), "danger")
     return quart.redirect("/keys")
 
diff --git a/templates/footer.ezt b/templates/footer.ezt
index ed2a081..5cdaa9a 100644
--- a/templates/footer.ezt
+++ b/templates/footer.ezt
@@ -2,7 +2,6 @@
     <div class="container">
         <p class="text-muted mb-0 small">
             Apache llmao — gateway seam for ASF LiteLLM access.
-            litellm mode: <code>[llm_mode]</code>
         </p>
     </div>
 </footer>
diff --git a/tests/mock_backend.py b/tests/mock_backend.py
new file mode 100644
index 0000000..2818a29
--- /dev/null
+++ b/tests/mock_backend.py
@@ -0,0 +1,103 @@
+"""In-process LiteLLM stand-in for the test suite only.
+
+The running app always uses LiteLLMBackend against a real proxy. Tests inject
+this mock so seam authz and PAT flows can run offline.
+"""
+from __future__ import annotations
+
+import time
+import uuid
+from typing import Any, Dict, List, Optional
+
+from llmao.litellm_client import CreatedKey, KeyInfo, TeamInfo, _normalize_key_obj
+from llmao.store import StateStore
+
+
+class MockBackend:
+    def __init__(self, cfg: Any, store: StateStore):
+        self._cfg = cfg
+        self._store = store
+
+    async def ensure_team(self, project: str, budget_usd: float, duration: str) -> TeamInfo:
+        def _mut(data):
+            teams = data.setdefault("teams", {})
+            if project not in teams:
+                teams[project] = {
+                    "team_id": f"team-{uuid.uuid4().hex[:12]}",
+                    "max_budget": budget_usd,
+                    "spend": 0.0,
+                    "duration": duration,
+                    "created_at": time.time(),
+                }
+            t = teams[project]
+            return TeamInfo(t["team_id"], t.get("max_budget", 0.0), t.get("spend", 0.0))
+
+        return self._store.update(_mut)
+
+    async def team_info(self, project: str) -> Optional[TeamInfo]:
+        t = self._store.snapshot().get("teams", {}).get(project)
+        if not t:
+            return None
+        return TeamInfo(t["team_id"], t.get("max_budget", 0.0), t.get("spend", 0.0))
+
+    async def list_keys(
+        self,
+        *,
+        user_id: Optional[str] = None,
+        team_id: Optional[str] = None,
+        size: int = 100,
+    ) -> List[KeyInfo]:
+        keys = self._store.snapshot().get("keys", [])
+        out = []
+        for k in keys:
+            if user_id is not None and k.get("user_id") != user_id:
+                continue
+            if team_id is not None and k.get("team_id") != team_id:
+                continue
+            out.append(_normalize_key_obj(k))
+            if len(out) >= size:
+                break
+        return out
+
+    async def create_key(
+        self,
+        *,
+        team_id: str,
+        key_alias: str,
+        user_id: Optional[str] = None,
+        metadata: Optional[Dict] = None,
+    ) -> CreatedKey:
+        secret = f"sk-mock-{uuid.uuid4().hex}"
+        token = f"tok-{uuid.uuid4().hex[:16]}"
+        row = {
+            "token": token,
+            "key_alias": key_alias,
+            "team_id": team_id,
+            "user_id": user_id,
+            "spend": 0.0,
+            "max_budget": None,
+            "created_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
+            "last_used": None,
+            "metadata": metadata or {},
+        }
+
+        def _mut(data):
+            data.setdefault("keys", []).append(row)
+
+        self._store.update(_mut)
+        return CreatedKey(secret=secret, info=_normalize_key_obj(row))
+
+    async def delete_key(self, token: str) -> None:
+        def _mut(data):
+            data["keys"] = [k for k in data.get("keys", []) if k.get("token") != token]
+
+        self._store.update(_mut)
+
+    async def usage(self, project: Optional[str]) -> List[Dict]:
+        rows = self._store.snapshot().get("usage", [])
+        if project is None:
+            return list(rows)
+        return [r for r in rows if r.get("project") == project]
+
+    async def aclose(self) -> None:
+        return None
diff --git a/tests/test_phase1.py b/tests/test_phase1.py
index 4237414..0815117 100644
--- a/tests/test_phase1.py
+++ b/tests/test_phase1.py
@@ -1,4 +1,4 @@
-"""Offline tests: mock team provision, seam authz.
+"""Offline tests: mock backend + seam authz.
 
 Authenticated HTTP endpoints require a real asfquart session (OAuth). Those
 paths are not automated while the stack is in flux; expand later if needed.
@@ -14,14 +14,13 @@ import pytest
 from easydict import EasyDict as edict
 
 from llmao.store import StateStore
-from llmao.litellm_client import MockBackend
 from llmao.seam import Seam, Identity, AuthzError
+from tests.mock_backend import MockBackend
 
 
 def _cfg(tmp):
     return edict({
         "litellm": {
-            "mode": "mock",
             "base_url": "http://127.0.0.1:4000",
             "master_key": "sk-test",
             "request_timeout_s": 30,
@@ -60,12 +59,11 @@ def _seed_usage(store: StateStore, project: str, cost: float = 0.01) -> None:
 
 def test_cfg_dotted_access():
     cfg = edict({
-        "litellm": {"mode": "proxy", "base_url": "http://llm:4000", "master_key": "sk-x"},
+        "litellm": {"base_url": "http://llm:4000", "master_key": "sk-x"},
         "budgets": {"default_team_budget_usd": 50, "duration": "7d"},
         "site_admins": ["alice"],
         "state_path": "/tmp/s.json",
     })
-    assert cfg.litellm.mode == "proxy"
     assert cfg.litellm.base_url == "http://llm:4000"
     assert cfg.budgets.default_team_budget_usd == 50
     assert cfg.site_admins == ["alice"]
@@ -89,32 +87,13 @@ def test_personal_key_create_list_revoke_mock():
         with tempfile.TemporaryDirectory() as tmp:
             seam, _, _ = _seam(tmp)
             ident = Identity(uid="jdoe", projects=["airflow"], committees=[])
-            # mock mode rejects PAT product path
-            from llmao.seam import ConfigError
-            with pytest.raises(ConfigError):
-                await seam.create_personal_key(ident, "airflow", "laptop")
-            # Force proxy-shaped cfg with MockBackend for unit path:
-            # create_personal_key requires proxy mode; test backend ops via mock backend directly.
-            from llmao.litellm_client import MockBackend
-            from llmao.store import StateStore
-            from easydict import EasyDict as edict
-            cfg = edict({
-                "litellm": {"mode": "proxy", "base_url": "http://x", "master_key": "sk-x", "request_timeout_s": 5},
-                "budgets": {"default_team_budget_usd": 10, "duration": "30d"},
-                "site_admins": [],
-                "state_path": __import__("os").path.join(tmp, "s2.json"),
-            })
-            store = StateStore(cfg.state_path)
-            backend = MockBackend(cfg, store)
-            from llmao.seam import Seam
-            s = Seam(cfg, backend)
-            created = await s.create_personal_key(ident, "airflow", "laptop-cli")
+            created = await seam.create_personal_key(ident, "airflow", "laptop-cli")
             assert created.secret.startswith("sk-")
             assert created.info.key_alias == "laptop-cli"
-            keys = await s.list_my_keys(ident)
+            keys = await seam.list_my_keys(ident)
             assert len(keys) == 1
-            await s.revoke_key(ident, keys[0].token)
-            assert await s.list_my_keys(ident) == []
+            await seam.revoke_key(ident, keys[0].token)
+            assert await seam.list_my_keys(ident) == []
     asyncio.run(run())
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org