Organization user deletion does not handle remaining group and project memberships

Problem

OrganizationUserDelete (!249299 (merged)) deletes a single organization_users row, but it does not touch the user's group or project memberships in that organization.

Member#create_organization_user_record (app/models/member.rb) is an after_create/after_update callback that calls Organizations::OrganizationUser.create_organization_record_for(user_id, source.organization_id) whenever a non-pending membership is saved on a group or project owned by the organization.

So if a deleted organization user still holds any membership inside that organization, the next save of that membership record silently recreates the organization user row. The deletion is not durable.

Why it matters

Callers cannot rely on the mutation to actually remove a user from an organization. The row can come back with no user action and no signal that it happened.

Proposal

Decide what deletion should do with the user's remaining group and project memberships in the organization:

  • block the deletion while memberships remain, or
  • cascade removal of those memberships.

Membership cleanup was deliberately out of scope for the original MR, hence this follow-up.

The choice interacts with Cells: in Cells 1.0 a user belongs to a single organization.