Facebook described how Getafix works. The developers of the company created it to automate the process of fixing the code. Getafix offers fixes for bugs found by the Infer static analyzer, Sapfix and Sapienz, the application testing system.
The tool was created with the aim of shifting the routine duties of engineers to find and fix bugs by AI. In this case, the final decision on making changes is made by the person. The neural network uses the tools to consiser for the previous changes made by engineers, checks the new code and the context of the fragment. After these steps, it offers the option of a fix to the engineer.
Tools that automatically fix code are mostly designed for simple tasks, without context. Getafix, even in the case of similar bugs, can offer different solutions:
The company compared the changes made by man and AI, with the correction of about two hundred bugs. A quarter of the options proposed by the neural network coincided with human-written solutions.
Another experiment involved the correction of 2 thousand bugs calling the null pointer method. Getafix automatically fixed 53% of errors.
Facebook developed an AI-based tool for generating and deploying patches called Sapfix in mid-September 2018. The company introduced it at the Scale 2018 conference. Sapfix can work on its own or in combination with Sapienz - this is “smart” testing software from Facebook for finding errors in the code.