1*6af4303aSJamey Sharp# Code Review 2*6af4303aSJamey Sharp 3*6af4303aSJamey SharpWe only merge changes submitted as GitHub Pull Requests, and only after they've 4*6af4303aSJamey Sharpbeen approved by at least one Core Team reviewer who did not author the PR. This 5*6af4303aSJamey Sharpsection covers expectations for the people performing those reviews. These 6*6af4303aSJamey Sharpguidelines are in addition to expectations which apply to everyone in the 7*6af4303aSJamey Sharpcommunity, such as following the Code of Conduct. 8*6af4303aSJamey Sharp 9*6af4303aSJamey SharpIt is our goal to respond to every contribution in a timely fashion. Although we 10*6af4303aSJamey Sharpmake no guarantees, we aim to usually provide some kind of response within about 11*6af4303aSJamey Sharpone business day. 12*6af4303aSJamey Sharp 13*6af4303aSJamey SharpThat's important because we appreciate all the contributions we receive, made by 14*6af4303aSJamey Sharpa diverse collection of people from all over the world. One way to show our 15*6af4303aSJamey Sharpappreciation, and our respect for the effort that goes into contributing to this 16*6af4303aSJamey Sharpproject, is by not keeping contributors waiting. It's no fun to submit a pull 17*6af4303aSJamey Sharprequest and then sit around wondering if anyone is ever going to look at it. 18*6af4303aSJamey Sharp 19*6af4303aSJamey SharpThat does not mean we will review every PR promptly, let alone merge them. Some 20*6af4303aSJamey Sharpcontributions have needed weeks of discussion and changes before they were ready 21*6af4303aSJamey Sharpto merge. For some other contributions, we've had to conclude that we could not 22*6af4303aSJamey Sharpmerge them, no matter how much we appreciate the effort that went into them. 23*6af4303aSJamey Sharp 24*6af4303aSJamey SharpWhat this does mean is that we will communicate with each contributor to set 25*6af4303aSJamey Sharpexpectations around the review process. Some examples of good communication are: 26*6af4303aSJamey Sharp 27*6af4303aSJamey Sharp- "I intend to review this but I can't yet. Please leave me a message if I 28*6af4303aSJamey Sharp haven't responded by (a specific date in the near future)." 29*6af4303aSJamey Sharp 30*6af4303aSJamey Sharp- "I think (a specific other contributor) should review this." 31*6af4303aSJamey Sharp 32*6af4303aSJamey Sharp- "I'm having difficulty reviewing this PR because of (a specific reason, if 33*6af4303aSJamey Sharp it's something the contributor might reasonably be able to help with). Are you 34*6af4303aSJamey Sharp able to change that? If not, I'll ask my colleagues for help (or some other 35*6af4303aSJamey Sharp concrete resolution)." 36*6af4303aSJamey Sharp 37*6af4303aSJamey SharpIf you are able to quickly review the PR, of course, you can just do that. 38*6af4303aSJamey Sharp 39*6af4303aSJamey SharpYou can find open Wasmtime pull requests for which your review has been 40*6af4303aSJamey Sharprequested with this search: 41*6af4303aSJamey Sharp 42*6af4303aSJamey Sharp<https://github.com/bytecodealliance/wasmtime/pulls?q=is:open+type:pr+user-review-requested:@me> 43*6af4303aSJamey Sharp 44*6af4303aSJamey Sharp## Auto-assigned reviewers 45*6af4303aSJamey Sharp 46*6af4303aSJamey SharpWe automatically assign a reviewer to every newly opened pull request. We do 47*6af4303aSJamey Sharpthis to avoid the problem of diffusion of responsibility, where everyone thinks 48*6af4303aSJamey Sharpsomebody else will respond to the PR, so nobody does. 49*6af4303aSJamey Sharp 50*6af4303aSJamey SharpTo be in the pool of auto-assigned reviewers, a Core Team member must commit to 51*6af4303aSJamey Sharpfollowing the above goals and guidelines around communicating in a timely 52*6af4303aSJamey Sharpfashion. 53*6af4303aSJamey Sharp 54*6af4303aSJamey SharpWe don't ask everyone to make this commitment. In particular, we don't believe 55*6af4303aSJamey Sharpit's fair to expect quick responses from unpaid contributors, although we 56*6af4303aSJamey Sharpgratefully accept any review work they do have time to contribute. 57*6af4303aSJamey Sharp 58*6af4303aSJamey SharpIf you are in the auto-assignment pool, remember: **You are not necessarily 59*6af4303aSJamey Sharpexpected to review the pull requests which are assigned to you.** Your only 60*6af4303aSJamey Sharpresponsibility is to ensure that contributors know what to expect from us, and 61*6af4303aSJamey Sharpto arrange that _somebody_ reviews each PR. 62*6af4303aSJamey Sharp 63*6af4303aSJamey SharpWe have several different teams that reviewers may be auto-assigned from. You 64*6af4303aSJamey Sharpshould be in teams where you are likely to know who to re-assign a PR to, if you 65*6af4303aSJamey Sharpcan't review it yourself. The teams are determined by the `CODEOWNERS` file at 66*6af4303aSJamey Sharpthe root of the Wasmtime repository. But despite the name, membership in these 67*6af4303aSJamey Sharpteams is _not_ about who is an authority or "owner" in a particular area. So 68*6af4303aSJamey Sharprather than creating a team for each fine-grained division in the repository 69*6af4303aSJamey Sharpsuch as individual target architectures or WASI extensions, we use a few 70*6af4303aSJamey Sharpcoarse-grained teams: 71*6af4303aSJamey Sharp 72*6af4303aSJamey Sharp- [wasmtime-compiler-reviewers][]: Cranelift and Winch 73*6af4303aSJamey Sharp- [wasmtime-core-reviewers][]: Wasmtime, including WASI 74*6af4303aSJamey Sharp- [wasmtime-fuzz-reviewers][]: Fuzz testing targets 75*6af4303aSJamey Sharp- [wasmtime-default-reviewers][]: Anything else, including CI and documentation 76*6af4303aSJamey Sharp 77*6af4303aSJamey Sharp[wasmtime-compiler-reviewers]: https://github.com/orgs/bytecodealliance/teams/wasmtime-compiler-reviewers 78*6af4303aSJamey Sharp[wasmtime-core-reviewers]: https://github.com/orgs/bytecodealliance/teams/wasmtime-core-reviewers 79*6af4303aSJamey Sharp[wasmtime-fuzz-reviewers]: https://github.com/orgs/bytecodealliance/teams/wasmtime-fuzz-reviewers 80*6af4303aSJamey Sharp[wasmtime-default-reviewers]: https://github.com/orgs/bytecodealliance/teams/wasmtime-default-reviewers 81*6af4303aSJamey Sharp 82*6af4303aSJamey SharpIdeally, auto-assigned reviewers should be attending the regular Wasmtime or 83*6af4303aSJamey SharpCranelift meetings, as appropriate for the areas they're reviewing. This is to 84*6af4303aSJamey Sharphelp these reviewers stay aware of who is working on what, to more easily hand 85*6af4303aSJamey Sharpoff PRs to the most relevant reviewer for the work. However, this is only 86*6af4303aSJamey Sharpadvice, not a hard requirement. 87*6af4303aSJamey Sharp 88*6af4303aSJamey SharpIf you are not sure who to hand off a PR review to, you can look at GitHub's 89*6af4303aSJamey Sharpsuggestions for reviewers, or look at `git log` for the paths that the PR 90*6af4303aSJamey Sharpaffects. You can also just ask other Core Team members for advice. 91*6af4303aSJamey Sharp 92*6af4303aSJamey Sharp## General advice 93*6af4303aSJamey Sharp 94*6af4303aSJamey SharpThis is a collection of general advice for people who are reviewing pull 95*6af4303aSJamey Sharprequests. Feel free to take any that you find works for you and ignore the rest. 96*6af4303aSJamey SharpYou can also open pull requests to suggest more references for this section. 97*6af4303aSJamey Sharp 98*6af4303aSJamey Sharp[The Gentle Art of Patch Review][gentle-review] suggests a "Three-Phase 99*6af4303aSJamey SharpContribution Review" process: 100*6af4303aSJamey Sharp 101*6af4303aSJamey Sharp[gentle-review]: https://sage.thesharps.us/2014/09/01/the-gentle-art-of-patch-review/ 102*6af4303aSJamey Sharp 103*6af4303aSJamey Sharp1. Is the idea behind the contribution sound? 104*6af4303aSJamey Sharp2. Is the contribution architected correctly? 105*6af4303aSJamey Sharp3. Is the contribution polished? 106*6af4303aSJamey Sharp 107*6af4303aSJamey SharpPhase one should be a quick check for whether the pull request should move 108*6af4303aSJamey Sharpforward at all, or needs a significantly different approach. If it needs 109*6af4303aSJamey Sharpsignificant changes or is not going to be accepted, there's no point reviewing 110*6af4303aSJamey Sharpin detail until those issues are addressed. 111*6af4303aSJamey Sharp 112*6af4303aSJamey SharpOn the other end, it's a good idea to defer reviewing for typos or bikeshedding 113*6af4303aSJamey Sharpabout variable names until phase three. If there need to be significant 114*6af4303aSJamey Sharpstructural changes, entire paragraphs or functions might disappear, and then any 115*6af4303aSJamey Sharpminor errors that were in them won't matter. 116*6af4303aSJamey Sharp 117*6af4303aSJamey SharpThe full essay has much more advice and is recommended reading. 118