Heuristics for automated culprit finding
View Patent ↗A system and method for isolating one or more code changes which are suspected of causing a code failure are disclosed. An example system may include a backend, a frontend, and a datastore. A list of changes to a codebase may be received along with a list of test targets in the codebase that are failing and a snapshot of the codebase at the time when one or more of the codebase's tests started failing. A heuristic may be used to find the code changes causing the one or more code failures.
1. A system for isolating one or more code changes that are suspected of causing a code failure in a codebase, the system comprising:
one or more processing devices; and
one or more storage devices having at least a memory storing instructions that, when executed by the one or more processing devices, cause the one or more processing devices to:
receive a list of changes to the codebase, the list including all changes to the codebase starting at the time when the codebase's tests were all passing to a time when one or more of the codebase's tests began to fail;
receive a list of test targets in the codebase that are failing;
receive a snapshot of the codebase at the time when one or more of the codebase's tests started failing;
use at least one compile or execution log to find the code changes causing one or more test failures; and
determine whether the test failure was caused by an execution failure by:
generating a root cause set from at least one log file;
for code changes in the received list of changes to the codebase:
for root causes in the root cause set:
retrieving a list of source files modified by the change;
for a modified source file:
calculating the minimum distance to the source file from the root cause; and
calculating the impact of modifying the source file;
summing the impact of modified source files to find a total impact of the change on the root cause;
summing the impact of the change on root causes to find a total impact of the change on the codebase;
sorting the code changes in order of impact; and
returning the sorted code change list.
2. The system of claim 1 , further comprising:
responsive to determining that the code failure was caused by a compile failure, using at least one compile log to generate the root cause set.
3. The system of claim 2 , wherein the impact of modifying the source file is determined by Gaussian (distance) where Gaussian( ) is a Gaussian function with a mean of 1 and variance of 0.1.
4. The system of claim 1 , further comprising:
responsive to determining that the code failure was caused by an execution failure, using at least one execution log to generate the root cause set.
5. The system of claim 4 , wherein generating a root cause set further comprises:
isolating source files that reported errors in the execution log; and
identifying targets that are parents of isolated source files.
6. The system of claim 4 , wherein the impact of modifying the source file is determined by the formula: k — 1*Gaussian (distance, M, V) where k — 1 is a constant multiplier and Gaussian( ) is a Gaussian function with a mean M and a variance V.
7. A computer-implemented method for isolating one or more code changes that are suspected of causing a code failure in a codebase, the method comprising:
receiving a list of changes to the codebase, the list including all changes to the codebase starting at the time when the codebase's tests were all passing to a time when one or more of the codebase's tests began to fail;
receiving a list of test targets in the codebase that are failing;
receiving a snapshot of the codebase at the time when one or more of the codebase's tests started failing;
use at least one compile or execution log to find the code changes causing one or more test failures; and
determine whether the test failure was caused by an execution failure by:
generating a root cause set from at least one log file;
for code changes in the received list of changes to the codebase:
for root causes in the root cause set:
retrieving a list of source files modified by the change;
for a modified source file:
calculating the minimum distance to the source file from the root cause; and
calculating the impact of modifying the source file;
summing the impact of the modified source files to find a total impact of the change on the root cause;
summing the impact of the change on root causes to find a total impact of the change on the codebase;
sorting the code changes in order of impact; and
returning the sorted code change list.
8. The computer-implemented method of claim 7 , further comprising:
responsive to determining that the code failure was caused by a compile failure, using at least one compile log to generate the root cause set.
9. The computer-implemented method of claim 7 , further comprising:
responsive to determining that the code failure was caused by an execution failure, using at least one execution log to generate the root cause set.
10. The computer-implemented method of claim 9 , wherein generating a root cause set further comprises:
isolating source files that reported errors in the execution log; and
identifying targets that are parents of isolated source files.
11. The computer-implemented method of claim 9 , wherein the impact of modifying the source file is determined by the formula: k — 1*Gaussian (distance, M, V) where k — 1 is a constant multiplier and Gaussian( ) is a Gaussian function with a mean M and a variance V.