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(core): Fix supportedNodes for non-lazy loaded community packages (no-changelog) #11329

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Oct 21, 2024

Summary

We had an inconsistency in how and when we prefixed packageName on nodes. This was causing supportedNodes referring to invalid node names.
This PR moves all packageName prefixing code to LoadNodesAndCredentials, which ensures that lazy-loading has no effect on node-names anywhere.

Extracted out of #9874.
E2E Tests
Workflow Tests

Related Linear tickets, Github issues, and Community forum posts

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 node/improvement New feature or request labels Oct 21, 2024
@netroy netroy force-pushed the refactor-generate-ui-types branch from abd08ab to 14cc34f Compare October 21, 2024 14:22
@netroy netroy changed the title refactor(core): Simplify metadata generation, and add tests for DirectoryLoader (no-changelog) fix(core): Fix supportedNodes for non-lazy loaded community packages (no-changelog) Oct 21, 2024
@netroy netroy added the tests-needed This PR needs additional tests label Oct 21, 2024
tomi
tomi previously approved these changes Oct 21, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Can't say that I 100% understood everything that changed here. The code and tests look solid and if you tested that it works I'm happy. Couple questions / comments but no blockers 🚀

packages/cli/src/load-nodes-and-credentials.ts Outdated Show resolved Hide resolved
packages/cli/src/load-nodes-and-credentials.ts Outdated Show resolved Hide resolved
for (const credentialTypeName in loader.credentialTypes) {
this.loaded.credentials[credentialTypeName] = loader.credentialTypes[credentialTypeName];
for (const type in loader.credentialTypes) {
this.loaded.credentials[type] = loader.credentialTypes[type];
Copy link
Contributor

Choose a reason for hiding this comment

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

Credentials don't need to be prefixed with the packageName?

Copy link
Member Author

Choose a reason for hiding this comment

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

unfortunately not. I've wanted to prefix credentials since 2022, but doing so will be a breaking change.

packages/core/src/DirectoryLoader.ts Show resolved Hide resolved
packages/core/src/DirectoryLoader.ts Show resolved Hide resolved
Copy link

cypress bot commented Oct 21, 2024

n8n    Run #8273

Run Properties:  status check passed Passed #8273  •  git commit 5900e1d0be: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project n8n
Branch Review refactor-generate-ui-types
Run status status check passed Passed #8273
Run duration 04m 30s
Commit git commit 5900e1d0be: 🌳 🖥️ 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 1
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 ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy force-pushed the refactor-generate-ui-types branch from fe0aef9 to 83ae133 Compare October 21, 2024 15:45
@netroy netroy requested a review from elsmr October 21, 2024 15:46
tomi
tomi previously approved these changes Oct 22, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

✅ All Cypress E2E specs passed

elsmr
elsmr previously approved these changes Oct 22, 2024
Copy link
Member

@elsmr elsmr left a comment

Choose a reason for hiding this comment

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

LGTM

I only found this change in the output of known/credentials.json. AFAIK this will not have any effect because these credentials are never used directly, only extended. But maybe you know a case where this could break things.

image

packages/core/src/DirectoryLoader.ts Show resolved Hide resolved
packages/core/src/DirectoryLoader.ts Show resolved Hide resolved
Copy link
Contributor

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

@netroy netroy dismissed stale reviews from tomi and elsmr via f4919f7 December 9, 2024 17:02
@netroy netroy force-pushed the refactor-generate-ui-types branch 2 times, most recently from f4919f7 to e50f6c4 Compare December 9, 2024 17:07
@netroy netroy force-pushed the refactor-generate-ui-types branch from e50f6c4 to 5900e1d Compare December 10, 2024 00:08
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 87.83784% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/load-nodes-and-credentials.ts 52.38% 10 Missing ⚠️
packages/core/src/DirectoryLoader.ts 92.85% 5 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@netroy netroy requested a review from elsmr December 10, 2024 08:05
Copy link
Member

@elsmr elsmr left a comment

Choose a reason for hiding this comment

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

Nice! so many added tests and simpler code + 1 less script 😄

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 2d36b42 into master Dec 10, 2024
65 checks passed
@netroy netroy deleted the refactor-generate-ui-types branch December 10, 2024 13:48
@janober
Copy link
Member

janober commented Dec 11, 2024

Got released with [email protected]

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 node/improvement New feature or request Released tests-needed This PR needs additional tests
Projects
None yet
4 participants