How do we auto-approve and merge 60% of PRs?

I'm still drowning in code review. Getting to ~16% auto-approved and merged PRs helped but it's not enough. How can we do 60%? πŸ€”

I don't think 100% is feasible.

Some things are high risk, need coordinated deploys, or just more feedback before they're ready. And you wouldn't want to miss the mentoring opportunity with more junior team members.

But a lot of code is ... just not that important.

Not everything needs review

Small UI changes don't need review. Trust your engineers to have taste, ship fast, and the UI will stabilize soon. Think evolution instead of careful upfront design. Nothing beats using your software and talking to users for the final 10% polish.

The caveat is you have to give people the ownership and space to keep iterating on that final 10% of polish. When they say "This sucks I wanna fix it", say yes.

Big bets on self-contained features also don't need code review. You don't even know if this is a good feature yet! Why spend hours reviewing code you might delete tomorrow?

Create a working prototype, see how it feels to use, then decide from there. Nobody wants to read the 2000 lines of slop it takes to build the first experimental prototype.

The caveat is that you have to give people the ownership and space to go back and fix the slop as features prove themselves. Don't refactor code for the lulz but do spend time making it better as you work.

Ideally you can watch people work and have quick followup with tight feedback loops. Ship the feature, see what people think, make it better.

These days I care about code last

The main feedback you want is feature review from your users. It doesn't matter if Ms Grumpy Principal Engineer likes your module structure. You can fix the code later iff the feature works for your users.

I regularly find myself prompting agents (and humans) to build a feature, then we test and verify the outcome – yes manual testing – and look at the code when everything works right. Not worth looking at code until you like the outcome.

Then I look at the code, fix anything that needs fixing, and add reviewers. By now code review is often a rubber stamp. If you review your agents' code, understand what it's doing, and prove the feature works as intended, what value does bothering a person provide? πŸ€”

Hoist review up a level

On my team, I'm trying to hoist review up a level. How do we rubber stamp more PRs then automate the process?

Here's what I care about:

You can't infer any of this from reading the code. You have to hold working software in your hands and talk to users and each other.

Code review then mostly becomes about finding desire paths in our architecture so we can build tools for common problems and looking for common mistakes so we can build custom linters and automate review. I like linters because they're fast and because agents run linters while working and never commit the bad code. It's great.

So what would it take to auto-approve almost everything

When humans review the input (design docs, architecture, definition of done) and output (how it feels to use), agents are now pretty reliable at writing the code. When I have a bad time it's usually because I'm asking for something based on faulty assumptions and the clanker tries to bend over backwards to accommodate instead of pushing back.

For example, I find that asking for code improvements or simple fixes after I've tested a feature no longer requires re-testing. I can trust that behavior stayed the same.

This is huge.

Right now our auto-approve + merge bot is conservative. It won't merge anything that touches migrations, public interfaces, or finance. And it avoids merging mid and high risk changes (as tagged by bugbot or a human).

After human approval it merges mid-risk changes unless there are comments. This has worked well but we need to shift left and make more PRs feel low risk.

A rough roadmap, I'm thinking out loud:

You get a 3 stage review process

You end up with a 3 stage review process:

  1. Before implementation Engineers + Stakeholders review architecture, constraints, and product direction
  2. During implementation Agents + automated checks review correctness, contracts, conventions, and safety
  3. After implementation Engineers + users review actual behavior, UX, and usefulness

And there's an opportunity here to leave non-critical checks for later (swarm of testing agents maybe?) with a multi-phase testing approach. You don't need every change to be perfect and pass all tests if you can followup quickly with a fix πŸ€”

Thanks for listening, I'll report back when we try these things. Are you on this path? Hit reply

Cheers,
~Swizec

Filed under: Software EngineeringTeamworkAI

Liked this article? You’ll love the book