fix(core): allow empty command in updateSchedule when steps present
Aligns updateSchedule validation with createSchedule so step-based automations (auto-summarize, memory dreams) can sync at startup without hitting "Command cannot be empty". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
5
.changeset/fix-step-automation-update.md
Normal file
5
.changeset/fix-step-automation-update.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
Fix startup sync errors for step-based automations (auto-summarize, memory dreams) by allowing empty `command` in `updateSchedule` when the schedule has steps.
|
||||
@@ -269,12 +269,15 @@ export class AutomationStore extends EventEmitter<AutomationStoreEvents> {
|
||||
schedule.description = updates.description?.trim() || undefined;
|
||||
}
|
||||
if (updates.command !== undefined) {
|
||||
if (!updates.command.trim()) throw new Error("Command cannot be empty");
|
||||
schedule.command = updates.command.trim();
|
||||
}
|
||||
if (updates.steps !== undefined) {
|
||||
schedule.steps = updates.steps.length > 0 ? updates.steps : undefined;
|
||||
}
|
||||
const willHaveSteps = schedule.steps && schedule.steps.length > 0;
|
||||
if (!willHaveSteps && !schedule.command) {
|
||||
throw new Error("Command is required and cannot be empty");
|
||||
}
|
||||
if (updates.timeoutMs !== undefined) {
|
||||
schedule.timeoutMs = updates.timeoutMs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user