Discuss the usage of `# EE-specific` comments
This is a short-term solution.
Lately, I've added some # EE-specific
in the EE codebase when I encountered conflicts. Examples are as follows:
In lib/api/members.rb
:
post ":id/members" do
source = find_source(source_type, params[:id])
authorize_admin_source!(source_type, source)
## EE specific
if source_type == 'project' && source.group && source.group.membership_lock
not_allowed!
end
## EE specific
member = source.members.find_by(user_id: params[:user_id])
In config/routes/admin.rb
:
resource :logs, only: [:show]
resource :health_check, controller: 'health_check', only: [:show]
resource :background_jobs, controller: 'background_jobs', only: [:show]
## EE-specific
resource :email, only: [:show, :create]
## EE-specific
resource :system_info, controller: 'system_info', only: [:show]
resources :requests_profiles, only: [:index, :show], param: :name, constraints: { name: /.+\.html/ }
The goal is not much to prevent, but rather when a conflict happen to make it obvious for the developer to understand what's EE-specific and what's not.
See a real-world example of a pretty obvious conflict resolution:
Following is a link to a discussion started by @yorickpeterse in Slack about these comments: https://gitlab.slack.com/archives/development/p1476270224003630 (btw @yorickpeterse you added an # EE-specific
comment yourself: https://gitlab.com/gitlab-org/gitlab-ee/commit/be0f459e6f1d225dd5c6db817ea9487557590eed#6d2b5f3d62e6006fd635066c290db147770e62df_47_47 ;))
As said in this Slack discussion, this is not the silver-bullet solution, but I think as a short-term solution it can really be helpful in the places where conflicts happen often.
What do you think @vsizov @rspeicher @yorickpeterse @stanhu @smcgivern @DouweM
Notes:
- The mid-term solution will be to refactor some part of the code that conflicts often: gitlab-org/gitlab-ce#23864
- The long-term solution will be to use architectural solutions that allows us to prevent conflicts in the first place, even when introducing new code: gitlab-org/gitlab-ce#23865