Skip to content

Commit 3f1ae80

Browse files
docs: update CONTRIBUTING.md with guidelines-bot details and review expectations (#331)
* docs: update CONTRIBUTING.md with guidelines-bot details and review expectations * docs: clarify round-robin and empty queue behavior * docs: fix queue state wording * docs: add review completion signals * docs: align reviewer bot guidance with review feedback * docs: streamline contributing and add reviewing guide * docs: switch reviewer note to tip * docs(reviewer-bot): document /rectify command usage * Update REVIEWING.md * Update REVIEWING.md * Update REVIEWING.md --------- Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
1 parent b5fcc75 commit 3f1ae80

3 files changed

Lines changed: 265 additions & 26 deletions

File tree

CONTRIBUTING.md

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
# Contributing to the coding guidelines
22

3+
> [!NOTE]
4+
> Reviewer or Producer guidance, including bot commands and review deadlines, lives in [REVIEWING.md](REVIEWING.md).
5+
36
## Table of Contents
47

5-
- [Contributing to the coding guidelines](#contributing-to-the-coding-guidelines)
6-
- [Table of Contents](#table-of-contents)
7-
- [Contribution Workflow](#contribution-workflow)
8-
- [Note on Chapter Layout](#note-on-chapter-layout)
9-
- [0) Bring up the idea for discussion](#0-optional-bring-the-idea-up-for-discussion)
10-
- [1) Submit coding guideline issue](#1-submit-coding-guideline-issue)
11-
- [1.1) Finding the FLS ID](#11-finding-the-fls-id)
12-
- [2) Guideline Generated as a Comment](#2-guideline-generated-as-a-comment)
13-
- [3) Create a Draft with a Member](#3-create-a-draft-with-a-member)
14-
- [4) Create the PR](#4-create-the-pr)
15-
- [5) Iterate on Feedback](#5-iterate-on-feedback)
16-
- [5.1) Member Begins Review](#51-member-begins-review)
17-
- [5.2) Update the PR Based on Feedback](#52-update-the-pr-based-on-feedback)
18-
- [6) Contributor Applies Feedback on Issue](#6-contributor-applies-feedback-on-issue)
19-
- [7) Contributor Applies Regenerated Guideline to PR](#7-contributor-applies-regenerated-guideline-to-pr)
20-
- [8) Your Guideline gets merged](#8-your-guideline-gets-merged)
21-
- [You just contributed a coding guideline!](#you-just-contributed-a-coding-guideline)
22-
- [Writing a guideline locally (less typical, not recommended)](#writing-a-guideline-locally-less-typical-not-recommended)
23-
- [Guideline template](#guideline-template)
24-
- [Before You Begin Contributing](#before-you-begin-contributing)
25-
- [Licenses](#licenses)
26-
- [Code of Conduct](#code-of-conduct)
27-
- [Contribution Process](#contribution-process)
28-
- [Issues](#issues)
8+
- [First-time contributor quick start](#first-time-contributor-quick-start)
9+
- [Contribution workflow](#contribution-workflow)
10+
- [Writing a guideline locally (less typical, not recommended)](#writing-a-guideline-locally-less-typical-not-recommended)
11+
- [Before you begin contributing](#before-you-begin-contributing)
12+
- [Contribution process](#contribution-process)
13+
14+
## First-time contributor quick start
15+
16+
If you are new here, this is the shortest path to a first PR. The detailed workflow is in the next section.
17+
18+
1. (Optional) Discuss the idea on Zulip. See [0) Bring the idea up for discussion](#0-optional-bring-the-idea-up-for-discussion).
19+
2. Open a coding guideline issue. See [1) Submit coding guideline issue](#1-submit-coding-guideline-issue).
20+
3. Wait for the reStructuredText comment from the bot. See [2) Guideline Generated as a Comment](#2-guideline-generated-as-a-comment).
21+
4. Collaborate with a subcommittee member to refine the draft and get `sign-off: create pr`. See [3) Create a Draft with a Member](#3-create-a-draft-with-a-member).
22+
5. Create the PR using the generated RST and include `closes #xyz` in the PR body. See [4) Create the PR](#4-create-the-pr).
23+
6. Iterate on PR feedback until it is approved and merged. See [5) Iterate on Feedback](#5-iterate-on-feedback).
2924

3025
## Contribution Workflow
3126

32-
Here's a diagram of the overall process:
27+
The full workflow is below. Expand the diagram if you want a high-level view.
28+
29+
<details>
30+
<summary>Workflow diagram</summary>
3331

3432
```mermaid
3533
flowchart TD
@@ -55,6 +53,8 @@ flowchart TD
5553
Main --> End(["9: End"])
5654
```
5755

56+
</details>
57+
5858
### Note on Chapter Layout
5959

6060
The Safety Critical Rust Coding guidelines has the same chapter layout as the [Ferrocene Language Specification](https://spec.ferrocene.dev/) (FLS). If you would like to contribute a new guideline, find a section from the FLS that interests you, then write a guideline in the corresponding chapter of these coding guidelines.
@@ -71,6 +71,9 @@ To add a new coding guideline, open a [coding guideline issue](https://github.co
7171

7272
#### 1.1) Finding the FLS ID
7373

74+
<details>
75+
<summary>How to find the FLS paragraph ID</summary>
76+
7477
Note that the FLS ID should be filled according to the FLS paragraph ID for which the guideline is covering. One way to go about finding this is to inspect the page using your web browser. You'll be looking for something like:
7578

7679

@@ -80,6 +83,8 @@ Note that the FLS ID should be filled according to the FLS paragraph ID for whic
8083

8184
You would then pull `fls_4rhjpdu4zfqj` to place in the FLS ID field.
8285

86+
</details>
87+
8388

8489
### 2) Guideline Generated as a Comment
8590

@@ -95,6 +100,11 @@ contents converted to reStructuredText.
95100

96101
Within 14 days of your submission, a member of the Coding Guidelines Subcommittee should give you a first review. You'll work with them (and other members) to flesh out the concept and ensure the guideline is well prepared for a Pull Request.
97102

103+
> [!TIP]
104+
> A reviewer is automatically assigned from the pool of Producers using a round-robin system. See [REVIEWING.md](REVIEWING.md) for reviewer bot details.
105+
106+
When a subcommittee member adds the `sign-off: create pr` label, the issue review is considered complete and reviewer reminders stop.
107+
98108
### 4) Create the PR
99109

100110
> [!NOTE]
@@ -169,16 +179,24 @@ Once the coding guideline contents have passed review, a subcommittee member wil
169179

170180
That's it!
171181

182+
---
172183

173184
## Writing a guideline locally (less typical, not recommended)
174185

186+
We recommend the issue-based workflow above. If you need to work locally, expand the section below.
187+
188+
<details>
189+
<summary>Local authoring steps</summary>
190+
175191
While it is possible to create guidelines locally, we encourage contributors to make use of the process described above since it handles some of the fiddly details for you as a guideline writer.
176192

177193
### Guideline template
178194

179195
We have a script `./generate_guideline_templates.py` which assumes you're using `uv` that can be run to generate the template for a guideline with properly randomized IDs.
180196

181-
You can the copy and paste this guideline from the command line into the correct chapter.
197+
You can then copy and paste this guideline from the command line into the correct chapter.
198+
199+
</details>
182200

183201
## Before You Begin Contributing
184202

REVIEWING.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# Reviewing coding guidelines
2+
3+
This document is for members reviewing coding guideline issues and PRs (Producers).
4+
If you are contributing a guideline, start with [CONTRIBUTING.md](CONTRIBUTING.md).
5+
6+
## Reviewer Bot Commands
7+
8+
> [!NOTE]
9+
> These commands only apply in the context of coding guideline issues.
10+
11+
Before we continue, here's a preamble on how the reviewer bot helps reviewers do their job.
12+
13+
1. The reviewer bot (`guidelines-bot`) automatically assigns reviewers to coding guideline issues and PRs using a round-robin system.
14+
15+
2. Only members marked as "Producer" in the consortium's [`members.md`](https://github.com/rustfoundation/safety-critical-rust-consortium/blob/main/subcommittee/coding-guidelines/members.md) are included in the rotation.
16+
17+
3. The queue's state is stored in [Issue #314](https://github.com/rustfoundation/safety-critical-rust-coding-guidelines/issues/314).
18+
19+
4. All commands are invoked by mentioning `@guidelines-bot` in a comment.
20+
21+
Round-robin here means the bot maintains a queue of Producers and a `current_index` cursor. Each assignment takes the next eligible reviewer in queue order and advances the cursor; the queue order does not change, except when `/pass` repositions the reviewer to be next up for future assignments. If no eligible reviewer is available (queue empty or all candidates skipped), the bot leaves the issue or PR unassigned and posts: "No reviewers available in the queue. Please use `@guidelines-bot /sync-members` to update the queue."
22+
23+
Down below are the available commands.
24+
25+
### Pass this Review to the next Producer
26+
27+
```
28+
@guidelines-bot /pass [optional reason]
29+
```
30+
31+
Use this when you cannot review a specific issue/PR but want to remain in the rotation for future assignments. The next reviewer in the queue will be assigned instead.
32+
33+
**Example:**
34+
```
35+
@guidelines-bot /pass Not familiar enough with FFI to review this one
36+
```
37+
38+
### Step Away from Queue
39+
40+
```
41+
@guidelines-bot /away YYYY-MM-DD [optional reason]
42+
```
43+
44+
Use this to temporarily remove yourself from the reviewer queue until the specified date. You'll be automatically added back when the date arrives. If you're currently assigned to an issue/PR, the next reviewer will be assigned.
45+
46+
**Example:**
47+
```
48+
@guidelines-bot /away 2025-02-15 On vacation
49+
```
50+
51+
### Claim a Review
52+
53+
```
54+
@guidelines-bot /claim
55+
```
56+
57+
Use this to assign yourself as the reviewer for an issue/PR. This removes any existing reviewer assignment. Only Producers can claim reviews.
58+
59+
**Example:**
60+
```
61+
@guidelines-bot /claim
62+
```
63+
64+
### Release Your Assignment
65+
66+
```
67+
@guidelines-bot /release [reason]
68+
```
69+
70+
Use this to release your assignment from an issue/PR without automatically assigning someone else. The issue/PR will be left unassigned. Use `/pass` if you want to automatically assign the next reviewer.
71+
72+
**Example:**
73+
```
74+
@guidelines-bot /release Need to focus on other priorities
75+
```
76+
77+
### Rectify Review State
78+
79+
```
80+
@guidelines-bot /rectify
81+
```
82+
83+
Use this when GitHub review activity and reviewer-bot state appear out of sync.
84+
This is most common on cross-repository PRs where a review event may not have had
85+
permission to persist reviewer-bot state.
86+
87+
Who can run it:
88+
- The currently assigned reviewer
89+
- A maintainer with triage+ permission
90+
91+
What it does (for the current PR only):
92+
- If the latest review by the assigned reviewer is `APPROVED`, it marks the review complete.
93+
- If the latest review by the assigned reviewer is `COMMENTED` or `CHANGES_REQUESTED`, it refreshes reviewer activity.
94+
- Otherwise, it reports that no reconciliation transition applies.
95+
96+
**Example:**
97+
```
98+
@guidelines-bot /rectify
99+
```
100+
101+
### Assign a Specific Reviewer
102+
103+
```
104+
@guidelines-bot /r? @username
105+
```
106+
107+
Use this to assign a specific person as the reviewer. This is useful when you know someone has specific expertise relevant to the guideline.
108+
109+
**Example:**
110+
```
111+
@guidelines-bot /r? @expert-reviewer
112+
```
113+
114+
### Request Next Reviewer from Queue
115+
116+
```
117+
@guidelines-bot /r? producers
118+
```
119+
120+
Use this to request the next reviewer from the round-robin queue for an already-open issue or PR. This is useful when:
121+
- An issue/PR was opened without the `coding guideline` label and later labeled
122+
- The original reviewer was removed and you need a new one
123+
- You want to explicitly trigger the round-robin assignment
124+
125+
**Example:**
126+
```
127+
@guidelines-bot /r? producers
128+
```
129+
130+
### Manage Labels
131+
132+
```
133+
@guidelines-bot /label +label-name # Add a label
134+
@guidelines-bot /label -label-name # Remove a label
135+
```
136+
137+
**Example:**
138+
```
139+
@guidelines-bot /label +needs-discussion
140+
@guidelines-bot /label -ready-for-review
141+
```
142+
143+
### Sync Members
144+
145+
```
146+
@guidelines-bot /sync-members
147+
```
148+
149+
Manually trigger a sync of the reviewer queue with `members.md`. This happens automatically on each workflow run, but you can force it if needed.
150+
151+
### Check Queue Status
152+
153+
```
154+
@guidelines-bot /queue
155+
```
156+
157+
Shows the current queue position, who's next up for review, and who is currently away.
158+
159+
### Show Available Commands
160+
161+
```
162+
@guidelines-bot /commands
163+
```
164+
165+
Shows all available bot commands with descriptions.
166+
167+
## Review Deadlines
168+
169+
Reviewers have **14 days** to provide initial feedback on assigned issues or PRs. This timeline helps ensure contributors receive timely responses.
170+
171+
Review comments or changes requested by the assigned reviewer reset the 14-day timer. When the assigned reviewer approves the PR, the review is marked complete and reminders stop.
172+
173+
### What Happens If the Deadline Passes
174+
175+
1. **First 14 days**: The assigned reviewer should provide feedback or take action
176+
2. **After 14 days with no activity**: The bot posts a reminder and the reviewer enters a **14-day transition period** to Observer status
177+
3. **After 28 days total**: If still no activity, the reviewer may be transitioned from Producer to Observer status, and the review is reassigned
178+
179+
### Acceptable Responses
180+
181+
Life happens! Any of these actions will reset the 14-day clock:
182+
183+
- **Post a review comment** - Any substantive feedback counts
184+
- **Use `/pass [reason]`** - Pass the review to the next person if you can't review it
185+
- **Use `/away YYYY-MM-DD [reason]`** - Step away temporarily (e.g., "On vacation until 2025-02-15")
186+
- **Use `/rectify`** - Reconcile PR review state when review activity happened but bot state is stale
187+
188+
#### Before You Pass: Consider the Learning Opportunity
189+
190+
Being assigned a review outside your comfort zone can feel daunting, but it's also one of the most effective ways to deepen your Rust knowledge. When you have a concrete goal, understanding this guideline about this feature, learning becomes focused and sticky in a way that abstract study rarely achieves.
191+
192+
Before reaching for `/pass`, we encourage you to spend about an hour engaging with the unfamiliar material:
193+
194+
- Skim the relevant FLS section and any linked documentation
195+
- Read through the guideline with fresh eyes, noting what *does* make sense
196+
- Search for a blog post or example that illuminates the concept
197+
- Try compiling and tweaking the code examples yourself
198+
199+
You may find that an hour of targeted exploration is enough to provide meaningful feedback, even if you're not an expert. Catching unclear explanations, spotting typos, or asking "what does this term mean?" are contributions that matter because you're approaching the material without deep familiarity.
200+
201+
That said, `/pass` exists for good reason. If after an honest effort the material remains opaque, or if the guideline requires genuine expertise you don't have (and can't reasonably acquire in an hour), passing to someone better suited is the right call. The goal is thoughtful engagement, not struggling through a review you can't meaningfully contribute to.
202+
203+
#### Examples of Valid Reasons to Pass
204+
205+
- "Not familiar enough with FFI to review this one"
206+
- "On holiday, please assign to someone else"
207+
- "Swamped with other work this week"
208+
209+
The goal is communication, not perfection. If you need to pass or step away, just let us know!
210+
211+
## Queue Status
212+
213+
The queue's state is stored in [Issue #314](https://github.com/rustfoundation/safety-critical-rust-coding-guidelines/issues/314) and includes:
214+
215+
- **Current queue position** - Who will be assigned next
216+
- **Active producers** - All reviewers in the rotation
217+
- **Pass-until list** - Who is temporarily away and when they return
218+
- **Recent assignments** - History of the last 20 assignments

scripts/reviewer_bot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ def get_issue_guidance(reviewer: str, issue_author: str) -> str:
681681
682682
Other commands:
683683
- `{BOT_MENTION} /claim` - Claim this review for yourself
684+
- `{BOT_MENTION} /rectify` - Reconcile this issue/PR review state from GitHub
684685
- `{BOT_MENTION} /label +label-name` - Add a label
685686
- `{BOT_MENTION} /label -label-name` - Remove a label
686687
- `{BOT_MENTION} /queue` - Show reviewer queue
@@ -716,6 +717,7 @@ def get_fls_audit_guidance(reviewer: str, issue_author: str) -> str:
716717
717718
Other commands:
718719
- `{BOT_MENTION} /claim` - Claim this review for yourself
720+
- `{BOT_MENTION} /rectify` - Reconcile this issue/PR review state from GitHub
719721
- `{BOT_MENTION} /label +label-name` - Add a label
720722
- `{BOT_MENTION} /label -label-name` - Remove a label
721723
- `{BOT_MENTION} /queue` - Show reviewer queue
@@ -759,6 +761,7 @@ def get_pr_guidance(reviewer: str, pr_author: str) -> str:
759761
760762
Other commands:
761763
- `{BOT_MENTION} /claim` - Claim this review for yourself
764+
- `{BOT_MENTION} /rectify` - Reconcile this issue/PR review state from GitHub
762765
- `{BOT_MENTION} /label +label-name` - Add a label
763766
- `{BOT_MENTION} /label -label-name` - Remove a label
764767
- `{BOT_MENTION} /queue` - Show reviewer queue

0 commit comments

Comments
 (0)