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

GEN-1234 - Clean up suggestions when a user is deleted #17988

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

pmbrull
Copy link
Collaborator

@pmbrull pmbrull commented Sep 25, 2024

Describe your changes:

  • We had an error when trying to Accept All suggestions from a user that was deleted
  • This was due us deleting the relationships of that user (user <> suggestion relationship) but not the suggestions.
  • In this PR, we are properly cleaning up the environment. Once a user is deleted, the suggestions it created will be deleted as well
  • Note that during testing we tried to replicate the scenario by creating bots - to make it as similar to the MetaPilot as possible. We noticed that the JWT json schema had a wrongly set required jwtToken when creating a bot user

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@pmbrull pmbrull requested review from a team as code owners September 25, 2024 09:19
Copy link

@@ -213,7 +214,8 @@
User.__name__: "/users",
CreateUserRequest.__name__: "/users",
AuthenticationMechanism.__name__: "/users/auth-mechanism",
Bot.__name__: "/bots", # We won't allow bot creation from the client
Bot.__name__: "/bots",
CreateBot.__name__: "/bots",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

useful for testing

@@ -415,6 +418,9 @@ public ResultList<Suggestion> listAfter(SuggestionFilter filter, int limit, Stri
List<Suggestion> suggestions = getSuggestionList(jsons);
String beforeCursor;
String afterCursor = null;
if (nullOrEmpty(suggestions)) {
return new ResultList<>(suggestions, null, null, total);
}
beforeCursor = after == null ? null : suggestions.get(0).getUpdatedAt().toString();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

without the check we got index out of bounds

@@ -53,5 +53,5 @@
}
},
"additionalProperties": false,
"required": ["JWTToken", "JWTTokenExpiry"]
"required": ["JWTTokenExpiry"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the JWTToken is created in the backend, no need to pass it when creating a user

Copy link
Contributor

The Java checkstyle failed.

Please run mvn spotless:apply in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

sushi30
sushi30 previously approved these changes Sep 25, 2024
Copy link

sonarcloud bot commented Sep 26, 2024

@pmbrull pmbrull merged commit d264495 into open-metadata:main Sep 26, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ingestion safe to test Add this label to run secure Github workflows on PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants