Automating Program Repair
Eclipse Repairnator is a bot for automated program repair. It constantly monitors software bugs discovered during continuous integration (CI) and tries to fix them. If it succeeds in synthesizing a valid patch, Repairnator proposes the patch to the development team as a pull request.
From Research to Repair Bots
A decade ago, a new research field called “automated program repair” was invented. The main idea is that some bugs can be automatically corrected. For example, the following patch, which can be automatically generated, fixes an if-statement with an incorrect condition.
- if (x < 10)
+ if (x <= 10)
A program repair bot is an artificial agent that tries to synthesize source code patches. It analyzes bugs and produces patches to help human developers with software maintenance. The vision is that program repair bots can partially replace human developers for bug-fixing tasks.
Automated Repair and Continuous Integration
With CI, a server compiles code and runs all tests for each commit made in the version control system for a software project — Git, for example. In CI terms, there is a build for each commit.
A build contains the:
- Information about the source code snapshot used, such as a reference to a Git commit
- Results of compilation and test execution — fail or success
- Execution trace log
A build fails if compilation fails, or if at least one test case fails. Approximately one out of four builds fails, and test failure is the most common cause. So, it makes sense to automatically fix CI build failures.
How Repairnator Works
In 2017-2018, we designed, implemented, and started using Repairnator. Repairnator specializes in repairing build failures during CI, focusing on failures due to broken tests. Figure 1 provides an overview of how the Repairnator bot works.
Figure 1: The Repairnator workflow
The primary inputs of Repairnator are continuous integration builds, triggered by developer commits in GitHub projects. This is shown in (a) and (b) in Figure 1.
The outputs of Repairnator are two-fold. It:
- Automatically produces patches for repairing builds, if any (g)
- Collects valuable data for future program repair research (h) and (k)
Repairnator monitors all continuous activity from GitHub projects (c).
The CI builds are provided as input to a three-stage pipeline:
- Collecting and analyzing CI build logs (e)
- Locally reproducing the build failures that occurred during CI (f)
- Running different program repair prototypes from the latest academic research
When a patch is found, a bug fix is made in the form of a pull request. Developers then follow their usual process of bug fix code reviews and eventually merge the Repairnator patches into the main build.
Where We’re Headed
As a next step, we’re aiming to take Repairnator out of academia. To achieve this goal, we’ve created the Eclipse Repairnator project.
The goal of Eclipse Repairnator is to be the open source reference platform for automated repair. All kinds of repair will be considered, including test failure repair, compilation error repair, and static warning repair.
Get More Information
Eclipse Repairnator is a welcoming and original community, rooted in academia and industry. We warmly welcome everyone who would like to join the community. You can say hello here.
You can also refer to the following resources: