From d456d3c86acce1a1b5edd462824c60803da1cc1f Mon Sep 17 00:00:00 2001 From: Anto01 Date: Fri, 17 Apr 2026 09:53:17 -0400 Subject: [PATCH] fix: local json import in graduation request/status handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/atocore/api/routes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/atocore/api/routes.py b/src/atocore/api/routes.py index 3487994..498e89f 100644 --- a/src/atocore/api/routes.py +++ b/src/atocore/api/routes.py @@ -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":