Facebook has unveiled a new tool for developers, which aims to automatically fix bugs. Called SapFix, it uses Facebook’s AI to help generate fixes for identified bugs, which are then proposed to engineers for approval and deployment to production. In a post, developers Yue Jia, Ke Mao, and Mark Harman write that SapFix is designed to operate independently, without Sapienz, which is Facebook’s “intelligent automated software testing tool”. It was noted that the tool was unveiled at F8, and has already been deployed in production.
The post notes “The process starts with Sapienz, along with Facebook’s Infer static analysis tool, helping localize the point in the code to patch. Once Sapienz and Infer pinpoint a specific portion of code associated with a crash, it can pass that information to SapFix, which automatically picks from a few strategies to generate a patch.”
In order to address “high-firing” bugs, SapFix is able to to create patches that can either fully or partially revert the codes that caused the bug. For compex crashes, it can generate patches by checking outs its collection of templated fixes, which are created by human engineers based on previous fixes. In the event that the templates don’t work, SapFix will try a mutation-based fin. In this fix, it will perform small code modifications to the abstract syntax tree. It will make adjustments to the patch until it finds a potential solution.
The team aims to share the SapFix with the engineering community later, with the aim of boosting the production and stability of new code for companies and research organisations.