Close local release-quality gaps and reconcile workplan status
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 2s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a0e332-3365-77c0-8491-084e9ea33ac1
This commit is contained in:
tegwick 2026-09-27 17:36:27 +02:00
parent 37436bb562
commit 7cd633986e
56 changed files with 462 additions and 237 deletions

View file

@ -7,7 +7,7 @@ Translates HTTP errors into typed :mod:`markitect.llm.exceptions`.
import json
import urllib.error
import urllib.request
from typing import Any, Dict, Optional
from typing import Any, cast
from llm_connect._diagnostics import record_provider_request, record_provider_response
from llm_connect.exceptions import (
@ -19,10 +19,10 @@ from llm_connect.exceptions import (
def post_json(
url: str,
payload: Dict[str, Any],
headers: Optional[Dict[str, str]] = None,
payload: dict[str, Any],
headers: dict[str, str] | None = None,
timeout: int = 300,
) -> Dict[str, Any]:
) -> dict[str, Any]:
"""POST *payload* as JSON and return the parsed response body.
Raises:
@ -43,9 +43,9 @@ def post_json(
def get_json(
url: str,
headers: Optional[Dict[str, str]] = None,
headers: dict[str, str] | None = None,
timeout: int = 60,
) -> Dict[str, Any]:
) -> dict[str, Any]:
"""GET *url* and return the parsed JSON response body.
Raises:
@ -67,14 +67,14 @@ def _read_json_response(
req: urllib.request.Request,
*,
timeout: int,
) -> Dict[str, Any]:
) -> dict[str, Any]:
try:
with urllib.request.urlopen(req, timeout=timeout) as resp:
body = resp.read().decode()
try:
parsed = json.loads(body)
record_provider_response(status=resp.status, body=parsed)
return parsed
return cast(dict[str, Any], parsed)
except json.JSONDecodeError as exc:
record_provider_response(status=resp.status, body=body)
preview = body[:300].replace("\n", "\\n")