Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to reflect best practices for PR review #220

Merged
merged 26 commits into from
Jan 26, 2024
Merged

Conversation

trmartin4
Copy link
Member

@trmartin4 trmartin4 commented Oct 27, 2023

Objective

With the addition of CODEOWNERS and the maturation of the component teams, I felt it would be good to clarify the expectations around PR authors and reviewers.

These updates include some changes to the contract between PR author and reviewers, namely with the expectation that PR reviews should take place with 24 hours and that Github notifications should be the primary source of review requests. These have come from a running list that I've been compiling with pain points in our current process, gathered from retros and from other meetings.

I'd welcome any feedback and clarifications on this, as I'd like this PR to serve as a prompt for discussion prior to implementing any of these process changes. If agreed upon, I plan to update the teams in Slack as well to clarify and answer any questions.

@trmartin4 trmartin4 requested a review from a team as a code owner October 27, 2023 20:27
@trmartin4 trmartin4 marked this pull request as draft October 27, 2023 20:28
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 27, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 815208e
Status: ✅  Deploy successful!
Preview URL: https://6b2b42a4.contributing-docs.pages.dev
Branch Preview URL: https://pr-review-updates.contributing-docs.pages.dev

View logs

@bitwarden-bot
Copy link

bitwarden-bot commented Oct 27, 2023

Logo
Checkmarx One – Scan Summary & Details75e59248-54fc-4fb5-a422-c42c72e534b9

No New Or Fixed Issues Found

@trmartin4 trmartin4 marked this pull request as ready for review October 27, 2023 20:36
Comment on lines 137 to 147
To ensure that teams within the organization operate on same set of assumptions for performing
reviews, we have agreed to a baseline set of expectations.

When a PR author opens a PR for review, they should have the expectation that:

- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
- The reviewing team(s) will respond within **24 hours** to:
- Provide a review,
- Inform the author when a review will be provided, or
- Ask the author to split the work into a smaller PR for review
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the team agreed to a 24 hour PR review deadline? I haven't seen any discussion about this, but I may have missed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to my knowledge. I'm not against this though but it should be communicated.

I also think we need to spend further effort to clean up tech-leads codeowners since I haven't found a way to exclude them from review filters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I wanted to discuss here and then communicate in a bulleted list to the teams in Slack. This felt like a good place to start the discussion. I’m not in any way pushing for 24 - if we want to have a longer timeframe that’s fine. My main concern is having everyone bought in on what the timeframe is so we don’t have to resort to pinging on Slack for every PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "business day"? I personally feel one day is actually pretty tough unless engineers can be in formal support rotations and have this as a priority.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what would be a reasonable deadline here, although I agree 1 business day is tight. 2 business days?

This is not a very visible place for discussion and this would be a fairly major change to the current expectations, I suggest sharing in Slack.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion with Tech Leads and EMs, we settled on 48 hours. I've addressed that in 3131dcf

@@ -1,4 +1,5 @@
---
sidebar_position: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we setting sidebar positions on these? Do we dislike the alphabetical ordering?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't ordering alphabetically before - the positions are to order it alphabetically. I'll take them out and double-check that I'm correct in that statement.

Comment on lines 82 to 87
We shouldn’t hesitate to use this status. However, it does come with obligations for the reviewer.
By blocking the PR from progressing, they have taken an ownership stake in it and should make
themselves available to answer clarifying questions. They should also give clear feedback on what
needs to change for the PR to get approved. Likewise, a PR author should not be discouraged by a
request for changes, it's simply an indication that changes should be made prior to the PR being
merged. This is common.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that every review comes with this obligations. I'm worried this might associate request changes negatively.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Not sure why this language change does anything more than expect the reviewer to stay engaged.

I too want to be sure "request changes" is taken very objectively.

Copy link
Member

@Hinton Hinton Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"However, it does come with obligations for the reviewer. By blocking the PR from progressing, they have taken an ownership stake in it and should make themselves available to answer clarifying questions. They should also give clear feedback on what needs to change for the PR to get approved."

Leaving any review usually comes with these obligations. I would prefer to see this lifted into some general section. I do think we can highlight that request changes blocks the PR from moving.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to bridge this distinction with the changes I just pushed - I added a section at the top of the "Reviewing" section that applies to all types of review, and changed this section to indicate that "additional responsibility" is implied by blocking the PR. Let me know how that looks.

Comment on lines 106 to 107
Once a community PRs has been created, they will be automatically be linked to an internal Jira ticket. The
internal ticket is used for prioritization and tracking purposes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this was inlined before was to get it in the same sentence. Just wanted to verify this is an intentional change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's back to the way it was now. I had separated it out so that the tags were clearer, but I do see that it flows better as a single paragraph.


</bitwarden>

## Reviewing the pull request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to leave a note somewhere about re-requesting review once the feedback is resolved? I've noticed it's sometimes not done which delays new reviews.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also support. This helps a lot, especially when many teams are involved in a review.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a section called "Addressing feedback" that includes this, as well as a recommendation to allow the commenter to "Resolve conversation" - if that's not our position I can remove that part.

Comment on lines +142 to +143
- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would want us to document some available integrations, and give teams a chance to start using them, before actively enforcing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy link on more info: https://docs.github.com/en/enterprise-cloud@latest/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team

I don't know if we need anything more than what GitHub provides. Maybe Slack reminders?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get 30+ notifications daily which makes GH notifications mostly unusable without spending a non trivial amount of time maintaining it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a section for this:
image.

My assumption was that the build-in reminder integration with Slack was sufficient and we didn't need to customize anything, but that may not be the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that removing tech-leads as the default reviewer should help with notification overload.

Copy link
Contributor

@withinfocus withinfocus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objectively requesting changes, with some subjectivity on comma usage included 😜!

While we mostly use an asynchronous review process, please don't hesitate to schedule a meeting with
the author to discuss the changes. While asynchronous communication can be useful, it incurs a time
penalty which can drag out the review process. Sometimes setting up a short call to discuss the
changes can potentially save a lot of time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
changes can potentially save a lot of time.
changes can save a lot of time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed with the latest set of commits.

Comment on lines 82 to 87
We shouldn’t hesitate to use this status. However, it does come with obligations for the reviewer.
By blocking the PR from progressing, they have taken an ownership stake in it and should make
themselves available to answer clarifying questions. They should also give clear feedback on what
needs to change for the PR to get approved. Likewise, a PR author should not be discouraged by a
request for changes, it's simply an indication that changes should be made prior to the PR being
merged. This is common.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Not sure why this language change does anything more than expect the reviewer to stay engaged.

I too want to be sure "request changes" is taken very objectively.

@@ -113,6 +140,7 @@ a time.
- Does the PR change the areas you expect to be changed?
- Are any missing?
- Are any present you didn't expect?
- Are there unit tests present?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Are there unit tests present?
- Are unit tests present?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest commits.


<community>
Once a community PRs has been created, they will be automatically be linked to an internal Jira ticket. The
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once a community PRs has been created, they will be automatically be linked to an internal Jira ticket. The
Once a community PR has been created, it will be automatically be linked to an internal Jira ticket. The

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest commits.

Comment on lines +142 to +143
- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy link on more info: https://docs.github.com/en/enterprise-cloud@latest/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team

I don't know if we need anything more than what GitHub provides. Maybe Slack reminders?

Comment on lines 137 to 147
To ensure that teams within the organization operate on same set of assumptions for performing
reviews, we have agreed to a baseline set of expectations.

When a PR author opens a PR for review, they should have the expectation that:

- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
- The reviewing team(s) will respond within **24 hours** to:
- Provide a review,
- Inform the author when a review will be provided, or
- Ask the author to split the work into a smaller PR for review
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "business day"? I personally feel one day is actually pretty tough unless engineers can be in formal support rotations and have this as a priority.

:::info Follow-up notification

If there is no response to a request for review in 24 hours, the author should reach out to the
team(s) - or to individual engineers if assigned - via Slack to follow up.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
team(s) - or to individual engineers if assigned - via Slack to follow up.
team(s) -- or to individual engineers if assigned -- via Slack to follow up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest commits.

If there is no response to a request for review in 24 hours, the author should reach out to the
team(s) - or to individual engineers if assigned - via Slack to follow up.

This should wait for 24 hours to allow the default process to take place and not overwhelm the team
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Other thread will potentially need updating here too.


</bitwarden>

<community>

Once a Community PR has been created, a Bitwarden developer will perform a code review. While we try
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once a Community PR has been created, a Bitwarden developer will perform a code review. While we try
Once a Community PR has been created a Bitwarden developer will perform a code review. While we try

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest commits.

@trmartin4
Copy link
Member Author

Thank you @Hinton, @eliykat, and @withinfocus for the feedback!

I've made some adjustments to the more trivial changes, but I feel there are a few larger outstanding items:

  1. Timeframe: What is an acceptable timeframe to expect a reviewing team to perform the review before following up? My initial off-the-cuff proposal was 24 hours, but this needs further discussion.
  2. Notifications: Are the OOTB scheduled reminders from Github sufficient to give teams the visibility they need for open PRs?
  3. Conventional Comments: What do we want to stay about conventional comments? If it would be easier I can leave that section out, as it's something I assumed there was agreement on and didn't mean to divert the larger goal of this PR.

Without objections, I can raise these 3 questions to the larger group via Slack.

Copy link
Contributor

@withinfocus withinfocus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the preview working for others? It seems to not have these changes for me. On the open topics:

  1. Could we suggest "2-3 business days"? Feels like a middle ground for sometime in a business week to keep progress going.
  2. I feel they are and never had anything more than a Slack integration and email where it worked for much larger organizations.
  3. I suggest we leave it out. I feel there's a lot of disagreement over how much to prescribe on PR comments.

My remaining comments are super-minor.

We've written up some [guidelines](./code-review.md) for reviewing code, which we recommend reading
before performing your first code review.

[user reminders]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ I didn't know these links could have spaces in them and they're usually shorthand, but if it works ...

- The reviewing team(s) will respond within **24 hours** to:
- Provide a review,
- Inform the author when a review will be provided, or
- Ask the author to split the work into a smaller PR for review
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This line needs to be expanded upon and supported by a section informing the author on how to create PRs for an intended change. This could be added to the branching document and linked here.

I think this is the primary reason for our large PR backlog. My recommendation would be limiting PRs to 1000 loc and preferring config or software feature flagging to allow for incomplete features to be present in the codebase.

Suggested change
- Ask the author to split the work into a smaller PR for review
- Ask the author to split the work into a smaller PR for review. Suggest reasonable axes to on which to divide the work (see [branching for large features](#link-to-new-section)

Copy link
Member Author

@trmartin4 trmartin4 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MGibson1, I've addressed this by completely revamping the branching page, in 440c84d. As we are moving closer to a trunk-based branching scheme, with the preference toward merging to master, I felt that it was better to focus on how to build small, incremental changes and not detail the complex branching scenarios we had to handle previously around Short-Lived Feature Branches and Long-Lived Feature Branches. I'd welcome any feedback on it, especially on ways to think about breaking up work - that was very much my attempt at condensing feedback and adding intuition to it to come up with some ideas.

I also thought that something like this might be nice to have: https://github.com/marketplace/actions/pull-request-size-labeler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you nailed it, thank you.

I'm not really that convinced that the labels would have value, but the concept certainly does. If you think that'll help encourage people to smaller bites let's do it!

trmartin4 and others added 7 commits November 5, 2023 11:08
Co-authored-by: Matt Bishop <matt@withinfocus.com>
Co-authored-by: Matt Bishop <matt@withinfocus.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Matt Bishop <matt@withinfocus.com>
withinfocus
withinfocus previously approved these changes Nov 6, 2023
Copy link
Contributor

@withinfocus withinfocus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this is at a good place for merge and to potentially make other improvements elsewhere.

@trmartin4 trmartin4 requested a review from MGibson1 November 8, 2023 23:40
MGibson1
MGibson1 previously approved these changes Nov 9, 2023
withinfocus
withinfocus previously approved these changes Nov 10, 2023
eliykat
eliykat previously approved these changes Nov 23, 2023
Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments are non-blocking, happy for you to share with the team or otherwise progress this. We can revisit these questions later if required.

Comment on lines +67 to +70
Choose **branching and merging into a long-lived feature branch** if the feature will:

- Require a single Pull Request to produce a testable, releasable change, or
- It is possible to put the changes behind a feature flag while multiple PRs are in flight.
- Require multiple pull requests to produce a testable, releasable change, **and**
- It is not possible to put the changes behind a feature flag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) Are we practicing long-lived feature branches at all any more? Is there any continued justification for them? I prefer to just have one way to do things (that is, the correct way) when possible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there is still a scenario in which large features would like to be introduced together due to either technical or product-driven considerations, but we can't put them behind a feature flag. The Vertical Vault Nav changes are an example. Perhaps I can supplement this with a follow-up PR that extracts this into a callout that highlights how it's not our current best practice?

Comment on lines +112 to +113
- You have verified that all possible changes have been
[unit tested](./../testing/unit/naming-conventions.mdx).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a major change to our current practices, which are less strict about this. This is worth highlighting when this is shared more broadly.

Comment on lines +136 to +138
responding in the PR conversation thread. You are not responsible for resolving the conversation --
that is the prerogative of the reviewer, to ensure that they agree that the question or concern has
been addressed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a significant clarification (different people do different things at the moment) - would like this highlighted when these changes are shared

Comment on lines +142 to +143
- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that removing tech-leads as the default reviewer should help with notification overload.


- The act of opening the PR for review is the **only** notification required. Teams are responsible
for properly configuring notifications so that team members are aware of their obligations.
- The reviewing team(s) will respond within **48 hours** to:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is going to be shared for discussion, but my 2 cents: I would prefer this be expressed in business days rather than hours. e.g. you cannot (should not) review code on public holidays or weekends.

2 business days seems fine to me as a starting point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been addressed with 97745a9 (#220).

@MGibson1
Copy link
Member

@trmartin4 are you still working on this improvement?

@trmartin4
Copy link
Member Author

trmartin4 commented Jan 25, 2024

@MGibson1 yes, actually I had this in my To Do list and it's been surpassed by some other things that have come up.

My next steps were to consolidate all the items that require highlighting as a significant change to our current process, and publish this change along with a notification in Slack. My current list of those updates are:

  • Highlight the importance of unit tests for PR approval
  • Establish the best practice that the originator of the comment thread should mark it Resolved, rather than the author
  • The contract between the teams is that the reviewing team should act on the Github notification (through their configured notification method) and not rely on Slack posts

Am I missing anything else?

@trmartin4 trmartin4 dismissed stale reviews from eliykat and withinfocus via 760b5b8 January 25, 2024 19:48
Copy link
Contributor

@withinfocus withinfocus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My requests have long been solved.

Your main branch rename is probably in 500 other places ...

@trmartin4
Copy link
Member Author

Your main branch rename is probably in 500 other places ...

@withinfocus these should already have been fixed in main. I just had to adjust the references in the part of the docs that had merge conflicts with my changes.

@trmartin4 trmartin4 merged commit 7237f18 into main Jan 26, 2024
3 checks passed
@trmartin4 trmartin4 deleted the pr-review-updates branch January 26, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants