Problem
A Groq {error: {message: "invalid api key"}} payload returns status 200 with {"reply": "", "error": ...}: failures look like empty successes.
Where
app/api/ai/route.ts (no r.ok/error check before responding).
Acceptance
Add a failing route test first asserting non-2xx when the upstream payload has error and no choices. Then map it to 502/400.
Problem
A Groq
{error: {message: "invalid api key"}}payload returns status 200 with{"reply": "", "error": ...}: failures look like empty successes.Where
app/api/ai/route.ts(nor.ok/error check before responding).Acceptance
Add a failing route test first asserting non-2xx when the upstream payload has
errorand no choices. Then map it to 502/400.