n8n icon indicating copy to clipboard operation
n8n copied to clipboard

feat(core): Link all shared credentials to the personal project of the user it's shared with

Open despairblue opened this issue 1 year ago • 1 comments

Summary

Make sure every shared credential is linked to the personal project of the user it's shared with.

This also contains code that makes sure every user created via integration test helpers has a personal project. This may become obsolete when https://github.com/n8n-io/n8n/pull/8550 lands.

Related tickets and issues

https://linear.app/n8n/issue/PAY-1349/make-sure-that-sharedcredentials-always-link-to-a-project

Review / Merge checklist

  • [ ] PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • [ ] Docs updated or follow-up ticket created.
  • [ ] Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests.

despairblue avatar Feb 06 '24 17:02 despairblue

I've decided against doing the refactors now. This would be bottomless pit that I would sink my time in and everybody else's time that had to review what I'd do. I tried and learned a lot, but I don't want to ruthlessly refactor something I only understand partially.

I also split the tickets in linear. This PR is now only about making sure that SharedCredentials.projectId is always set. So that we can make that column not null in the migration.

despairblue avatar Feb 07 '24 17:02 despairblue

:warning: Some Cypress E2E specs are failing, please fix them before merging

github-actions[bot] avatar Feb 08 '24 09:02 github-actions[bot]

26 failed tests on run #4044 ↗︎

26 23 2 0 Flakiness 0

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 despairblue 🗃️ e2e/*
Project: n8n Commit: ce30f781f2
Status: Failed Duration: 11:41 💡
Started: Feb 8, 2024 10:24 AM Ended: Feb 8, 2024 10:36 AM
Failed  2-credentials.cy.ts • 8 failed tests

View Output Video

Test Artifacts
Credentials > should create a new credential using empty state Test Replay Screenshots Video
Credentials > should sort credentials Test Replay Screenshots Video
Credentials > should create credentials from NDV for node with multiple auth options Test Replay Screenshots Video
Credentials > should show multiple credential types in the same dropdown Test Replay Screenshots Video
Credentials > should create credentials from NDV for node with no auth options Test Replay Screenshots Video
Credentials > should delete credentials from NDV Test Replay Screenshots Video
Credentials > should rename credentials from NDV Test Replay Screenshots Video
Credentials > should setup generic authentication for HTTP node Test Replay Screenshots Video
Failed  16-webhook-node.cy.ts • 2 failed tests

View Output Video

Test Artifacts
Webhook Trigger node > should listen for a GET request with Basic Authentication Test Replay Screenshots Video
Webhook Trigger node > should listen for a GET request with Header Authentication Test Replay Screenshots Video
Failed  17-sharing.cy.ts • 8 failed tests

View Output Video

Test Artifacts
Sharing > should create C1, W1, W2, share W1 with U3, as U2 Test Replay Screenshots Video
Sharing > should create C2, share C2 with U1 and U2, as U3 Test Replay Screenshots Video
Sharing > should open W1, add node using C2 as U3 Test Replay Screenshots Video
Sharing > should open W1, add node using C2 as U2 Test Replay Screenshots Video
Sharing > should not have access to W2, as U3 Test Replay Screenshots Video
Sharing > should have access to W1, W2, as U1 Test Replay Screenshots Video
Sharing > should automatically test C2 when opened by U2 sharee Test Replay Screenshots Video
Sharing > should work for admin role on credentials created by others (also can share it with themselves) Test Replay Screenshots Video
Failed  30-langchain.cy.ts • 3 failed tests

View Output Video

Test Artifacts
Langchain Integration > should be able to open and execute Basic LLM Chain node Test Replay Screenshots Video
Langchain Integration > should be able to open and execute Agent node Test Replay Screenshots Video
Langchain Integration > should add and use Manual Chat Trigger node together with Agent node Test Replay Screenshots Video
Failed  34-template-credentials-setup.cy.ts • 4 failed tests

View Output Video

Test Artifacts
Template credentials setup > can create credentials and workflow from the template Test Replay Screenshots Video
Template credentials setup > should work with a template that has no credentials (ADO-1603) Test Replay Screenshots Video
Template credentials setup > Credential setup from workflow editor > should allow credential setup from workflow editor if user fills in credentials partially during template setup Test Replay Screenshots Video
Template credentials setup > Credential setup from workflow editor > should fill credentials from workflow editor Test Replay Screenshots Video

The first 5 failed specs are shown, see all 48 specs in Cypress Cloud.

Review all test suite changes for PR #8564 ↗︎

cypress[bot] avatar Feb 08 '24 09:02 cypress[bot]

:warning: Some Cypress E2E specs are failing, please fix them before merging

github-actions[bot] avatar Feb 08 '24 10:02 github-actions[bot]