Assign all contributions to the Namespace owner when the destination is a personal namespace.

On !175583 (merged), we updated user contribution mapping to map contributions to the Import User bot when projects are imported in a personal namespace.

The problem is that users lack a UI for reassignment, making the mapping of contributions to the Import User pointless if they cannot carry out the task. Additionally, since users won't perform the reassignment, the placeholder user references will remain, leading to unnecessary records in the database.

Proposed solution

  • Update importers to map contributions directly to the current_user when the namespace is a user namespace. Additionally, update importers not to create an Import User and push placeholder references, if necessary.

Example pseudo-code:

if namespace.user_namespace?
  # We will assign all contributions to current_user
end

Importing a project into a personal namespace results in all contributions being mapped to the same bot user. To map contributions to real users, import projects into a group instead.

user_mapping_to_personal_namespace_owner WIP feature flag rollout: #556557 (closed)

Data migration (to be implemented in #534710 in a seubsequent milestone):

  • Delete Import::SourceUser records where the namespace is a personal namespace
  • Delete all placeholder references (Import::Placeholders::Membership and Import::SourceUserPlaceholderReference) that are associated with those Import::SourceUser records.

Add a new validation to Import::SourceUser that namespace is not a user namespace (implemented in #562419)

All MRs require an Application Security Team review see #525342 (comment 2409499126).

Edited by Sam Word