chore: Route subworkflow-version-resolution API calls through (#33077)

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-06-26 08:50:58 +00:00
committed by GitHub
co-authored by n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com> Claude Opus 4.8
parent b43ed0880d
commit b20228096b
3 changed files with 35 additions and 57 deletions
@@ -1,7 +1,7 @@
{
"version": 1,
"generated": "2026-06-25T12:22:26.752Z",
"totalViolations": 126,
"generated": "2026-06-26T07:21:36.867Z",
"totalViolations": 117,
"violations": {
"pages/AIAssistantPage.ts": [
{
@@ -711,32 +711,6 @@
"hash": "3783a2d87c82"
}
],
"tests/e2e/workflows/editor/subworkflows/subworkflow-version-resolution.spec.ts": [
{
"rule": "api-purity",
"line": 65,
"message": "Raw API call detected: request.patch(",
"hash": "0acea681877b"
},
{
"rule": "api-purity",
"line": 117,
"message": "Raw API call detected: request.post(",
"hash": "ba11a5486f8c"
},
{
"rule": "api-purity",
"line": 146,
"message": "Raw API call detected: request.patch(",
"hash": "0acea681877b"
},
{
"rule": "api-purity",
"line": 299,
"message": "Raw API call detected: request.patch(",
"hash": "0acea681877b"
}
],
"pages/WorkflowsPage.ts": [
{
"rule": "deduplication",
@@ -121,6 +121,23 @@ export class WorkflowApiHelper {
return result.data ?? result;
}
/**
* Like {@link runManually}, but accepts an explicit workflow payload and
* returns the raw response instead of throwing — for asserting the run
* status or starting from a trigger with custom `workflowData`.
*/
async runRaw(
workflowId: string,
options: { workflowData?: Partial<IWorkflowBase>; triggerNodeName: string },
): Promise<APIResponse> {
return await this.api.request.post(`/rest/workflows/${workflowId}/run`, {
data: {
...(options.workflowData ? { workflowData: options.workflowData } : {}),
triggerToStartFrom: { name: options.triggerNodeName },
},
});
}
/**
* Like {@link update}, but returns the raw response instead of throwing on a
* non-2xx status — for asserting a specific status code (e.g. the `422` from
@@ -62,13 +62,10 @@ test.describe(
assertAssignmentCollectionValue(assignmentsParam);
assignmentsParam.assignments[0].value = 'draft-version';
await api.request.patch(`/rest/workflows/${childWorkflowId}`, {
data: {
versionId: childWorkflow.versionId,
name: childWorkflow.name,
nodes: childWorkflow.nodes,
connections: childWorkflow.connections,
},
await api.workflows.update(childWorkflowId, childWorkflow.versionId!, {
name: childWorkflow.name,
nodes: childWorkflow.nodes,
connections: childWorkflow.connections,
});
const { workflowId: parentWorkflowId, createdWorkflow: parentWorkflow } =
@@ -114,11 +111,9 @@ test.describe(
},
});
const runResponse = await api.request.post(`/rest/workflows/${parentWorkflowId}/run`, {
data: {
workflowData: parentWorkflow,
triggerToStartFrom: { name: 'When clicking Test workflow' },
},
const runResponse = await api.workflows.runRaw(parentWorkflowId, {
workflowData: parentWorkflow,
triggerNodeName: 'When clicking Test workflow',
});
expect(runResponse.ok()).toBe(true);
@@ -143,13 +138,10 @@ test.describe(
assertAssignmentCollectionValue(childAssignmentsParam);
childAssignmentsParam.assignments[0].value = 'draft-version';
await api.request.patch(`/rest/workflows/${childWorkflowId}`, {
data: {
versionId: childWorkflow.versionId,
name: childDefinition.name,
nodes: childDefinition.nodes,
connections: childDefinition.connections,
},
await api.workflows.update(childWorkflowId, childWorkflow.versionId!, {
name: childDefinition.name,
nodes: childDefinition.nodes,
connections: childDefinition.connections,
});
const parentFilePath = resolveFromRoot('workflows', 'subworkflow-version-parent.json');
@@ -296,18 +288,13 @@ test.describe(
},
};
const patchResponse = await api.request.patch(`/rest/workflows/${workflowId}`, {
data: {
versionId: workflow.versionId,
name: workflow.name,
nodes: workflow.nodes,
connections: workflow.connections,
},
const updatedWorkflow = await api.workflows.update(workflowId, workflow.versionId!, {
name: workflow.name,
nodes: workflow.nodes,
connections: workflow.connections,
});
const updatedWorkflowData = await patchResponse.json();
await api.workflows.activate(workflowId, updatedWorkflowData.data.versionId);
await api.workflows.activate(workflowId, updatedWorkflow.versionId!);
});
},
);