refactor: use modern executionOrder v1 as default instead of legacy v0

Changed minimal default settings from executionOrder: 'v0' (legacy) to
executionOrder: 'v1' (modern default) when providing fallback settings.

This ensures workflows use the modern execution order by default, which
provides better performance and more predictable execution behavior.

Updated all affected tests to expect 'v1' instead of 'v0'.

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-11-20 18:55:48 +01:00
parent dbd1406c43
commit df816556e5
2 changed files with 13 additions and 13 deletions

View File

@@ -198,13 +198,13 @@ export function cleanWorkflowForUpdate(workflow: Workflow): Partial<Workflow> {
if (Object.keys(filteredSettings).length > 0) {
cleanedWorkflow.settings = filteredSettings;
} else {
// Provide minimal valid settings (executionOrder is always accepted)
cleanedWorkflow.settings = { executionOrder: 'v0' as const };
// Provide minimal valid settings (executionOrder v1 is the modern default)
cleanedWorkflow.settings = { executionOrder: 'v1' as const };
}
} else {
// No settings provided - include minimal default settings
// n8n API requires settings in workflow updates
cleanedWorkflow.settings = { executionOrder: 'v0' as const };
// n8n API requires settings in workflow updates (v1 is the modern default)
cleanedWorkflow.settings = { executionOrder: 'v1' as const };
}
return cleanedWorkflow;

View File

@@ -391,8 +391,8 @@ describe('n8n-validation', () => {
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// n8n API requires settings to be present, so we provide minimal defaults
expect(cleaned.settings).toEqual({ executionOrder: 'v0' });
// n8n API requires settings to be present, so we provide minimal defaults (v1 is modern default)
expect(cleaned.settings).toEqual({ executionOrder: 'v1' });
});
it('should filter settings to safe properties to prevent API errors (Issue #248 - final fix)', () => {
@@ -484,8 +484,8 @@ describe('n8n-validation', () => {
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// n8n API requires settings, so we provide minimal defaults
expect(cleaned.settings).toEqual({ executionOrder: 'v0' });
// n8n API requires settings, so we provide minimal defaults (v1 is modern default)
expect(cleaned.settings).toEqual({ executionOrder: 'v1' });
});
it('should provide minimal settings when only non-whitelisted properties exist (Issue #431)', () => {
@@ -502,9 +502,9 @@ describe('n8n-validation', () => {
const cleaned = cleanWorkflowForUpdate(workflow);
// All properties were filtered out, but n8n API requires settings
// so we provide minimal defaults to avoid both "additional properties"
// and "required property" API errors
expect(cleaned.settings).toEqual({ executionOrder: 'v0' });
// so we provide minimal defaults (v1 is modern default) to avoid both
// "additional properties" and "required property" API errors
expect(cleaned.settings).toEqual({ executionOrder: 'v1' });
});
it('should preserve whitelisted settings when mixed with non-whitelisted (Issue #431)', () => {
@@ -1406,8 +1406,8 @@ describe('n8n-validation', () => {
expect(forUpdate).not.toHaveProperty('active');
expect(forUpdate).not.toHaveProperty('tags');
expect(forUpdate).not.toHaveProperty('meta');
// n8n API requires settings in updates, so minimal defaults are provided (Issue #431)
expect(forUpdate.settings).toEqual({ executionOrder: 'v0' });
// n8n API requires settings in updates, so minimal defaults (v1) are provided (Issue #431)
expect(forUpdate.settings).toEqual({ executionOrder: 'v1' });
expect(validateWorkflowStructure(forUpdate)).toEqual([]);
});
});