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

fix: Retain execution data between partial executions (new flow) #11828

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

despairblue
Copy link
Contributor

@despairblue despairblue commented Nov 21, 2024

Summary

The run data has been behaving weird with the new execution flow since the last update:

Before:

PAY-2255-before.mp4

But even before that it hasn't been working the way you'd expect, e.g. nodes after the destination node that had run data would keep their run data until the execution finished which means they would stay green until the end of the execution and only then turn gray.

All of this is related to moving the run data management for partial executions to the backend without accounting for a way to keep the FE state in sync with it.

This PR does 2 things to fix this:

  • fix a bug where the FE would prune the run data even if the new partial execution flow is enabled
  • add deleteRunData message so that the BE can selectively prune run data from the FE during partial executions

After:

PAY-2255-after.mp4

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/PAY-2255/the-fe-looses-all-run-data-between-runs-if-the-new-partial-execution

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 ui Enhancement in /editor-ui or /design-system labels Nov 21, 2024
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ckages/cli/src/workflow-execute-additional-data.ts 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@@ -259,7 +259,7 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
executedNode,
data: {
resultData: {
runData: newRunData ?? {},
runData: startRunData.runData ?? {},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes that previous run data disappears. This should be the same run data that is sent to the BE.

startRunData.runData is either the run data the FE pruned (if the old flow is used) or the full run data from before (if the new flow is used).

Comment on lines +37 to +40
'n8n-nodes-base.manualTrigger': {
type: new ManualTrigger(),
sourcePath: '',
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed an actual trigger to test the runPartialWorkflow2, especially the call to findTriggerForPartialExecution.

The start node above is not marked as a trigger, so I added the manual trigger here.

@@ -206,7 +209,7 @@ describe('WorkflowExecute', () => {
}
});

describe('WorkflowExecute, NodeExecutionOutput type test', () => {
test('WorkflowExecute, NodeExecutionOutput type test', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming this was supposed to be test and not describe.

@despairblue despairblue marked this pull request as ready for review November 21, 2024 15:26
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 ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant