Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Move execution engine code out of n8n-workflow (no-changelog) #12147

Merged
merged 12 commits into from
Dec 12, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Dec 10, 2024

Summary

This PR moves about 1400 lines related to the execution engine out of n8n-workflow, deletes some dead code and unnecessary indirection, and adds some additional unit tests.

E2E tests
Workflow tests

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Dec 10, 2024
@netroy netroy marked this pull request as ready for review December 10, 2024 22:33
Copy link

cypress bot commented Dec 10, 2024

n8n    Run #8320

Run Properties:  status check passed Passed #8320  •  git commit 451a510420: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project n8n
Branch Review move-execution-engine-code
Run status status check passed Passed #8320
Run duration 04m 48s
Commit git commit 451a510420: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Committer कारतोफ्फेलस्क्रिप्ट™
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 480
View all changes introduced in this branch ↗︎

@netroy netroy requested review from ivov and despairblue December 11, 2024 18:25
despairblue
despairblue previously approved these changes Dec 12, 2024
Copy link
Contributor

@despairblue despairblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some questions and suggestions, but all of these can be handled in another PR.

packages/cli/src/webhooks/webhook.service.ts Outdated Show resolved Hide resolved
packages/cli/src/webhooks/webhook.service.ts Outdated Show resolved Hide resolved
const webhookNode = mock<INode>({ type: 'webhookNode' });

nodeTypes.getByNameAndVersion.mockImplementation((type) => {
// TODO: getByNameAndVersion signature needs to be updated to allow returning undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not accurate, is it? It throw there if the node can't be found:

getNode(nodeType: string) {
const {
nodeTypes,
known: { nodes: knownNodes },
} = this;
if (!(nodeType in nodeTypes) && nodeType in knownNodes) {
const { sourcePath } = knownNodes[nodeType];
this.loadNodeFromFile(sourcePath);
}
if (nodeType in nodeTypes) {
return nodeTypes[nodeType];
}
throw new UnrecognizedNodeTypeError(this.packageName, nodeType);
}

You also removed all other checks further up the call chain, so maybe this TODO can be removed and this mock should throw instead of returning undefined?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few implementations of INodeTypes that are not consistent with the actual main implementation NodeTypes. I want to clean all of these up in a separate PR.


const nodeTypes = mock<INodeTypes>();
nodeTypes.getByNameAndVersion.mockImplementation((type) => {
// TODO: getByNameAndVersion signature needs to be updated to allow returning undefined
Copy link
Contributor

@despairblue despairblue Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other coment.

packages/core/test/RoutingNode.test.ts Outdated Show resolved Hide resolved
packages/core/test/RoutingNode.test.ts Outdated Show resolved Hide resolved
packages/core/src/RoutingNode.ts Outdated Show resolved Hide resolved
packages/core/test/RoutingNode.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit 5a055ed into master Dec 12, 2024
38 checks passed
@netroy netroy deleted the move-execution-engine-code branch December 12, 2024 12:54

This comment was marked as off-topic.

@janober
Copy link
Member

janober commented Dec 19, 2024

Got released with n8n@1.73.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants