Going Faster Helps the Team
Pull Requests stick around for many reasons. Some are just too big, or the reviewer isn’t familiar with the context or the codebase. Sometimes reviewing and merging is thwarted by poor planning or lack of infrastructure, and often it’s just a case of poor visibility into review requests. Bottlenecks abound for Pull Requests, one of the most common being the code review.
Reviewing code quickly as a team comes with multiple benefits. Developers expand their comfort zone, the codebase becomes more robust, there’s a more frequent sense of accomplishment, and new features can be shipped faster. No matter the reasons for stuck Pull Requests, reviewing code without delay is always a good idea, and it’s always a challenge you must address as a team.
By managing the amount of work in progress and code review time, teams can significantly accelerate their Pull Request cycle times. After getting into the habit of quick code reviews, teams can expect to close 80% of Pull Requests within 48 hours, and rarely have Pull Requests older than 14 days to deal with.
Check the Current Situation
Lack of visibility is a common cause for stuck Pull Requests. Swarmia's Pull Request view gives a quick overview of what’s going on, and the charts give an idea of team throughput and bottlenecks. Just getting in a habit of checking the Pull Request view from time to time goes a long way to ensuring that Pull Requests are moving.
The above Pull Request view tells you a lot about your situation. A large number of Pull Requests in progress is often a sign of a problem, and being able to see Pull Request ages helps understand its magnitude. The graphs above your Pull Request inbox give insights about cycle time and Pull Request throughput trends over time.
💁♀️ Visit the Pull Request view regularly. It’s usually enough to check how many Pull Requests are open, and that there are no old and stale Pull Requests sitting on the shelf. Think of it as a canary in the goldmine, worth a closer look if there are apparent issues.
It’s normal that Pull requests sometimes sit for a day or two before merging, but if many of your Pull requests are weeks old, it’s time to dive deeper.
Investigate Throughput and Trends
Before jumping into Swarmia’s Working Agreements to set throughput targets for your team, it’s worth the time to investigate past performance and estimate sustainable levels of throughput going forward.
Flow Insights is a good way to take a look at the Pull Request conundrum over a longer period. By reviewing past work in progress and cycle times, you can spot trends and begin to estimate realistic targets for future throughput. Importantly, Pull Request review time is often a reliable leading indicator of total cycle time.
In the above example, it looks like median review and cycle time are quite healthy, but there are plenty of outliers with high review times and cycle times. According to the Review Times scatter plot, a handful of Pull Requests have been waiting for review for quite some time, and while there are lots of Pull Requests assigned to other teams for review, they seem to be done quickly and are not the bottleneck. Looks like there are issues with code review that are worth addressing as a team!
💁♀️ Help stakeholders understand. Improving code review time requires the team to invest some extra time and effort. Most businesspeople love the idea of going faster, so backed with data it shouldn’t be too hard to get them onboard.
Based on your team’s throughput over time, come up with an ambitious but realistic goal for Pull Request review time. Can you think of any reason why code reviews should take longer than three working days to complete? Talk it over with the team and stakeholders, and make sure to explain that reviewing code faster is a big step towards delivering features faster.
Zero in on Code Review
For most teams we see, code review is the bottleneck where progress stalls and throughput falters, making Pull Request review time a reliable leading indicator of total cycle time. Improving your team’s code review practices will go a long way towards speeding up Pull Request cycle times and improving team dynamics as a whole.
💁♀️ Start with code review. Working Agreements about Pull Requests help teams get their Pull Request game on point and to improve throughput. Code review time is usually a leading indicator of total Pull Request cycle time, so focus on that first.
To get started with improving your code review time, head over to Working Agreements and adopt a new agreement to review Pull Requests within a few working days, according to the analysis you’ve just made.
After configuring and adopting the new working agreement, outliers become clearly visible in context, exceptions from the past two weeks are spelled out, and the scatter plot highlights delays caused by cross-team collaboration.
In your next retrospective, review the list of exceptions together as a team. What made these Pull Requests so special? Getting in the habit of analyzing exceptions in retrospectives is all but guaranteed to regularly surface actionable insights about your process and lead to real improvements.
💁♀️ Review exceptions in retrospectives. Regularly going through recent exceptions to working agreements with your team is a great way to uncover insights about what’s holding you back and to systematically improve your review habits.
While it’s important to analyze the reasons behind stuck Pull Requests in retrospect for systemic improvement, identifying and addressing problems right away can have an immediate impact on cycle times. Swarmia’s Slack notifications help your team preempt delays by increasing the team’s visibility into review requests, and detect problems as soon as they occur.
💁♀️ Remember to talk with the team. Don’t forget to talk with your team and agree that this is a problem you are committed to solving before setting up Slack notifications. Regular broadcasts about Pull Requests and other work in progress can feel more disruptive than useful if they start arriving on the team’s channel suddenly and without explanation.
Encouraging team members to connect their personal Slack accounts, as well as connecting your team’s Slack channel in Swarmia, are great ways to increase visibility into review requests. When a review is requested from the team or an individual, Swarmia sends a notification either to the team’s channel or as a direct message.
To avoid redundant notifications, the original message is simply stricken through after the review is completed and the Pull Request is merged.
💁♀️ Take full advantage of GitHub. To ensure that review requests don’t fall through the cracks, set up code owners for your repositories. Use GitHub’s draft pull request feature to clearly identify work in progress where actual code review is not yet called for.
Despite increased visibility, delays in reviews are bound to happen. To catch problems as they occur, set up the daily Slack digest for your team to understand what’s in progress, which Pull Requests need attention, and get timely feedback about working agreements that are slipping.
Exceptions in the Slack digest are your cue to revisit the Pull Request view, check which Pull Requests are problematic and have a short conversation as a team about what’s actually going on. Often getting unstuck is as simple as properly assigning the task or asking a quick question!
When it looks like you’re consistently hitting your code review targets, it’s a good idea to dive deeper into the Pull Request cycle time, and to explore issues of focus and work in progress. One good discussion to have with the team is around limiting the amount of Pull Requests in progress at a given time, for which there is its own Working Agreement, as well as setting targets for Pull Request cycle time as a whole.
As you go on, the conversations you will have about exceptions as a team will help you surface all manner of improvements and spur you along on the path of continuous improvement. Good luck!