feat: Default package import workflowIdPolicy to source (#34989)

Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
n8n-cat-bot[bot]
2026-07-27 08:36:24 +00:00
committed by GitHub
co-authored by n8n-cat-bot[bot] Claude Opus 4.8
parent 4f7c725b83
commit 1f4e65419a
3 changed files with 17 additions and 16 deletions
@@ -14,7 +14,7 @@ describe('ImportPackageRequestDto', () => {
bindings: {},
workflowConflictPolicy: 'fail',
workflowPublishingPolicy: 'preserve-published-state',
workflowIdPolicy: 'new',
workflowIdPolicy: 'source',
missingNodeTypeMode: 'fail',
folderConflictPolicy: 'merge',
dataTableMatchingMode: 'by-id',
@@ -39,7 +39,7 @@ describe('ImportPackageRequestDto', () => {
bindings: {},
workflowConflictPolicy: 'fail',
workflowPublishingPolicy: 'preserve-published-state',
workflowIdPolicy: 'new',
workflowIdPolicy: 'source',
missingNodeTypeMode: 'fail',
folderConflictPolicy: 'merge',
dataTableMatchingMode: 'by-id',
@@ -66,7 +66,7 @@ describe('ImportPackageRequestDto', () => {
bindings: {},
workflowConflictPolicy: 'new-version',
workflowPublishingPolicy: 'preserve-published-state',
workflowIdPolicy: 'new',
workflowIdPolicy: 'source',
missingNodeTypeMode: 'fail',
folderConflictPolicy: 'merge',
dataTableMatchingMode: 'by-id',
@@ -92,7 +92,7 @@ describe('ImportPackageRequestDto', () => {
bindings: {},
workflowConflictPolicy: 'skip',
workflowPublishingPolicy: 'preserve-published-state',
workflowIdPolicy: 'new',
workflowIdPolicy: 'source',
missingNodeTypeMode: 'fail',
folderConflictPolicy: 'merge',
dataTableMatchingMode: 'by-id',
@@ -258,11 +258,11 @@ describe('ImportPackageRequestDto', () => {
});
describe('workflowIdPolicy', () => {
it('defaults to "new" when omitted', () => {
it('defaults to "source" when omitted', () => {
const result = ImportPackageRequestDto.safeParse({ workflowConflictPolicy: 'fail' });
expect(result.success).toBe(true);
if (result.success) {
expect(result.data.workflowIdPolicy).toBe('new');
expect(result.data.workflowIdPolicy).toBe('source');
}
});
@@ -77,7 +77,7 @@ export class ImportPackageRequestDto extends Z.class({
.enum(['preserve-published-state', 'match-source', 'publish-all', 'unpublish-all'])
.optional()
.default('preserve-published-state'),
workflowIdPolicy: z.enum(['new', 'source']).optional().default('new'),
workflowIdPolicy: z.enum(['new', 'source']).optional().default('source'),
missingNodeTypeMode: z.enum(['fail', 'import-anyway']).optional().default('fail'),
folderConflictPolicy: z.enum(['merge', 'fail']).optional().default('merge'),
dataTableMatchingMode: z.enum(['by-id']).optional().default('by-id'),
@@ -101,16 +101,17 @@ post:
enum:
- new
- source
default: new
default: source
description: >
Controls the id each newly created workflow receives. `new`
(default) mints a fresh id and records the package id as
`sourceWorkflowId`, so the same package can be imported
repeatedly without id collisions. `source` reuses the package's
own workflow id on the target instance. Workflows matched to an
existing workflow in the target project (status `updated` or
`skipped`) always keep that workflow's current id, regardless
of policy.
Controls the id each newly created workflow receives. `source`
(default) reuses the package's own workflow id on the target
instance, which best fits promotion use cases where the same
workflow moves between environments. `new` mints a fresh id and
records the package id as `sourceWorkflowId`, so the same
package can be imported repeatedly without id collisions — best
suited to marketplace imports. Workflows matched to an existing
workflow in the target project (status `updated` or `skipped`)
always keep that workflow's current id, regardless of policy.
missingNodeTypeMode:
type: string
enum: