PR review is probably at least a little performative.

But I trust my colleagues to do good reviews when I ask them to, and to ignore my PRs when I don't. That's kind of the way we all want it.

I regularly ask for a review of specific changes by tagging them in a comment on the lines in question, with a description of the implications and a direct question that they can answer.

This, "throw the code at the wall for interpretation" style PR just seems like it's doomed to become lower priority for busy folks. You can add a fancy narrative to the comments if you like, but the root problem is that presenting a change block as-is and asking for a boolean blanket approval of the whole thing is an expensive request.

There's no substitute for shared understanding of the context and intent, and that should come out-of-band of the code in question.

For any PR above a few line change, if a developer has not done a self review, I don’t review it all.

Instead I request that it is self reviewed with context added, prior to requesting re-review.

I also tend to ask the question, “are any of these insights worth adding as comments directly to the code?”

9/10 the context they wrote down should be well thought out comments in the code itself. People are incredibly lazy sometimes, even unintentionally so. We need better lint tools to help the monkey brain perform better. I wish git platforms offered more UX friendly ways to force this kind of compliance. You can kind of fake it with CI/CD but that’s not good enough imo.

By self review, you mean that the developer adds comments in the code review tool? that is a great idea, I want to try this.

Yep. Self-reviewing your own PRs is a large boost to both yourself and the team, and often one of the first things I encourage new-ish developers to do.

- 90% of the time when you self-review your own PR, you're going to spot a bug or some incorrect assumption you made along the way. Or you'll see an opportunity to clean things up / make it better.

- Self-reviewing and annotating your reasons/thought process gives much more context to the actual reviewer, who likely only has a surface level understanding of what you're trying to do.

- It also signals to your team that you've taken the time to check your assumptions and verify you're solving the problem you say you are in the PR description.

I always review my own PR before I expect someone else to, but I generally don't add comments. I just look it over and if I see something I want to fix I fix it. Adding comments for things I specifically want feedback on or am unsure about seems like a nice addition to the process though. I might start doing that too.

Even when I worked for myself and had CodeRabbit help me do MRs, I still did a self-review before pushing any change to main.

Self-review is very, very helpful.

I thought everyone did this. I review twice. For each commit with -v and finally in GH/GL after I open the PR/MR. I often catch something on that last one.

It's rubber ducking.

I self review but I don’t write comments. I simply fix the code as I see the problems that I find self reviewing.

Unfortunately, these days, I am getting a lot of PRs where nobody has read the code, which came straight out of a robot. This makes me really angry.

What is `-v` mean here? I was assuming `git show`, but that doesn't seem to have a `-v` parameter.

`git commit` has a `-v` option that adds the diff to the bottom of the commit message template so you can see it while you write the message.

Yep!

Adding context to both your commits and your code review tools pull requests / merge requests makes everyone's lives better. Including future you, who inevitably is looking at the PR or commit in the future due to an incident caused by said change.

I have been following this personal rule for well over a decade, and have never regretted it.

I do it quite often and it's great, because it helps contextualise some changes that might not seem to be intuitive.

You could argue this is what commits are for, but given how people use GitHub and PRs, it gives some extra visibility.

And if you're going to use AI to assist you when writing the code I would argue this self-review step is 100% mandatory.

I've been doing this as part of my workflow for a few years now. My coworkers have expressed appreciation around that effort.

A nice side effect is that going through a self review and adding comments to the PR has helped me catch innumerable things that my coworkers never had to call me on.

Do you see any added value in adding the comments? I just fix the original commits and force push (each dev owns their branches at $JOB), but I'm wondering if I'm missing something?

The value I get is that it helps me catch errors before I ask others to check my work, and I use my PR comments as a teaching tool (I'm one of the seniors on the team).

I often do this. It's a great way to highlight the areas you want a reviewer to focus on, the areas you are least happy about and want some collab. You can't always get collab pre-review, as you're writing. Plus you want to write it down and move on. Then you can async edit when the feedback comes. Not unlike a prose writing process.

Yeah, I never send a PR out without reviewing each commit myself and adding GitHub comments when I think it's relevant. Sometimes a PR is clear enough that I don't feel the need to add comments, though.

I self review but I don’t add comments I just fix the problems that I find. I should add clarifying comments.

I've done this and strongly recommend.

This is a huge pet peeve of mine. At work I'm an expert on part of the code base that sees a fair number of contributions.I get many private IMs from colleagues asking me to "Approve please" or something like that with a dump of 100s of lines, of which maybe 10 lines are relevant to me (touch files or behaviour that I'm an expert on, hence why they need my approval.)

Minimally, I would like context for the change, why it required a change to this part of the codebase, and the thought process behind the change. Sometimes but not often enough I send the review back and ask them for this info.

IMO many software developers are just not fast enough at writing or language so providing an explanation for their changes is a lot of work for them. Or they are checked out and they just followed the AI or IDE until things worked, so they don't have explanations to provide. People not taking the time is what makes reviews performative.

> Minimally, I would like context for the change, …

… the why is important

> IMO many software developers … don't have explanations to provide. People not taking the time is what makes reviews performative.

… a lot of developers only consider the how.

i’ve had a lot of experiences of “once my PR is submitted that’s my work/ticket finished” kind of attitude.

i spent a year mentoring some people in a gaming community to become dev team members. one of the first things i said about PRs was — a new PR is just your first draft, there is still more work to do.

it helped these folks were brand spanking new to development and weren’t sullied by some lazy teacher somewhere.

> … the why is important > … a lot of developers only consider the how.

The why is someone else's job, so the developers should just ask them for a blurb to put in the PR for context, along with a note to the reviewer to ask that person for even more context if necessary.

I think there's a why with regard to the code. Why this "how" and not some other "how". (Why did you pick this algorithm, this pattern, this solution to the bigger business why.)

My team uses a github PR template with the following sections. Answers to each can be short yet it has been extraordinarily helpful to pass over important info to the reviewer that's not captured in code. It also borders on "checklist" that the code author has actually done the bare minimum to think things through.

# Goal (why is this change needed at all)

# What I changed and why I did it this way

# What I'm not doing here and how I'll follow up

# How I know it works (optional section, I include this only for teams with lots of very junior engs: "added a test" is often sufficient)

That's a great idea, I should do that. There is another team that does something similar but everyone complains about it (it's not as good as your template).

> IMO many software developers are just not fast enough at writing or language

I think this is the overwhelming factor, software engineering doesn't select for communication skills (and plenty of SEs will mock that as a field of study), or at least most SEs don't start out with them.

> SEs will mock that as a field of study

Who are these people? I've never encountered that. In my experience engineers who aren't great at communication freely own up to it.

[deleted]

Commit descriptions are criminally under used for this purpose. You can add so much more context if you don't limit yourself to just the short commit message.

>that should come out-of-band of the code in question.

Ideally, yes. After a decade and something' under ZIRP, seems a lot of workers never had incentive to remain conscious of their intents in context long enough to conduct productive discourse about them. Half of the people I've worked with would feel slighted not by the bitterness the previous sentence, but by its length.

There's an impedance mismatch between what actually works, and what we're expected to expect to work. That's another immediate observation which people to painfully syntaxerror much more frequently than it causes them to actually clarify context and intent.

In that case the codebase remains the canonical representation of the context and intent of all contributors, even when they're not at their best, and honestly what's so bad about that? Maybe communicating them in-band instead of out-of-band might be a degraded experience. But when out-of-band can't be established, what else is there to do?

I'd be happy to see tools that facilitate this sort of communication through code. GitHub for example is in perfect position to do something like that and they don't. Git + PRs + Projects implement the exact opposite information flow, the one whose failure modes people these days do whole conference talks about.

Exactly, if you want people to think about your code/changes you should be able to give them the needed context.

If you don't know them, please realize your code isn't automatically a gift everybody waited for, you may see it that way, but from the other side this isn't clear until someone put in the work to figure out what you did.

In short: added code produces work. So the least you should do is try reducing that work by making it easy to figure out what your code is and isn't.

Sum up what changes you made (functionally), why you made them, which choices you made (if any) and why and what the state of the PR code is in your own opinion. Maybe a reasoning why it is needed, what future maintenance may look like (ideally low). In essence, ask yourself what you'd like to know if someone appeared at the door and gave you a thumb drive with a patch for your project and add that knowledge.

Also consider to add a draft PR for bigger features early on. This way you can avoid programming things that nobody wanted, or someone else was already working on. You also give maintainers a way to steer the direction and/or decline before you put in the work.

[flagged]

[flagged]

> and to ignore my PRs when I don't

PRs should be optional, IMHO. Not all changes require peer review, and if we trust our colleagues then we should allow them to merge their branch without wasting time with performative PRs.

There is a difference between a code review and approval to merge/release.

Part of the difference is the idea you can catch all problems with piecemeal code review is nonsense, so you should have at least some sweeping QA somewhere.

I always appreciate an extra pair of eyeballs, even on a one-liner. Everyone's an idiot sometimes.

I’m firmly in this boat too. If it’s a small change I can likely get it reviewed within minutes, if it isn’t small it should have a review regardless.

Trust, but verify. We're only human after all :-)

At $DAY_JOB we need approvals from peers due to industry regulation.

In my experience, US healthcare, that box can be checked at later stages, namely deployment to production. It's a choice to add it earlier.

If it is for checking a box, sure. If it is part of a process that aspires to deliver projects with quality and with somewhat predictable release dates, that seems way too late, imho.

And a great way to end up leaking customer data from a SQL injection or other error that could have easily been caught during a more piece-wise analysis and vetting of the related code nearer to time of writing.

Sadly it often is box checking, code review or not. I'm only stating that there is no requirement in US healthcare that I'm aware of that requires approvals before merging code. Maybe that's not true in other industries. But most regulatory frameworks that I'm aware of are flexible, ambiguous, on implementation details by design.

If you find that outcomes are the same by making approvals optional at that stage, then do so with accompanied justification.

Yes! I once read a great article I can no longer find that talked about 3 types of PRs. Simple ones that you self approve. Ones that you tag someone because you want to spread the knowledge of what has been done. And ones that need actual review. Everything being reviewed is simply unnecessary and exhausting.

SOX compliance audit looks suspiciously at this comment.

No single person being able to make changes to a system is a tenant of that.