Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions server/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@
const { stdout } = await execFileAsync(
getPythonExecutable(),
[analyzePyPath, "predict_file", tempFile],
{ timeout: 30000 },
{
timeout: 30000,
// 10MB buffer to safely handle verbose Python stdout
// (scikit-learn/numpy deprecation warnings, model loading logs)
// without crashing with ERR_CHILD_PROCESS_STDIO_MAXBUFFER.
maxBuffer: 10 * 1024 * 1024,
}
);

prediction = JSON.parse(stdout.trim());
Expand Down Expand Up @@ -331,7 +337,13 @@
const { stdout } = await execFileAsync(
getPythonExecutable(),
[analyzePyPath, "predict_file", tempFile],
{ timeout: 30000 },
{
timeout: 30000,
// 10MB buffer to safely handle verbose Python stdout
// (scikit-learn/numpy deprecation warnings, model loading logs)
// without crashing with ERR_CHILD_PROCESS_STDIO_MAXBUFFER.
maxBuffer: 10 * 1024 * 1024,
}
);

prediction = JSON.parse(stdout.trim());
Expand Down Expand Up @@ -778,18 +790,18 @@
});
}

const { q, riskCategory, page, limit } = parseResult.data;

Check failure on line 793 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

'catch' or 'finally' expected.

Check failure on line 793 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

'catch' or 'finally' expected.
const offset = (page - 1) * limit;
const userEmail = req.session.user?.email;

const results = await storage.searchAssessments(q ?? "", userEmail, riskCategory, limit, offset);
return res.json(results);
} catch (err) {

Check failure on line 799 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

',' expected.

Check failure on line 799 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

',' expected.
console.error("Assessment search error:", err);
const { statusCode, message } = sanitizeDatabaseError(err);
return res.status(statusCode).json({ message });
}
);

Check failure on line 804 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

Declaration or statement expected.

Check failure on line 804 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

Declaration or statement expected.

/**
* GET /api/assessments/:id
Expand Down Expand Up @@ -855,7 +867,7 @@
return res.status(401).json({ message: "Unauthorized" });
}
}
);

Check failure on line 870 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

'catch' or 'finally' expected.

Check failure on line 870 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

'catch' or 'finally' expected.

/**
* GET /api/assessments/:id
Expand Down Expand Up @@ -919,7 +931,7 @@
return res.status(404).json({ message: "Assessment not found." });
}
}
);

Check failure on line 934 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

'catch' or 'finally' expected.

Check failure on line 934 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

'catch' or 'finally' expected.

/**
* GET /api/assessments/:id
Expand Down Expand Up @@ -979,7 +991,7 @@
return res.status(statusCode).json({ message });
}
}
});

Check failure on line 994 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

'catch' or 'finally' expected.

Check failure on line 994 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

',' expected.

Check failure on line 994 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

'catch' or 'finally' expected.

Check failure on line 994 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

',' expected.

res.setHeader("Content-Type", "text/csv");
res.setHeader(
Expand All @@ -987,11 +999,11 @@
"attachment; filename=assessments.csv"
);
return res.send(csv);
} catch (err) {

Check failure on line 1002 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

'try' expected.

Check failure on line 1002 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

'try' expected.
console.error("CSV export error:", err);
return res.status(500).json({ message: "Failed to export CSV." });
}
}

Check failure on line 1006 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Code Quality and Tests

Declaration or statement expected.

Check failure on line 1006 in server/routes.ts

View workflow job for this annotation

GitHub Actions / Type check (tsc)

Declaration or statement expected.
);
return httpServer;
}
Expand Down
Loading