Facebook is introducing a new AI hybrid tool aimed at finding and fixing bugs automatically. SapFix is designed to find bugs, generate fixes and propose action plans to engineers before rolling out into production. The company announced the tool at its annual @Scale conference in San Jose this week.
According to the company, SapFix significantly reduces the time it takes to debug applications as well as speeds up the development process of new software.
The solution is designed to work independently or as part of Facebook’s automated software testing tool Sapinez. Sapinez was first announced at the company’s F8 conference.
“In its current, proof-of-concept state, SapFix is focused on fixing bugs found by Sapienz before they reach production. 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,” the Facebook engineering team wrote in a post.
The tool does not stop at just finding a patch. It will also generate multiple fixes per bug and evaluate the quality. SapFix asks three questions to determine the quality of a fix: “Are there compilation errors, does the crash persist, and does the fix introduce new crashes?”
SapFix will run tests based off of developer-written tests and Spainez trends. “SapFix is replicating the kind of debugging work that people currently do, but it is not designed to deploy fixes to production code on its own,” the team wrote. Once it tests the patches, the tool will send them for human review and approval. “This is very similar to how human-generated reports are checked and approved by other developers, except that the system automatically tracks reviewers’ feedback, lands accepted patches, and then cleans up the other patches. In some cases, SapFix may pick the best fix out of several options and present its recommendations to engineers,” the team explained.
If the patch is approved, it will deploy it. If rejected, the tool will abandon the patch.
According to Facebook, SapFix is still in development and isn’t used at the same scale Spainez is right now. Sapinez currently produces hundreds of bug reports a month, the company explained.
“As we develop SapFix to work with different kinds of bugs and software, the tool has the potential to change the speed and quality of code generation. That’s true not just for companies that operate at large scales, but also for nearly anyone who creates code. Whether used together or separately, SapFix and Sapienz let developers spend less time on debugging and more on generating what’s next,” the team wrote.