Dealing With Huge Pull Requests

It’s that time of day, code review time, every engineer’s favorite time. You check the list of assigned reviews and there it is, the whale. That 1,000 line long pull request that someone has been keeping to themselves all week. Things aren’t looking good, realistically you’re not going to sit there and pore over every line, because your code review hour will turn into code review day and probably spill over into next week.

So what do you do?

“Looks good to me.” Accept

Another way to handle it is to be that person that says, no, you can’t expect me to read over your huge new feature and think everything is going to be ok because now we’re sharing the blame if — when something goes wrong. Of course you’re not a jerk. You could instead ask for the coder to split up their feature into bite sized chunks, 140 lines each? Now that’s doable.

If you take another step back and look at the process as a whole, you both could have avoided all of that unpleasantness if you both said yeah we’re tired of long running feature branches, lets use feature flags and submit PRs as soon as the MVF (minimum viable feature) is ready. I bet you the minimum amount of code to push that feature which may or may not be in a fully working state behind a flag is much, much less than 1,000 lines. Of course this new process isn’t without problems, how do you manage those feature flags? Aren’t you introducing technical debt with all of those if statements everywhere?

The first answer is… use the project I’ve been working on, checkered (a hosted version is coming soon). It lists out the flags you’re using in each of your apps (and you can use the same flag across apps). It will also do nifty things like have your whole team manage them and it will show you who is flipping things on and off for which percentage of users.

The second answer is, yes you are introducing technical debt, but luckily checkered can save you there too. It will send you an email when a flag has been on for 100% of users for 30 days. So never forget to delete that old unused code again, and never have to deal with huge pull requests, there is a better way!

I’m making checkered, an open source project to help manage feature flags in your app, be sure to star it and watch for the client libraries for your favorite language, coming soon!