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

Improve idp deletion error scenario. #6178

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Thisara-Welmilla
Copy link
Contributor

@Thisara-Welmilla Thisara-Welmilla commented Dec 4, 2024

Issue:

The existing implementation deletes the associated action first and then deletes the Identity Provider (IDP) from the database. If an error occurs while deleting the IDP, a rollback mechanism adds the action back. However, the newly added action does not retain the original ID, causing inconsistencies.

To address this, we are changing the implementation to delete the IDP from the database first, followed by deleting the associated action. However, if an error occurs during the deletion of the action, it will result in a stale action remaining in the system. Added a warn for that.

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/12158928901

@Thisara-Welmilla Thisara-Welmilla force-pushed the improve-idp-delete-error-scenario branch from 1b2d38d to 6565355 Compare December 4, 2024 11:58
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 45.39%. Comparing base (145665f) to head (6565355).
Report is 229 commits behind head on master.

Files with missing lines Patch % Lines
...g/wso2/carbon/idp/mgt/dao/IdPManagementFacade.java 68.42% 6 Missing ⚠️
...o2/carbon/idp/mgt/util/IdPManagementConstants.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6178      +/-   ##
============================================
+ Coverage     45.02%   45.39%   +0.36%     
- Complexity    13679    13899     +220     
============================================
  Files          1606     1619      +13     
  Lines         99398   100302     +904     
  Branches      16761    16833      +72     
============================================
+ Hits          44755    45531     +776     
- Misses        48002    48082      +80     
- Partials       6641     6689      +48     
Flag Coverage Δ
unit 27.63% <65.00%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/12158928901
Status: cancelled

}
throw e;
} catch (IdentityProviderManagementException e) {
// Error will not be thrown, since the IDPs is already deleted. But there will be stale actions.
Copy link
Member

Choose a reason for hiding this comment

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

typo -> IdPs are deleted

@@ -604,6 +604,14 @@ public static class SQLQueries {
"SELECT * FROM IDP_AUTHENTICATOR WHERE TENANT_ID = ? AND DEFINED_BY = 'USER'";
}

public static class WarningMessage {

public static final String WARN_STALE_IDP_ACTION = "The %s Identity Provider was deleted, but an error " +
Copy link
Member

Choose a reason for hiding this comment

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

Let's rather say, Identity Provider: %s is deleted. but ....
Remove "The" in the plural form as well and use present tense

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants