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): Use explicit types in configs to ensure valid decorator metadata #10433

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Aug 15, 2024

Summary

For the config decorators to work properly, all config fields need to have explicit types, otherwise tsc emits the design:type decorator metadata as Object instead of the actual type. This seems to be a bug in tsc.

This PR

  1. Adds a check to prevent us from creating any configs fields without explicit types, by throwing when config is being parsed, and
  2. Updates all current config fields to use an explicit type.

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@netroy netroy requested a review from ivov August 15, 2024 10:19
@netroy netroy added the release/backport Changes that need to be backported to older releases. label Aug 15, 2024
@netroy netroy marked this pull request as ready for review August 15, 2024 10:19
@netroy netroy force-pushed the fix-config branch 2 times, most recently from 1f2721d to 5829d7d Compare August 15, 2024 10:23
@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Aug 15, 2024
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

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

LGTM. Noticed that numbers with quotes are parsed as numbers. Only minor comments, feel free to merge.

@@ -232,6 +232,7 @@ describe('GlobalConfig', () => {
DB_POSTGRESDB_USER: 'n8n',
DB_TABLE_PREFIX: 'test_',
NODES_INCLUDE: '["n8n-nodes-base.hackerNews"]',
DB_LOGGING_MAX_EXECUTION_TIME: '0',
Copy link
Contributor

Choose a reason for hiding this comment

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

This (as number) is the default, so we should be testing with anything other than this?

packages/@n8n/config/src/decorators.ts Show resolved Hide resolved
packages/@n8n/config/src/decorators.ts Show resolved Hide resolved
Copy link
Contributor

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

Copy link

cypress bot commented Aug 15, 2024



Test summary

401 0 0 0Flakiness 1


Run details

Project n8n
Status Passed
Commit 1f2721d
Started Aug 15, 2024 11:16 AM
Ended Aug 15, 2024 11:21 AM
Duration 04:43 💡
OS Linux Debian -
Browser Electron 118

View run in Cypress Cloud ➡️


Flakiness

e2e/30-editor-after-route-changes.cy.ts Flakiness
1 Editor actions should work > after switching between Editor and Debug

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit 2043daa into master Aug 15, 2024
31 checks passed
@netroy netroy deleted the fix-config branch August 15, 2024 11:58
This was referenced Aug 15, 2024
@janober
Copy link
Member

janober commented Aug 15, 2024

Got released with [email protected]

MiloradFilipovic added a commit that referenced this pull request Aug 16, 2024
* master:
  fix(Google Sheets Node): Update name and hint for useAppend option (#10443)
  fix(editor): Show item count in output panel schema view (#10426)
  ci: Introduce lint rule `no-untyped-config-class-field` (no-changelog) (#10436)
  fix(editor): Highlight matching type in filter component (#10425)
  feat(Facebook Graph API Node): Update node to support API v18 - v20 (#10419)
  fix(editor): Truncate long data pill labels in schema view (#10427)
  fix(core): Use explicit types in configs to ensure valid decorator metadata (#10433)
  fix(n8n Form Trigger Node): Show basic authentication modal on wrong credentials (#10423)
  fix(editor): Remove item count from pinned data status icon in new canvas (no-changelog) (#10431)
  feat(editor): Improve node selection outline in new canvas (no-changelog) (#10430)
  feat: Improve minimap design and position in new canvas (no-changelog) (#10429)
netroy added a commit to netroy/n8n that referenced this pull request Aug 21, 2024
#
[1.56.0](https://github.com/netroy/n8n/compare/[email protected]@1.56.0)
(2024-08-20)


### Bug Fixes

* Better errors in Switch, If and Filter nodes
([n8n-io#10457](https://github.com/netroy/n8n/issues/10457))
([aea82cb](aea82cb))
* **core:** Fix payload property in `workflow-post-execute` event
([n8n-io#10413](https://github.com/netroy/n8n/issues/10413))
([d98e29e](d98e29e))
* **core:** Fix XSS validation and separate URL validation
([n8n-io#10424](https://github.com/netroy/n8n/issues/10424))
([91467ab](91467ab))
* **core:** Use explicit types in configs to ensure valid decorator
metadata ([n8n-io#10433](https://github.com/netroy/n8n/issues/10433))
([2043daa](2043daa))
* **editor:** Add workflow scopes when initializing workflow
([n8n-io#10455](https://github.com/netroy/n8n/issues/10455))
([b857c2c](b857c2c))
* **editor:** Buffer json chunks in stream response
([n8n-io#10439](https://github.com/netroy/n8n/issues/10439))
([37797f3](37797f3))
* **editor:** Fix flaky mapping tests
([n8n-io#10453](https://github.com/netroy/n8n/issues/10453))
([fc6d413](fc6d413))
* **editor:** Highlight matching type in filter component
([n8n-io#10425](https://github.com/netroy/n8n/issues/10425))
([6bca879](6bca879))
* **editor:** Show item count in output panel schema view
([n8n-io#10426](https://github.com/netroy/n8n/issues/10426))
([4dee7cc](4dee7cc))
* **editor:** Truncate long data pill labels in schema view
([n8n-io#10427](https://github.com/netroy/n8n/issues/10427))
([1bf2f4f](1bf2f4f))
* Filter component - improve errors
([n8n-io#10456](https://github.com/netroy/n8n/issues/10456))
([61ac0c7](61ac0c7))
* **Google Sheets Node:** Better error when column to match on is empty
([n8n-io#10442](https://github.com/netroy/n8n/issues/10442))
([ce46bf5](ce46bf5))
* **Google Sheets Node:** Update name and hint for useAppend option
([n8n-io#10443](https://github.com/netroy/n8n/issues/10443))
([c5a0c04](c5a0c04))
* **Google Sheets Node:** Update to returnAllMatches option
([n8n-io#10440](https://github.com/netroy/n8n/issues/10440))
([f7fb02e](f7fb02e))
* **Invoice Ninja Node:** Fix payment types
([n8n-io#10462](https://github.com/netroy/n8n/issues/10462))
([129245d](129245d))
* **n8n Form Trigger Node:** Show basic authentication modal on wrong
credentials ([n8n-io#10423](https://github.com/netroy/n8n/issues/10423))
([0dc3e99](0dc3e99))
* **OpenAI Node:** Throw node operations error in case of openAi client
error ([n8n-io#10448](https://github.com/netroy/n8n/issues/10448))
([0d3ed46](0d3ed46))
* Project Viewer always seeing a connection error when testing
credentials ([n8n-io#10417](https://github.com/netroy/n8n/issues/10417))
([613cdd2](613cdd2))
* Remove unimplemented Postgres credentials options
([n8n-io#10461](https://github.com/netroy/n8n/issues/10461))
([17ac784](17ac784))
* Require mfa code to change email
([n8n-io#10354](https://github.com/netroy/n8n/issues/10354))
([39c8e50](39c8e50))
* **Respond to Webhook Node:** Fix issue preventing the chat trigger
from working ([n8n-io#9886](https://github.com/netroy/n8n/issues/9886))
([9d6ad88](9d6ad88))
* Show input names when node has multiple inputs
([n8n-io#10434](https://github.com/netroy/n8n/issues/10434))
([973956c](973956c))


### Features

* **core:** Support bidirectional communication between specific mains
and specific workers
([n8n-io#10377](https://github.com/netroy/n8n/issues/10377))
([d0fc9de](d0fc9de))
* **Facebook Graph API Node:** Update node to support API v18 - v20
([n8n-io#10419](https://github.com/netroy/n8n/issues/10419))
([e7ee10f](e7ee10f))

Co-authored-by: netroy <[email protected]>
@github-actions github-actions bot mentioned this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team release/backport Changes that need to be backported to older releases. Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants