Repository navigation
fix(deleter): org delete skips service users, policies and roles already gone - #2020
Merged
Merged
Conversation
…ady gone The service user, organization policy and role loops in DeleteOrganization skip their not-found errors, like the resource and domain loops, so a retry or a parallel delete does not stop the organization delete. The invitation delete already returns no error for a missing row.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
10 tasks done
Coverage Report for CI Build 39776287535Coverage increased (+0.008%) to 55.649%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
rohilsurana
approved these changes
Oct 22, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The service user, policy and role loops in
DeleteOrganizationnow skip a row that is already gone, like the resource and domain loops. A retry, or a delete that runs at the same time, no longer stops the organization delete on a row that another call removed. #2016 does the same for the group loop.Changes
core/deleter/service.go: the service user loop skipsserviceuser.ErrNotExist, the organization policy loop skipspolicy.ErrNotExist, and the role loop skipsrole.ErrNotExist.Technical Details
serviceuser.Service.DeletethroughGetByID,policy.Service.Deletethrough the repositoryGet(its relation deletes find nothing and return no error), androle.Service.DeletethroughGet.Test Plan
core/deleter/service_test.goTestDeleteOrganization: a service user, an organization policy and a role that are already gone are skipped, and the live ones are deleted before the organization row. Without each skip, the case fails.go test ./core/deleter/... ./internal/api/...passes.TestEndToEndAPIRegressionTestSuite,TestEndToEndServiceUsersRegressionTestSuiteandTestEndToEndPATRegressionTestSuitepass.golangci-lint run ./core/deleter/...reports no issues.