Repository navigation
Sweep the destinations the trigger provisions during a live run - #27
Merged
Merged
Conversation
`cleanUpRun` matched three name shapes and the trigger creates a fourth. Destinations are named `n8n-dest-<workflowId>-<nodeId>`, the live contexts set the workflow id to the run id, and nothing in the filter started with `n8n-dest-`. So every destination a live run provisioned survived the sweep. One run measured 27 destinations going to 39 while sources and connections stayed level. This is the same miss the function's own comment already records for connections, and it went unnoticed for longer because the failure is quieter: a leaked connection blocks its source from being deleted and the run reports it, while a leaked destination blocks nothing and simply accumulates. The 49 orphans in #13 came from a development project that also runs this suite, and the two it sampled were CLI destinations whose connections were already gone — which is this, not the node. The new shape carries the run id like the other three. That is the property that makes the guard safe to widen: the project under test also holds production sources, and a shape without a run id would start deleting them. `ownedByThisRun` is exported so a unit test can build the names with the node's own `buildResourceName` rather than repeating string literals, which means renaming a resource fails the test instead of quietly un-sweeping it. Confirmed by removing the fix: the test fails with `cleanup would miss n8n-dest-<run>-nodeid`. Nothing here ships — `files` is an allowlist of `dist/nodes` and `dist/credentials` — so no CHANGELOG entry. The node side is deliberately not touched. Deleting the destination when the connection is deleted is a real code path that orphans, but nothing in the measured 49 shows a user reaching it, and it is currently by design: the teardown comment already argues the case for the source. Tracked separately for the discussion it needs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6ZF876ibkomShmV6rSKLn
This was referenced Sep 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13, for the half of it the evidence supports.
cleanUpRunmatched three name shapes; the trigger creates a fourth. Destinations are namedn8n-dest-<workflowId>-<nodeId>, the live contexts set the workflow id to the run id, and nothing in the filter started withn8n-dest-. Every destination a live run provisioned survived the sweep — one run measured destinations going 27 → 39 while sources and connections stayed level.Same miss the function's own comment already records for connections. It went unnoticed longer because the failure is quieter: a leaked connection blocks its source from being deleted and the run reports it, while a leaked destination blocks nothing and just accumulates.
Why the node itself is untouched
#13 is titled as a user-facing leak. Reading it against the code, the measured evidence points the other way:
deletepath inwebhookMethods.default.deletegenuinely does orphan the destination. That's real.type=CLIdestinations whose connections were already gone. CLI test registrations are disabled, not deleted — so the node's delete path did not orphan those. This did.Tracked separately for that discussion.
pauseanddisableare correct as they stand; the connection survives, so its destination must too.The guard
Every accepted shape carries the run id, which is what makes widening safe — the project under test also holds production sources, and a shape without a run id would start deleting them.
ownedByThisRunis exported so the test builds names with the node's ownbuildResourceNameinstead of repeating string literals: renaming a resource now fails the test rather than quietly un-sweeping it. Verified by removing the fix — the test fails withcleanup would miss n8n-dest-<run>-nodeid.Verification
115 unit tests, lint, scan. No CHANGELOG entry: nothing here ships, since
filesis an allowlist ofdist/nodesanddist/credentials.