Journal logo

The Pull Request That Looked Perfect, and the Four Questions That Would Have Caught It

When AI tools draft most of the code, a polished change can hide the very problems a reviewer is there to find, so here is what to ask instead.

By Ashkan RajaeePublished about 16 hours ago • 4 min read
1
The Pull Request That Looked Perfect, and the Four Questions That Would Have Caught It
Photo by James Harrison on Unsplash

Note: This story was written with AI assistance and edited by me.

Note: An earlier version of this piece, "Code Review Standards When Half the Code Is AI-Assisted," was published on DEV.

Picture a senior engineer I will call Dana. This is a made-up composite, not a real person. Dana has reviewed code for years and has a good eye for trouble. Lately, though, something feels off. The pull requests in her queue all look polished. Variable names are sensible, comments are neat, tests are green. She approves most of them with a light touch. Then one of those tidy changes breaks something for a customer, and when she rereads it, she realizes the problem was never in what the code said. It was in what the code left out.

Earlier in my career, as a partner, I helped grow a software consulting company from about $6M to $60M in under three years, and later I founded and ran a fully remote consultancy. Reviews were one of the places where a team either protected its reputation with clients or quietly spent it, and I have been thinking about how that job changes now that machines draft so much of the code.

Polish Used to Mean Something

For a long time, the surface of a change told you a lot. Rushed work looked rushed. An engineer who did not understand a library tended to use it awkwardly, and the awkwardness drew your eye. Reviewers built instincts around those clues without ever writing them down.

When an AI assistant writes the first draft, the clues disappear. The output reads smoothly whether it is right or wrong. It can answer a question that is close to the one in the ticket but not quite the same. And the person who opened the pull request may have accepted a block of suggestions without tracing through every branch.

That does not make the code bad. It means the reviewer can no longer let appearance decide where to look.

Four Questions I Would Put on Every Review

When I think about reviewing AI-generated code, I keep coming back to four questions. None is new on its own. What changes is that they stop being optional.

Is this what we actually asked for? Open the ticket before opening the diff. Compare the two. Assistants are generous, and they often add things: an extra parameter, a fallback path, a query that fetches more than it needs. Every unrequested addition is future maintenance. I also like asking the author for a few sentences, in their own voice, explaining the change. If they struggle to explain a part, that part needs more work before anyone approves it.

What happens on a bad day? Smooth code usually handles the expected case well. Spend your time on the unexpected ones. What if the field is blank? What if two people save at the same moment? What if the third step of a five-step update fails? What about a date that falls right on a boundary? For each piece that matters, name the nastiest realistic input and find the line that deals with it.

What does this code trust? Follow outside data from where it enters to where it is used. Check that it gets validated, that database access is parameterized, that permission checks live on the server, and that nothing sensitive ends up in logs or error messages. Pay special attention to new packages. An assistant may pull in a library that looks fine but that nobody on the team chose on purpose. Someone should be able to say why it belongs there.

Would these tests catch a real mistake? Generated tests are easy to come by and easy to overrate. Some only confirm that the code does what the code does. A good test fails when the behavior breaks. Look for tests on the awkward inputs, not just the friendly ones, and ask questions when existing tests were edited to fit new behavior.

Not Letting the Queue Pile Up

There is a catch. If writing code gets faster and reviewing it gets more demanding, the review queue becomes the place where everything waits. A few habits help.

Keep changes small enough to read in one sitting, even when the tool could happily produce something huge. Ask authors to answer the four questions themselves before requesting review, so reviewers confirm the thinking instead of doing it all. Hand formatting and lint rules to automation. And agree, as a team, which parts of the system always deserve a second pair of eyes: sign-in, money, deleting data, personal information. A typo fix on a help page does not need the same scrutiny.

Back to Dana

Now imagine Dana's team adopts those four questions. A new change arrives that adds a way for users to download their records. It looks clean. Dana reads the ticket first: users should be able to download their own records. The code filters by organization instead of by person, so anyone in the organization could pull everyone else's data. The tests only used a single-person organization, so they passed. The fix is quick. The difference is that it gets caught on Tuesday instead of being reported by a customer.

The Limits

None of this replaces thoughtful design or engineers who know the system. Review will never catch everything, and it should not turn into suspicion of colleagues who use these tools well. The point is modest: every line that ships should be understood by someone willing to stand behind it.

Expect some friction at first. The new questions take time until they become routine.

One Small Experiment

Try it on the next pull request you review. Before reading the code, read the ticket. Then ask the four questions: is this what we asked for, what happens on a bad day, what does it trust, and would the tests catch a real mistake. Notice how many of your comments come from those questions rather than from style. That count will tell you more about your review process than any policy document.

workflowcareerbusinessindustry

About the Creator

Ashkan Rajaee

Enjoyed the story? Support the Creator.

Subscribe for free to receive all their stories in your feed.

Subscribe For Free

Reader insights

Share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment
    Written by Ashkan Rajaee
    1