fix(apollo): validate parsed recipe error with zod instead of JSON.parse cast
loading diff…
In apps/apollo/src/lib/recipe/execute.ts (~line 95), classifyRecipeError called JSON.parse(response.val) as ParsedRecipeError with no error handling. This caused two bugs:
SyntaxError that escapes withRetry and becomes an unhandled exception (500 with no useful message).undefined for error_type, making the === 'Bad Request' check always fail so every recipe error was reported as Internal Server Error.Fix: added ParsedRecipeErrorSchema = z.object(...) in utils.ts (replacing the plain interface), and replaced the bare JSON.parse cast in execute.ts with a try/catch + safeParse, returning a typed Err on either failure and keeping the existing ts-results Result flow intact.
Err(new RecipeError.InternalServerError(...)) which is the correct Error_500 type expected by the function signature.ParsedRecipeError type is preserved via z.infer<typeof ParsedRecipeErrorSchema> so all downstream usages in execute.ts remain type-compatible.tsc / unit tests locally (no node_modules in this worktree). Relying on CI check-types as the compilation gate.type import of ParsedRecipeError and the value import of ParsedRecipeErrorSchema are now two separate import lines from './utils'; a reviewer should confirm the linter does not require them to be merged (unlikely given the existing codebase style).🤖 Generated with Claude Code