Skip to content

Commit 1617e12

Browse files
MAINTAINERS: define the inactive CODEOWNERS policy
The policy defines inactivity (1 year without review activity), outlines the removal process with notification periods, and provides templates for issue notifications and removal PRs. Also document the `check_inactive_codeowners.py` script usage for identifying inactive members. See #187 for more details. Signed-off-by: Stefano Garzarella <[email protected]>
1 parent 37d050c commit 1617e12

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed

MAINTAINERS.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,160 @@ that are published to crates.io the release process includes publishing a new
5959
version. Ask one of the maintainers to give you permissions for the crate
6060
on crates.io.
6161

62+
## Inactive CODEOWNERS Policy
63+
64+
To maintain an accurate view of repository health and ensure an efficient PR
65+
review process, we have implemented a policy for managing inactive CODEOWNERS
66+
(see [issue #187](https://github.com/rust-vmm/community/issues/187) for
67+
details).
68+
69+
### Inactivity Definition
70+
71+
A CODEOWNER is considered inactive after **1 year** without any review activity
72+
(comments, approvals, etc.) in a repository.
73+
74+
### Removal Process
75+
76+
1. Regular checks (e.g. monthly) will identify CODEOWNERS who haven't been
77+
active in a year
78+
2. An issue will be opened in the community repository tagging all inactive
79+
CODEOWNERS
80+
3. After a 1-month notification period, inactive members will be gracefully
81+
removed from the `CODEOWNERS` file
82+
4. The required number of approvals per PR should be adjusted to align with
83+
the current number of active maintainers
84+
85+
### Re-adding Removed CODEOWNERS
86+
87+
Being removed from CODEOWNERS doesn't mean someone isn't wanted as a maintainer
88+
anymore. It's simply to keep track of how many active maintainers we have and
89+
monitor project health. Anyone removed can easily be re-added as a maintainer
90+
whenever they wish to become active again by:
91+
- Pinging the current maintainers, or
92+
- Opening a PR against the `CODEOWNERS` file to re-add themselves
93+
94+
**Note:** The gatekeeper inactivity policy has been deferred until the monorepo
95+
migration is complete, at which point gatekeepers will be "codeowners for the
96+
repo root" and can be handled by this policy automatically.
97+
98+
### Checking for Inactive CODEOWNERS
99+
100+
The `scripts/check_inactive_codeowners.py` script can help with the process of
101+
identifying inactive CODEOWNERS by checking their activity (PR reviews,
102+
PR/issue comments, and optionally commits) in one or more repositories.
103+
104+
**Requirements:**
105+
- Python 3 with dependencies from `scripts/requirements.txt` (install with `pip install -r scripts/requirements.txt`)
106+
- GitHub personal access token (optional but recommended, set as `GITHUB_TOKEN` environment variable)
107+
108+
**Basic usage:**
109+
```bash
110+
export GITHUB_TOKEN=your_token_here
111+
python scripts/check_inactive_codeowners.py
112+
```
113+
114+
**Common options:**
115+
- `--repos`: Comma-separated repository name(s) to check (if not specified, checks all repos in the organization)
116+
- `--org`: GitHub organization (default: rust-vmm)
117+
- `--days`: Number of days to check for activity (default: 365)
118+
- `--until`: End date for activity check in YYYY-MM-DD format (default: today)
119+
- `--verbose` or `-v`: Enable detailed debug output including API queries and individual activity found
120+
- `--include-commits`: Include commit count in activity check (default: only reviews and comments)
121+
122+
The script will:
123+
1. Fetch all repositories from the organization (if `--repos` is not specified)
124+
2. Skip archived repositories
125+
3. Fetch the CODEOWNERS file from each repository (trying common locations)
126+
4. Skip repositories with no CODEOWNERS file or empty CODEOWNERS
127+
5. Extract individual GitHub usernames (team references are not supported)
128+
6. Check if users exist on GitHub
129+
7. Check each user's activity over the specified period (PR reviews, PR/issue comments, and optionally commits)
130+
8. Report inactive and non-existent users with a summary
131+
132+
**Exit codes:**
133+
- `0`: All CODEOWNERS are active
134+
- `1`: There are inactive CODEOWNERS
135+
- `2`: Errors occurred while querying GitHub
136+
137+
**Notes:**
138+
- The script uses PyGithub to efficiently batch GitHub API queries for checking activity.
139+
- Without a GitHub token, the script will work but slower due to lower
140+
[rate limits](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api)
141+
(60 requests/hour vs 5000 requests/hour with authentication).
142+
- You can generate a token at https://github.com/settings/tokens
143+
144+
### Notification Issue Template
145+
146+
When inactive CODEOWNERS are identified, an issue should be created in the
147+
community repository using this template:
148+
149+
```markdown
150+
Title: Inactive CODEOWNERS Notification - [Month Year]
151+
152+
# Inactive CODEOWNERS Notification
153+
154+
During our regular audit, we identified CODEOWNERS who haven't had any review
155+
activity (comments, approvals, etc.) in their respective repositories for over
156+
1 year.
157+
158+
The following users are affected:
159+
160+
@username1 @username2 @username3 ...
161+
162+
## Next Steps
163+
164+
According to our [Inactive CODEOWNERS Policy](https://github.com/rust-vmm/community/blob/main/MAINTAINERS.md#inactive-codeowners-policy):
165+
166+
1. We will wait **1 month** from the date of this issue before proceeding with
167+
any removals
168+
2. If you are still interested in maintaining your repository, please comment on
169+
this issue or resume review activity
170+
3. If you are no longer able to maintain the repository, no action is needed -
171+
we will proceed with the removal after the notification period
172+
4. You can be re-added as a CODEOWNER at any time in the future by pinging
173+
current maintainers or opening a PR
174+
175+
Being removed from CODEOWNERS doesn't mean you aren't wanted as a maintainer.
176+
It's simply to help us track active maintainers and adjust approval rules
177+
accordingly.
178+
179+
If you have any questions or concerns, please comment below.
180+
181+
**Removal Date:** [Date 1 month from issue creation]
182+
```
183+
184+
### Removal PR Template
185+
186+
After the notification period expires, a PR should be created to remove
187+
inactive CODEOWNERS using this template:
188+
189+
```markdown
190+
Title: Remove inactive CODEOWNERS - [Month Year]
191+
192+
# Remove Inactive CODEOWNERS
193+
194+
This PR removes CODEOWNERS who have been inactive for over 1 year and were
195+
notified in https://github.com/rust-vmm/community/issues/[issue-number].
196+
197+
## Changes
198+
199+
- Removed inactive CODEOWNERS: @username1 @username2 @username3 ...
200+
- Adjusted PR approval requirements where needed to match the new number of
201+
active maintainers
202+
203+
## Notification
204+
205+
All affected CODEOWNERS were notified on [date] via https://github.com/rust-vmm/community/issues/[issue-number]
206+
and given a 1-month period to respond.
207+
208+
## Policy Reference
209+
210+
This removal follows our [Inactive CODEOWNERS Policy](https://github.com/rust-vmm/community/blob/main/MAINTAINERS.md#inactive-codeowners-policy).
211+
212+
Removed maintainers can be re-added at any time by opening a PR or pinging
213+
current maintainers.
214+
```
215+
62216
## The Gatekeeper Role
63217

64218
The wider organization is managed by a team

0 commit comments

Comments
 (0)