Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: reject null from parseCronToNextRun in cron validation
Adam Eivy047a7cc24f0d
diff --git a/server/routes/cos.js b/server/routes/cos.jsindex 54ba7e1e14..1f65ee7ea2 100644--- a/server/routes/cos.js+++ b/server/routes/cos.js@@ -966,13 +966,15 @@ router.post('/jobs', asyncHandler(async (req, res) => {if (parts.length !== 5) {throw new ServerError('cronExpression must be a 5-field cron expression (minute hour dayOfMonth month dayOfWeek)', { status: 400, code: 'VALIDATION_ERROR' });}- // Validate syntax and field ranges; null means no match within search window- // (valid for infrequent schedules like leap-day), so only reject thrown errors+ let nextRun;try {- parseCronToNextRun(cronExpression, new Date(), 'UTC');+ nextRun = parseCronToNextRun(cronExpression, new Date(), 'UTC');} catch (err) {throw new ServerError(`Invalid cronExpression: ${err?.message || 'unable to parse'}`, { status: 400, code: 'VALIDATION_ERROR' });}+ if (nextRun === null) {+ throw new ServerError('Invalid cronExpression: no valid run time could be determined', { status: 400, code: 'VALIDATION_ERROR' });+ }}const job = await autonomousJobs.createJob({@@ -991,13 +993,15 @@ router.put('/jobs/:id', asyncHandler(async (req, res) => {if (parts.length !== 5) {throw new ServerError('cronExpression must be a 5-field cron expression', { status: 400, code: 'VALIDATION_ERROR' });}- // Validate syntax and field ranges; null means no match within search window- // (valid for infrequent schedules like leap-day), so only reject thrown errors+ let nextRun;try {- parseCronToNextRun(cronExpression, new Date(), 'UTC');+ nextRun = parseCronToNextRun(cronExpression, new Date(), 'UTC');} catch (err) {throw new ServerError(`Invalid cronExpression: ${err?.message || 'unable to parse'}`, { status: 400, code: 'VALIDATION_ERROR' });}+ if (nextRun === null) {+ throw new ServerError('Invalid cronExpression: no valid run time could be determined', { status: 400, code: 'VALIDATION_ERROR' });+ }}const job = await autonomousJobs.updateJob(req.params.id, {name, description, category, type, interval, intervalMs, scheduledTime, cronExpression,