CODEOWNERS: Enforce approval of all owners/groups
Problem to Solve
We have a file in a monorepo that specifies the protocol between two components (a frontend and a backend). We would like to enforce that every modification to this file be reviewed by both a member of the frontend and a member of the backend. So we have two groups, project/backend-reviewers
and project/frontend-reviewers
. Currently, we have a CODEOWNERS file that works like so:
/protocol/ @project/frontend-reviewers @project/backend-reviewers
The problem is, with the rule as-is, the MR is considered reviewed when one of the two groups reviews the modification. As such, MRs can get merged without approval of both groups (e.g. frontend approves, so the rule gets considered "approved").
One could naively think that putting each group on its own line would work, but no, only the later group then becomes a codeowner. This is documented in the CODEOWNERS doc:
When a file matches multiple CODEOWNERS entries
When a file matches multiple entries in the CODEOWNERS file, the users from last pattern matching the file are used.
Proposal
It'd be nice to have a syntax to require both groups to approve the changes. Some bikesheddy syntax
/protocol/ ALL @project/frontend-reviewers @project/backend-reviewers