Technical design doc for Code Owners
# Scope
Develop a technical design document for CODEOWNERS in the pattern of [Approval Rules](https://docs.gitlab.com/ee/development/approval_rules.html#approval-rules-development-guide).
## Inheritance and Groups
The documentation should cover the effect of inheritance and groups https://gitlab.com/groups/gitlab-org/-/epics/9733#note_1251955623
## Codeowner file precendence
Following this [conversation](https://gitlab.com/gitlab-org/gitlab/-/issues/388931#note_1256176373), determine which order the codeowners file are applied in in the case there are multiple.
```
Choose the location where you want to specify Code Owners:
- In the root directory of the repository
- In the .gitlab/ directory
- In the docs/ directory
```
**Update:** Only the first file will be used if multiple are defined. Order is root, docs, .gitlab
```ruby
# in ee/lib/gitlab/code_owners.rb
FILE_NAME = 'CODEOWNERS'
FILE_PATHS = [FILE_NAME, "docs/#{FILE_NAME}", ".gitlab/#{FILE_NAME}"].freeze
# in ee/app/models/ee/repository.rb
# method: Repository#code_owners_blob(ref:)
possible_code_owner_blobs = ::Gitlab::CodeOwners::FILE_PATHS.map { |path| [ref, path] }
blobs_at(possible_code_owner_blobs).compact.first
```
## Document how the system deals with errors in CODEOWNERS file
Does is for instance ignore the requirement to require codeownwer approval all together?
### Example MRs
- https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29679+
- https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33499+
issue