Bug in Code Owners / MR Approvals widget?
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary I recently added a section [`[Docs Create]`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/CODEOWNERS#L21) with files to this project's `CODEOWNERS` file so that MRs authors can easily spot who to assign for review. - Problem 1: The MR Approvals widget shows the new `[Docs Create]` section but doesn't show who owns the file. - Problem 2: Code Owners is considering the group who owns `/doc/` instead of considering the owner to the file `/doc/user/project/merge_requests/merge_request_approvals.md`. It's my understanding that the last rule listed prevails. Is this correct? What we have in the `CODEOWNERS` file: ![Screen_Shot_2020-08-18_at_13.09.10](/uploads/a95ccc4e34a2c80fcfa4b0fe07dfd1ef/Screen_Shot_2020-08-18_at_13.09.10.png) What we have in the widget: ![Screen_Shot_2020-08-18_at_13.12.21](/uploads/79c02179551edf4ce29caf5ea743bf55/Screen_Shot_2020-08-18_at_13.12.21.png) Shouldn't it only show the last rule? :thinking: Which is: `/doc/user/project/merge_requests/merge_request_approvals.md @marcia` => therefore, the widget should show only my username instead of the whole group for `doc/`, no? That's how it works for [`/doc/development/`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/CODEOWNERS#L12), for example. **Oh! Wait a min!** Maybe the reason is that I'm the MR author (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39701), therefore, I'm not an eligible approver. In that case, I guess we should hide the "Docs Create" section? ### Steps to reproduce 1. Add a dir to a CODEOWNERS section with a group as owner to the dir. 1. Below the dir, add a new section with a file that belongs to this dir and a user as owner to the file. 1. Change the file and submit a merge request. 1. Open the MR Approvals widget to see who owns the file. ### Example Project https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/CODEOWNERS#L29 // https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39701 ### What is the current *bug* behavior? - Code Owners considers the group set as owner to a high-level dir as code owner instead of a user set as owner to a file within the folder. - Doesn't display the avatar of the file's code owner, only the Code Owner's section ("Docs Create") and the file name. ### What is the expected *correct* behavior? - Consider the last rule and only show the code owner to that file. - Show the user's avatar. ### Relevant logs and/or screenshots Added above. ### Output of checks This bug happens on GitLab.com. #### Results of GitLab environment info Env info: - GitLab.com - https://gitlab.com/gitlab-org/gitlab/ - https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/CODEOWNERS - macOS Catalina 10.15.6 - Chrome Version 84.0.4147.89 (Official Build) (64-bit) - zoom 100% #### Results of GitLab application Check <details> <summary>Expand for output related to the GitLab application check</summary> <pre> (For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`) (we will only investigate if the tests are passing) </pre> </details> ### Possible fixes (If you can, link to the line of code that might be responsible for the problem)
issue