ask initial questions to understand the task described in the Github issue, which may not be clearly defined.
you can reach the team on keybase or by commenting on the Github issue.
this is not the point to discuss concrete solutions (concrete design or implementation), but only what the problem is and the desired outcome.
ask any questions related to scope of work, breakdown of tasks into subtasks and PRs.
typically this should be covered in the Github issue. If it is not, then add to the issue after discussion with code owner.
author needs to be comfortable with breakdown and scope of tasks. Scope should be small. Think about the overhead on the code reviewer when breaking down the tasks.
Research Solution
conduct research on the issue at hand. Identify point of code change and any “fallout” from the change (tip: search the codebase for consumers of the function / object, and their consumers etc., until you get to a part of the code that you are well-versed with).
author needs to become the “expert” on the part of the code being touched before submitting a code change.
If it will take you 2 more days to figure something out by reading the code or experimenting with the codebase then do it.
This is not wasted effort.
It is likely that the code reviewer would use a similar process to figure it out, but this is your job and not the code reviewer’s job.
If the process of becoming an “expert” on a specific area would take you more than 2 days then discuss this with the code reviewer if it is worth it, and proceed accordingly.
Think about what kind of tests you would want. Are you going with a black-box testing approach, or a white-box testing approach? Why?
Technical Design Discussion
PRs are not the best medium to conduct design discussions. The team is readily accessible and available so 1-1 meetings can be very effective.
This is the best avenue to discuss your ideas for how to approach the problem.
Prepare any relevant technical documentation for the design discussion and post on the Github issue and ping code owner.
This can be in the form of a google document, flowchart diagram, or in rare cases a code snippet in a Draft PR.
The Draft PR should not be reviewed by the code reviewer as part of the code change but can be used as a space to get feedback
Resulting comments on a Draft PR can capture any guidance from the technical discussion.
All Draft PRs should be discarded and never converted to a non-draft PR to avoid the overhead of comments lingering from the design discussion using the Draft PR.
Schedule technical design discussion to go over the proposed solution.
Include a list of tests you need to add, remove, modify. Consider all possibilities (tip: data related tests would require many test cases).
Implementation
implement feature or bug fix. This should be the first line of code that you write for the PR.
Avoid for loops to “autogenerate” test cases, unless absolutely necessary.
Pull Request
The first version of the PR should not have any “surprises” compared to what was discussed in the technical design.
See Handling of PRs section below for guide on how to get a PR to merged status.
Typically, this is what is expected from the author of a Pull Request:
Each PR should correspond to the smallest independent logical unit of change.
each PR should be prefixed with "bugfix", "feature", or "refactor".
refactors should never be mixed in with logic changes or bug fixes and vice-versa.
refactors that change variable names across more than 1 function should be a separate PR altogether.
Author should add inline commentary on the code changes to "guide" the reviewer on how to read the code change, highlighting key changes made.
this should typically be 2-3 places, as anything bigger is too big of a PR and should be split up.
We should aim for the following benchmarks in terms of PR efficiency:
In 60% of the cases the PR should be approved without any changes requested from the reviewer.
In 25% of the cases the reviewer should add 2-3 comments that need to be "fixed up". This is most likely a code style suggestion.
In 10% of the cases the reviewer should request a structural change to the code. These should not be "new ideas".
In <=5% of the cases the PR may be discarded because we have learned something new in the process of implementation.
Author makes requested changes.
no "new ideas" to be introduced at this stage.
no structural changes to be introduced beyond what is requested.
focus should be on minimizing "changes" beyond what is requested by reviewer.
person who created a comment / raised a question on the PR is responsible to mark it as resolved once they are satisfied. The developer should not mark questions raised by the reviewer as resolved since the reviewer uses these comments as a way to track what they are looking for in the next iteration of the review (tip: use an emoji such as the checkbox emoji to mark an inline comment as handled or addressed).
Reviewer re-reviews the code.
result of the PR should be that the PR has moved to the next stage in the review ladder described above.
this means that a PR will take a maximum of 2 review rounds to get to completion.
back to the previous step for the author to make changes based on the re-review.
Draft PRs
If there is a need to "try out the change" and get feedback, we can use a draft PR, although this should be used sparingly.
If a PR starts off in draft state then it should be used more as a "whiteboard for discussion" as opposed to the early stage of a PR.
In most cases, Draft PRs should be discarded. To avoid noise from comments, Draft PRs should be resubmitted as fresh standalone PRs instead of converting the draft PR to a regular PR.
Guidelines for submitting code to Kelp
Before Submitting a PR
Problem Identification
Research Solution
Technical Design Discussion
Implementation
Pull Request
Handling of PRs
Typically, this is what is expected from the author of a Pull Request:
Draft PRs