fix: local json import in graduation request/status handlers
NameError on /admin/graduation/request — routes.py doesn't import json at module scope. Added local 'import json as _json' in both graduation handlers matching the pattern used elsewhere in this file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1372,11 +1372,12 @@ def api_request_graduation(req: GraduationRequestBody) -> dict:
|
||||
Mirrors the /admin/triage/request-drain pattern (bridges container
|
||||
→ host because claude CLI lives on host, not container).
|
||||
"""
|
||||
import json as _json
|
||||
from datetime import datetime as _dt, timezone as _tz
|
||||
from atocore.context.project_state import set_state
|
||||
|
||||
now = _dt.now(_tz.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
payload = json.dumps({
|
||||
payload = _json.dumps({
|
||||
"project": (req.project or "").strip(),
|
||||
"limit": max(1, min(req.limit, 500)),
|
||||
"requested_at": now,
|
||||
@@ -1399,6 +1400,7 @@ def api_request_graduation(req: GraduationRequestBody) -> dict:
|
||||
@router.get("/admin/graduation/status")
|
||||
def api_graduation_status() -> dict:
|
||||
"""State of the graduation pipeline (UI polling)."""
|
||||
import json as _json
|
||||
from atocore.context.project_state import get_state
|
||||
out = {
|
||||
"requested": None,
|
||||
@@ -1413,7 +1415,7 @@ def api_graduation_status() -> dict:
|
||||
continue
|
||||
if e.key == "graduation_requested_at":
|
||||
try:
|
||||
out["requested"] = json.loads(e.value)
|
||||
out["requested"] = _json.loads(e.value)
|
||||
except Exception:
|
||||
out["requested"] = {"raw": e.value}
|
||||
elif e.key == "graduation_last_started_at":
|
||||
|
||||
Reference in New Issue
Block a user