Ensure that EE only enum values do not conflict with CE enum values
The following discussion from !8469 (merged) should be addressed:
-
@rspeicher started a discussion: (+1 comment) I suppose it's too late to worry about now, but I'm realizing that someone could come along in CE, see that we only have two values for this enum, then add a new CE value at 3, and we might not catch in review that this conflicts with a pre-existing EE-only value. I wonder if we should establish a rule going forward that EE-only extensions of Enums start at, like, 50.
It looks like we tried to do something like that in
ee/app/models/ee/commit_status_enums.rb
andee/app/models/ee/ci/pipeline_enums.rb
.
Basic problem:
CE defines an enum with values 1 to 5. EE has a specific enum value 6. Now a developer adds a new value to CE, and uses number 6 because it's not used there yet. This now conflicts with EE.
There are a few possible options:
- EE enums start at a certain offset, though this only works if the offset is big enough
- EE uses negative enum values
- In EE we somehow check if the enum values conflict, erroring if this is the case. This however means the problem is not apparent until the code makes its way into EE, at which point it might be too late.