Review patches without using the cli

tl;dr; Verify patches like a Boss using TYPO3.Review box and the Chrome TYPO3 Review Helper. Zero cli interaction needed.

There is a great walkthrough describing how you can contribute to the TYPO3 project by reviewing code changes. It is however targeted at developers. Each patch needs both a code review and a verification. The code review is commonly done by a developer that can read and understand the code changes and approve or disapprove them. The verification process can often be done by a TYPO3 user, integrator or manager. The patch needs to be applied to a running TYPO3 version and there the reviewer can verify if the patch does what it promises.

To set up the review environment you will need to know your way around the cli. And to review a change request, you will need to know your way around gerrit and the command line shell. You will need to:

  • set up a running TYPO3 installation (only once)
  • find an issue to review
  • click a download link
  • copy an obscure Cherry Pick command
  • open a shell on a machine that runs your TYPO3 test installation
  • navigate to the typo3_src directory
  • optionally git fetch, reset and clean the repository
  • paste the Cherry Pick command

And then you can start to verify the change.

Copy the Cherry Pick command

All hands on deck!

This whole process prevents the less tech-savvy from picking the cherries and validating the change. We need those people on deck right now! This means we need to eliminate a lot of technical hurdles. There are pre-built TYPO3 Vagrant boxes like TypoTry (for trying the latest TYPO3 releases) and TYPO3.Homestead (for testing TYPO3 against multiple php versions). Michael Oehlhof contacted me and suggested to use those boxes as a base for a review box. The base boxes all have a static local IP that resolves to the live wildcard domain: *.local.typo3.org. The TYPO3 sites are named something like 7.6.1.local.typo3.org, dev-master.local.typo3.org and so on. You don't need to fiddle with any hosts file or setup dnsmasq, further lowering the technical bar. There is also a base site local.typo3.org that shows you the available sites.

Michael created a form on the base site to make is very easy to do reviews. The only thing you now need to do to do a review is:

  • download and start the TYPO3.Review box (only once)
  • find an issue to review
  • click a download link
  • copy an obscure Cherry Pick command
  • paste the Cherry Pick command in the form on the local base site

Which is still a long list, but a lot less technical skill is needed to execute the steps.

Manual labour

I suggested it would be neat to have a TYPO3 Review Helper Chrome extension that would eliminate the manual steps of clicking the download link and pasting it into the form. This could easily be done a few lines of JavaScript. Two clicks on a page action should be enough to Cherry-Pick the change to the local test system.

So I wrote the extension and the only thing you now need to do to do a review is:

  • download and start the TYPO3.Review box (only once)
  • find an issue to review
  • click the TYPO3 icon the location bar
  • click one of the review this change revision buttons

This looks a lot shorter than the first list and it's easily executable by a the group of reviewers we need to come on board.

Refinement

This was indeed easy enough and worked fine, but it was also quite inflexible. The patch was always deployed to the typo3_src repository on the review.local.typo3.org site so you could compare the results against the vanilla dev-master.local.typo3.org site. I wished there was a way to also patch other git repositories and sites available on the local machine. An extended local site was developed to have access to the needed information to pull this off in a second version of the Chrome extension. This code is solely targeted for local development since it exposes quite a few powerful commands through it's api.

TYPO3 Review Helper Popup

After a rewrite of the Crome extension it is now possible to:

  • target any of the local sites
  • target any of the repositories in any local site
  • optionally git clean and reset before the Cherry-Pick (making 'stacking' of changes possible)

This means you are no longer restricted to applying change-sets to only typo3_src. You can apply them to any other git repository in a site. This enables reviewing changes to typo3 extensions and any other package.

Recap

The only things you now need to do a TYPO3 change verification are:

From there you can just navigate to either a gerrit page or a forger page. The gerrit pages now magically get this neat extra button after installing the Chrome TYPO3 review helper.

So go forth and spread the word! Call upon all those managers and integrators that no longer have an excuse to do code verifications. Get them all on board!

Todo

Currently the gerrit api is supported. To get to this point I have come through "Callback Hell" and the "Pyramid of Doom". The path led me to the Promised land. And now I am continuing my journey and learning how to create more modular system so support for other revision systems can be easily and cleanly added to the extension.

I've already experimented with Atlassian Stash support and the Github API looks great. So the review helper can just as well become a generic TYPO3 and Neos review helper.

Maybe a FireFox version of the extension?

Contributing

Pull requests are welcome!

Want to react? Reach me on Twitter