Reviewing Zulip code

Code review is a key part of how Zulip does development! If you've been contributing to Zulip's code, we'd love for you to do reviews. This is a guide to how. (With some thoughts for writing code too.)

Protocol for authors

When you send a PR, try to think of a good person to review it -- outside of the handful of people who do a ton of reviews -- and @-mention them with something like "@person, would you review this?". Good choices include * someone based in your timezone or a nearby timezone * people working on similar things, or in a loosely related area

Alternatively, posting a message in #code-review on the Zulip development community server, would help in reaching out to a wider group of reviewers. Either way, please be patient and mindful of the fact that it isn't possible to provide a quick reply always, but that the reviewer would get to it sooner or later. Lastly, ensuring the your PR passes CI and is organized into coherent commits would help save reviewers time, which could otherwise be used to dive right into reviewing the PR's core functionality.

Responding to a review feedback

Once you've received a review and resolved any feedback, it's critical to update the GitHub thread to reflect that. Best practices are to:

If you resolve the feedback, but the PR has merge conflicts, CI failures, or the most recent comment is the reviewer asking you to fix something, it's very likely that a potential reviewer skimming your PR will assume it isn't ready for review and move on to other work.

If you need help or think an open discussion topic requires more feedback or a more complex discussion, move the discussion to a topic in the Zulip development community server. Be sure to provide links from the GitHub PR to the conversation (and vice versa) so that it's convenient to read both conversations together.

Principles of code review

Anyone can review

Anyone can do a code review -- you don't have to have a ton of experience, and you don't have to have the power to ultimately merge the PR. If you

those are really helpful contributions.

Please do reviews

Doing code reviews is an important part of making the project grow. It's also an important skill to develop for participating in open-source projects and working in the industry in general. If you're contributing to Zulip and have been working in our code for a little while, we would love for some of your time contributing to come in the form of doing code reviews!

For students participating in Google Summer of Code or a similar program, we expect you to spend a chunk of your time each week (after the first couple of weeks as you're getting going) doing code reviews.

Fast replies are key

For the author of a PR, getting feedback quickly is really important for making progress quickly and staying productive. That means that if you get @-mentioned on a PR with a request for you to review it, it helps the author a lot if you reply promptly.

A reply doesn't even have to be a full review; if a PR is big or if you're pressed for time, then just getting some kind of reply in quickly -- initial thoughts, feedback on the general direction, or just saying you're busy and when you'll have time to look harder -- is still really valuable for the author and for anyone else who might review the PR.

People in the Zulip project live and work in many timezones, and code reviewers also need focused chunks of time to write code and do other things, so an immediate reply isn't always possible. But a good benchmark is to try to always reply within one workday, at least with a short initial reply, if you're working regularly on Zulip. And sooner is better.

Things to look for

Zulip server

Some points specific to the Zulip server codebase:

Tooling

To make it easier to review pull requests, if you're working in the Zulip server codebase, use our git tool tools/fetch-rebase-pull-request to check out a pull request locally and rebase it against master.

If a pull request just needs a little fixing to make it mergeable, feel free to do that in a new commit, then push your branch to GitHub and mention the branch in a comment on the pull request. That'll save the maintainer time and get the PR merged quicker.

Additional resources

We also strongly recommend reviewers to go through the following resources.