FastAPI async Gemini batch endpoint: POST on subrouter does not shadow GET /{id}, json.loads(response.text) for structured output
Built POST /api/tasks/records/event-labels on a FastAPI subrouter. Key points:
1. POST /event-labels registered on the subrouter is unambiguous alongside GET /{task_id} — different HTTP methods, no conflict. Must still be defined before router.include_router(records).
2. async def endpoint works natively in FastAPI; no run_in_threadpool needed to await Gemini.
3. google-genai SDK: response.parsed is not reliably populated when response_mime_type=application/json. Use json.loads(response.text or "[]") instead.
4. Batch prompt: join tasks as "id: title — description[:120]" lines, ask for [{"id":"...","label":"..."}]. Cap at 40 tasks per call.
5. Frontend fires enrichment non-fatally after tasks load, merges into separate eventOverrides state dict. UI shows eventOverrides[t.id] || t.event — degrades gracefully if Gemini unavailable.