The AI service endpoints are currently mock implementations:
generate.py checks ANTHROPIC_API_KEY but still returns mock text even when a key exists (apps/ai-service/app/routes/generate.py lines 18-28).
- quiz generation returns sample questions from query params rather than annotated code.
- defend evaluation passes after message count rather than evaluating the answer.
- diff returns a fixed sample diff instead of comparing the submitted code.
These are fine for scaffolding, but they do not yet implement the README's core Decode/Rebuild/Defend learning loop.
Suggested fix
Introduce clear service modules and request/response contracts:
- Claude client wrapper with timeout/error handling
- quiz generation from code/annotations
- defend question/evaluation flow
- actual diff/scoring engine
- tests for each route with mocked external providers
Acceptance criteria
- Routes no longer return fixed sample content in normal execution.
- Missing provider keys fail clearly or enter an explicit local mock mode.
- External AI calls are isolated behind service classes/functions.
- Each route has at least one test for success and one for error behavior.
The AI service endpoints are currently mock implementations:
generate.pychecksANTHROPIC_API_KEYbut still returns mock text even when a key exists (apps/ai-service/app/routes/generate.pylines 18-28).These are fine for scaffolding, but they do not yet implement the README's core Decode/Rebuild/Defend learning loop.
Suggested fix
Introduce clear service modules and request/response contracts:
Acceptance criteria