Migrate release runtime and gates to Python 3.14

This commit is contained in:
anor
2026-11-28 00:41:25 +10:00
parent a0de4659f1
commit 3af59574f3
41 changed files with 305 additions and 106 deletions
+7 -5
View File
@@ -12,15 +12,17 @@ import db
import regional_ref
from scripts.shadow.send import send
BASE_URL = os.environ.get("PUBLIC_BASE_URL", "http://127.0.0.1:8106").rstrip("/")
def mcp_smoke(email: str) -> None:
from mcp_identity import InfosmetaOAuthProvider
resource = os.environ.get("PUBLIC_BASE_URL", "http://127.0.0.1:8106").rstrip("/") + "/mcp"
provider = InfosmetaOAuthProvider(resource.removesuffix("/mcp"), resource)
resource = BASE_URL + "/mcp"
provider = InfosmetaOAuthProvider(BASE_URL, resource)
with db._conn() as conn:
token = provider._issue(conn, client_id="release-smoke", username=email,
scopes=["files:read", "norms:read"], resource=resource)
base = "http://127.0.0.1:8106"
base = BASE_URL
headers = {"MCP-Protocol-Version": "2025-11-25", "Accept": "application/json, text/event-stream"}
with httpx.Client(timeout=15.0, trust_env=False) as client:
denied = client.post(base + "/mcp", headers=headers,
@@ -60,10 +62,10 @@ def main() -> None:
result = send(
{"tab_id": "release-smoke", "message":
f"Составь смету на работу по расценке ТЕР {code} в {region}, объём 1 м3."},
base_url="http://127.0.0.1:8106", token=auth._make_token(email),
base_url=BASE_URL, token=auth._make_token(email),
timeout=360,
)
with sqlite3.connect("smeta-web.db") as local:
with db._conn() as local:
usage = local.execute(
"select output_tokens from llm_usage where username=? and path='agent' "
"order by ts desc limit 1", (email,)