From 5bd57c1b9ff82b09c9b6bcd75b34df6a79940c7f Mon Sep 17 00:00:00 2001 From: Shaheer Sarfaraz <53654735+DaKheera47@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:45:15 +0000 Subject: [PATCH] better runtime assertion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- orchestrator/src/server/api/routes.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/orchestrator/src/server/api/routes.ts b/orchestrator/src/server/api/routes.ts index fb4dad0..d7de180 100644 --- a/orchestrator/src/server/api/routes.ts +++ b/orchestrator/src/server/api/routes.ts @@ -842,7 +842,11 @@ apiRouter.post('/manual-jobs/import', async (req: Request, res: Response) => { // Score asynchronously so the import returns immediately. (async () => { try { - const profile = (await loadResumeProfile()) as Record; + const rawProfile = await loadResumeProfile(); + if (!rawProfile || typeof rawProfile !== 'object' || Array.isArray(rawProfile)) { + throw new Error('Invalid resume profile format'); + } + const profile = rawProfile as Record; const { score, reason } = await scoreJobSuitability(createdJob, profile); await jobsRepo.updateJob(createdJob.id, { suitabilityScore: score,