Skip to content

fix(deleter): org delete skips service users, policies and roles already gone - #2020

Merged
AmanGIT07 merged 1 commit into
mainfrom
fix/org-delete-skips-gone-rows
Oct 23, 2026
Merged

AmanGIT07 merged 1 commit into
mainfrom
fix/org-delete-skips-gone-rows

Conversation

@AmanGIT07

Copy link
Copy Markdown
Contributor

Summary

The service user, policy and role loops in DeleteOrganization now 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 skips serviceuser.ErrNotExist, the organization policy loop skips policy.ErrNotExist, and the role loop skips role.ErrNotExist.

Technical Details

  • Each of these deletes reads the live row first, so a row that is already gone answers its not-found error: serviceuser.Service.Delete through GetByID, policy.Service.Delete through the repository Get (its relation deletes find nothing and return no error), and role.Service.Delete through Get.
  • The invitation loop needs no change: the invitation delete returns no error for a missing row.

Test Plan

  • core/deleter/service_test.go TestDeleteOrganization: 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.
  • e2e TestEndToEndAPIRegressionTestSuite, TestEndToEndServiceUsersRegressionTestSuite and TestEndToEndPATRegressionTestSuite pass.
  • golangci-lint run ./core/deleter/... reports no issues.

…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.
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
frontier Ready Ready Preview Oct 22, 2026 12:11pm UTC

@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 8053fb3 and de9d6b3.

📒 Files selected for processing: 2
  • core/deleter/service.go
  • core/deleter/service_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39776287535

Coverage increased (+0.008%) to 55.649%

Details

  • Coverage increased (+0.008%) from the base build.
  • Patch coverage: 6 of 6 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 41864
Covered Lines: 23297
Line Coverage: 55.65%
Coverage Strength: 19.32 hits per line

💛 - Coveralls

@AmanGIT07
AmanGIT07 merged commit cd62c23 into main Oct 23, 2026
8 checks passed
@AmanGIT07
AmanGIT07 deleted the fix/org-delete-skips-gone-rows branch October 23, 2026 03:17

This branch was successfully deployed

1 active deployment
Preview — de9d6b3f Deployed Oct 22, 2026 by vercel[bot]
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