-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
feat(core): Handle cycles in workflows when partially executing them #11187
feat(core): Handle cycles in workflows when partially executing them #11187
Conversation
af5b8b1
to
cae9693
Compare
df0e688
to
2ad28a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and easy to read code as usual 👌 Couple small suggestions about the code style, but nothing that would block this from being merged 🚀
expect(stronglyConnectedComponents).toHaveLength(2); | ||
expect(stronglyConnectedComponents).toContainEqual([node4]); | ||
expect(stronglyConnectedComponents).toContainEqual([node3, node2, node1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we care about the order in which the connected components are returned? Should we instead check
expect(stronglyConnectedComponents).toHaveLength(2); | |
expect(stronglyConnectedComponents).toContainEqual([node4]); | |
expect(stronglyConnectedComponents).toContainEqual([node3, node2, node1]); | |
expect(stronglyConnectedComponents).toEqual([ | |
[node4], | |
[node3, node2, node1] | |
]) |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we care about the order. It should be stable but it does not convey any information as far as I know, and as far as the use case is concerned.
So it's ok to leave it like this so that we don't have to touch the tests if we change the algorithm.
packages/core/src/PartialExecutionUtils/__tests__/DirectedGraph.test.ts
Outdated
Show resolved
Hide resolved
✅ All Cypress E2E specs passed |
n8n Run #7436
Run Properties:
|
Project |
n8n
|
Run status |
Passed #7436
|
Run duration | 04m 16s |
Commit |
321d6deef1: 🌳 master 🖥️ browsers:node18.12.0-chrome107 🤖 PR User 🗃️ e2e/*
|
Committer | Danny Martini |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
1
|
Pending |
0
|
Skipped |
0
|
Passing |
453
|
✅ All Cypress E2E specs passed |
Got released with |
Summary
This implement cycle handling according to the specification for the new partial execution flow.
Basically if a start node is inside a cycle the start of the cycle will become the start node.
This is to make it more predictable instead of figuring out if the loop has finished executing or not and thus deciding if the run data should be kept or invalidated. We just start cycles/loops always from the start.
You can review commit by commit.
Additionally this contains:
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/PAY-1757/phase-2-cycle-detection-and-handling
Review / Merge checklist
Docs updated or follow-up ticket created.PR Labeled withrelease/backport
(if the PR is an urgent fix that needs to be backported)