Pull Requests
What are the goals of a PR? π
Goals in order of importance:
- Ensure correctness
- Spread and share knowledge
- Improve the design
- Ensure consistency
Guide for authors π
Who do I assign as a reviewer? π
- Default to a single reviewer
- Reviewer should be selected based on:
- Knowledge of reviewer (for example, if changing code related to events, @johngallagher has done work in this area)
- Skills of reviewer (for example, @karlentwistle is skilled with performance testing)
- Use git blame and/or ask the #engineering Slack channel, if youβre unsure
- If other developers have more knowledge than the reviewer, the reviewer can pull them into the conversation
- For PRs in patterns, always assign the whole of Engineering
Timescales π
- The reviewer should give you a timescale when you can expect your PR to be reviewed.
- This means you can plan your day
- Look for a comment in the PR
Scope creep π
If you get feedback thatβs outside the scope of the ticket:
- Create another ticket. Kindly ask the reviewers to help add more details to the ticket if they are more familiar with the requirements.
- Link to the ticket in a comment then resolve the comment
What should be included in a PR? π
PRs should be small and focussed.
Make sure you include everything on the PR Checklist
Guide for reviewers π
Whatβs the mindset? π
- To check the authorβs work for correctness
- To prompt for better ways at approaching the problem
- To look at the problem through fresh eyes
- To encourage good design and progress of the codebase
- To ask for the PR to be small enough so they can productively review it
- To look for potentially missing automated tests
Timescale π
- When asked to review a PR, please let the author know when youβll be able to review it
- Send a Slack message to the author with the expectation, for example:
@authorname Iβll review this at 10am GMT Friday 13th March
Scope creep π
- If you give feedback thatβs outside the scope, bear in mind it wonβt necessarily be addressed within this PR
- The author should create a ticket for this follow-up work, post a link, and resolve the comment. You might be requested to add more details to the ticket in case youβre more familiar with its requirements.
What should be included in a PR? π
PRs should be small and focussed.
Itβs your right to ask for the PR to be broken down.
Check everything on the PR Checklist
PR Checklist π
Title π
-
Clear and detailed title
-
Title and body includes Jira ticket number e.g.
[BIG-6523]
or[no-ticket]
Description π
-
Contains link to Jira ticket
-
The why will help us understand the change 6 months from now
-
The how is detailed and includes links to the relevant source code
-
Manual test results included
Code π
-
Tested on a review app or locally
-
Adequate automated test coverage of changes made
-
Author has reviewed their own PR
-
Live review scheduled if change is non trivial
For UI changes π
-
PR includes before and after videos or screenshots
-
Tested on the supported browsers, videos or screenshots included in the PR
For defects π
- Regression test has been written that replicates the bug
For Segment tracking π
-
Tested events coming through via the Segment debugger
-
Videos or screenshots taken of the events asserting what you expect - see example
During Review π
-
Author responses to reviewer comments are clear
-
When feedback has been actioned, the commit sha of the fix is in the comment and the comment has been resolved
-
Every reviewer comment has been responded to and resolved
Example of a great PR π
[BIG-123] Add authentication support for dashboard π
What π
Iβve added support for authentication to implement the dashboard. It includes model, table, controller and test.
Why π
These changes complete the user login and account creation experience. See #JIRA-123 for more information.
How π
This includes a migration, model and controller for user authentication. Iβm using Devise to do the heavy lifting. I ran Devise migrations and those are included here.
Testing π
π’ When user logs in they are shown the dashboard π
β User is shown dashboard β Logs indicate success
π’ When a guest user visits the dashboard they are redirected to the home page π
β User is shown home page β Warning shown in logs
Browser Testing π
Mobile π
Β | OS | Device | OS version | Browser |
---|---|---|---|---|
π’ | iOS | iPhone 8 | 13 | Safari |
π’ | iOS | iPad 5 | 11 | Safari |
π’ | iOS | iPad Mini 4 | 11 | Safari |
π’ | Android | Samsung Galaxy S21 | 11 | Samsung Internet |
Desktop π
Β | OS | Browser |
---|---|---|
π’ | Windows 7 | Chrome 96 |
π’ | Mac El Capitan (10.11) | Chrome 96 |
π’ | Mac Sierra (10.12) | Safari 10.1 |
π’ | Windows 10 | Edge 96 |
π’ | Windows 7 | Firefox 59 |
π’ | Mac El Capitan (10.11) | Firefox 78 |
Screenshots π
<screenshots of the user logged in>
Anything Else? π
Letβs consider using a 3rd party authentication provider for this, to offload MFA and other considerations as they arise and as the privacy landscape evolves.
AWS Cognito is a good option, so is Firebase. Iβm happy to start researching this path.
Letβs also consider breaking this out into its own service. We can then re-use it or share the accounts with other apps in the future.