Abnormality repair method, device, equipment, medium and program product
By automating the acquisition of test case sets and exception parameters, pulling target programs for testing and version updates, and utilizing an exception repair knowledge base for repair, the inefficiency and high risk caused by manual operation are solved, achieving efficient and accurate software exception repair.
Patent Information
- Application Number
- CN202511304154.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2026-01-13
AI Technical Summary
In existing technologies, software anomaly repair relies on manual operation, resulting in low automation, large workload, and a high risk of omissions or misassessments, thus increasing production risks.
By acquiring test case sets and exception parameters, the target program is automatically pulled for testing, the version is updated, and the exception repair knowledge base is used for repair. After ensuring that the test case set meets expectations, the component version is updated and repaired.
It improves the automation efficiency of software anomaly repair, reduces omissions and misassessments, and lowers production risks.
Smart Images

Figure CN121326618A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of artificial intelligence, information security, or other related fields, and in particular to an anomaly repair method, apparatus, device, medium, and program product. Background Technology
[0002] During software use, security anomalies may emerge, potentially leading to information leaks and other security risks. Therefore, these anomalies often require timely fixing. To address these security risks, software version upgrades are a common maintenance method.
[0003] However, current version upgrades rely on manual processes. This results in low automation, a large workload, and low efficiency in bug fixing. Furthermore, subjective human assessments can lead to omissions or misjudgments in software modifications, resulting in higher production risks. Summary of the Invention
[0004] In view of the above problems, this disclosure provides an anomaly repair method, apparatus, equipment, medium and program product.
[0005] According to the first aspect of this disclosure, an anomaly repair method is provided, comprising:
[0006] Obtain the test case set and exception parameters for the branch to be repaired in the pipeline;
[0007] Based on the version library in the above abnormal parameters, the target program of the above branch to be repaired is pulled from the above version library, and the above test case set is tested based on the above target program to obtain the test results.
[0008] If the above detection results indicate that the test case set for the above-mentioned branch to be repaired meets expectations, for the target component on the above-mentioned branch to be repaired, based on the target version and abnormal location of the above-mentioned target component in the above-mentioned abnormal parameters, the version of the target component on the above-mentioned branch to be repaired is updated to the target version, wherein the above-mentioned target component is any component on the above-mentioned branch to be repaired that has an abnormality.
[0009] The above test case set is executed on the target component after the version update. If any test case fails to execute, the target component after the version update is repaired based on the exception repair knowledge base.
[0010] According to embodiments of this disclosure, the detection results include a first detection sub-result and a second detection sub-result; the detection results obtained by performing detection on the test case set based on the target program include:
[0011] The target program is mutated on a temporary branch to obtain the mutated target program.
[0012] The above test case set was executed on the modified target program to obtain the first detection sub-result.
[0013] The above test case set was executed on the target program to obtain the second detection sub-result.
[0014] According to embodiments of this disclosure, the above detection results indicate that the test case set for the branch to be repaired meets expectations, including:
[0015] The first detection result indicates that there are no test cases that have passed execution in the above test case set;
[0016] The second detection sub-result indicates that there are no test cases that failed to execute in the above test case set.
[0017] According to embodiments of this disclosure, the establishment of the above-mentioned anomaly repair knowledge base includes the following operations:
[0018] Obtain the pre-repair and post-repair procedures for historical repair anomalies;
[0019] Extract the distinguishing features between the pre-repair and post-repair procedures for each type of anomaly in the above historical repair anomalies;
[0020] Based on the distinguishing features of any type of anomaly within each type of anomaly, at least one repair template is determined for repairing any of the aforementioned anomalies.
[0021] Based on the distinguishing features of each type of anomaly and at least one repair template for each type of anomaly, an anomaly repair knowledge base is established.
[0022] According to embodiments of this disclosure, the above-mentioned anomaly repair based on an anomaly repair knowledge base for the target component after version update includes:
[0023] Based on the updated version of the target component, at least one repair template for the target component is determined from the aforementioned anomaly repair knowledge base.
[0024] Based on the number of successful repairs of each of the at least one repair templates in the above-mentioned anomaly repair knowledge base, determine the target repair template among the at least one repair templates mentioned above.
[0025] The above target repair template is used to repair the above target components.
[0026] According to embodiments of this disclosure, the above-mentioned anomaly repair method further includes:
[0027] Execute the above test case set on the target component after anomaly repair. If no test cases in the above test case set fail to execute, determine that the anomaly repair of the target component is successful, and update the number of successful repairs for the above target repair template in the anomaly repair knowledge base; or
[0028] If at least one of the above repair templates fails to repair the above target component, a strategy for generating a new repair template is generated.
[0029] According to embodiments of this disclosure, the above-mentioned anomaly repair method further includes:
[0030] If the anomaly of the target component is successfully repaired, the changes to the target component on the branch to be repaired will be merged into the official branch, wherein the official branch and the branch to be repaired have the same components.
[0031] The second aspect of this disclosure provides an anomaly repair apparatus, comprising: an acquisition module, a detection module, an update module, and a repair module. The acquisition module is used to acquire a test case set and anomaly parameters for a branch to be repaired in a pipeline; the detection module is used to pull the target program for the branch to be repaired from the version library based on the anomaly parameters, and to detect the test case set based on the target program to obtain a detection result; the update module is used to, if the detection result indicates that the test case set for the branch to be repaired meets expectations, update the version of the target component on the branch to be repaired to the target version based on the target version and anomaly location of the target component in the anomaly parameters, wherein the target component is any component on the branch to be repaired that has an anomaly; the repair module is used to execute the test case set on the updated target component, and, if any test case execution fails in the test case set, to perform anomaly repair on the updated target component based on an anomaly repair knowledge base.
[0032] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0033] A fourth aspect of this disclosure also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0034] The fifth aspect of this disclosure also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0035] Based on the anomaly repair method, apparatus, equipment, medium, and program products provided in this disclosure, a test case set and anomaly parameters for the branch to be repaired in the pipeline are obtained. This allows the target program to be retrieved from the version control library corresponding to the branch to be repaired, based on the version control library in the anomaly parameters. Thus, the obtained test case set for the branch to be repaired can be tested based on the target program to ensure its completeness. Since the test case set is used for subsequent component testing to determine if the component has anomalies, it is necessary to ensure the test case set is complete to avoid problems in component testing due to issues with the test case set. Therefore, if the test case set meets expectations, based on the target version and anomaly location of the target component in the anomaly parameters, the target component is updated to achieve an anomaly repair. To determine if the target component still has anomalies after the version update, the updated target component is tested using the test case set. If any test case fails to execute, it is determined that the updated target component still has anomalies. Based on this, the updated target component is repaired again using an anomaly repair knowledge base. Therefore, by automating the repair of anomalies in components within the production line, the efficiency of component rectification in the application is improved. Attached Figure Description
[0036] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0037] Figure 1 This diagram illustrates an application scenario of the anomaly repair method according to an embodiment of the present disclosure.
[0038] Figure 2 A flowchart illustrating an anomaly repair method according to an embodiment of the present disclosure is shown schematically.
[0039] Figure 3 This illustration schematically shows a flowchart of anomaly repair for a target component after a version update, according to an embodiment of the present disclosure;
[0040] Figure 4 A schematic block diagram of an anomaly repair apparatus according to an embodiment of the present disclosure is shown.
[0041] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing an anomaly repair method according to an embodiment of the present disclosure. Detailed Implementation
[0042] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0043] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0044] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0045] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0046] Figure 1 The diagram illustrates an application scenario of the anomaly repair method according to an embodiment of the present disclosure.
[0047] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0048] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0049] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0050] Specifically, multiple applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, and the applications on the first terminal device 101, the second terminal device 102, and the third terminal device 103 may have anomalies that make them vulnerable to attack.
[0051] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0052] For example, for the pipelines used in the first terminal device 101, the second terminal device 102, and the third terminal device 103, the server 105 can obtain the test case set and exception parameters for the branch to be repaired in the pipeline. This allows the target program for the branch to be repaired to be pulled from the version repository based on the version number in the exception parameters. Based on the target program, the test case set is tested to obtain the test results. If the test results indicate that the test case set for the branch to be repaired meets expectations, the version of the target component on the branch to be repaired is updated to the target version based on the target version and exception location of the target component in the exception parameters. The test case set is then executed on the updated target component. If any test case fails to execute, the updated target component can be repaired based on the exception repair knowledge base.
[0053] It should be noted that the anomaly repair method provided in this embodiment can generally be executed by server 105. Correspondingly, the anomaly repair device provided in this embodiment can generally be located in server 105. The anomaly repair method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the anomaly repair device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0054] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0055] The following will be based on Figure 1 The described scene, through Figures 2-3 The anomaly repair method of the embodiments of this disclosure will be described in detail.
[0056] Figure 2 A flowchart illustrating an anomaly repair method according to an embodiment of the present disclosure is shown schematically.
[0057] like Figure 2 As shown, the method 200 includes operations S210 to S240.
[0058] In operation S210, obtain the test case set and exception parameters for the branch to be repaired in the pipeline.
[0059] According to embodiments of this disclosure, a pipeline is introduced that can integrate different components of multiple applications. For example, different branches of the pipeline may include different components, and the components included in a branch of the pipeline may belong to the same application or different applications. In one embodiment, a component may characterize software.
[0060] Therefore, anomalies can be repaired on branches in the pipeline that need repair. The branch to be repaired can be any branch in the pipeline.
[0061] According to the embodiments of this disclosure, since subsequent test cases are needed to verify whether the anomaly has been successfully repaired, a test case set for the branch to be repaired needs to be obtained first.
[0062] In one embodiment, a test case set can be established in advance based on the application's functions, etc. Each branch in the pipeline can correspond to a specific set of test cases within the test case set.
[0063] According to embodiments of this disclosure, the branch to be repaired may include multiple components, and the abnormal parameters may include abnormal parameters for each of the multiple components.
[0064] In one embodiment, abnormal parameters for the branch to be repaired can be obtained through a parameter parsing engine in the pipeline.
[0065] In one embodiment, the exception parameters may include exception information for a specific component, the target version, and the location of the exception.
[0066] According to embodiments of this disclosure, abnormal parameters of a component may include the contents shown in Table 1 below.
[0067] Table 1
[0068]
[0069] As shown in Table 1 above, the exception information in the exception parameters of a certain component can include the application, version library, branch, and component name.
[0070] In one embodiment, the application can be the application to which the component belongs; the version library can be used to store the program of the application to which the component belongs, such as the source code; the current version can be the current version of the component; the exception location can be the location of the exception that exists in the component; and the target version can be the version that the component needs to be updated to.
[0071] In one embodiment, the abnormal parameters of different components on the production line can be obtained by the following operation: by scanning multiple applications using an anomaly scanning tool, the abnormal parameters of different components in multiple applications can be obtained. The abnormal parameters specifically include the contents shown in Table 1 above.
[0072] In operation S220, based on the repository in the exception parameters, the target program of the branch to be repaired is pulled from the repository, and based on the target program, the test case set is tested to obtain the test results.
[0073] According to embodiments of this disclosure, since the test case set is used for subsequent component testing, it is necessary to ensure that the test case set is complete. Therefore, the test case set needs to be tested first to ensure that the test cases are complete before being used for subsequent component testing.
[0074] According to embodiments of this disclosure, the abnormal parameters of the branch to be repaired record a version repository, thereby allowing the target program for the branch to be repaired to be retrieved from the corresponding version repository. The target program can be code for the branch to be repaired, and it can be the latest version of the program for the branch to be repaired.
[0075] In one embodiment, the test case set for the branch to be repaired can be tested according to the target program of the branch to be repaired, and the test results can be obtained.
[0076] According to embodiments of this disclosure, the completeness of the test case set can be determined based on the detection results.
[0077] In operation S230, if the test case set for the branch to be repaired meets the expectations as indicated by the detection results, the version of the target component on the branch to be repaired is updated to the target version based on the target version and anomaly location in the anomaly parameters.
[0078] The target component is any component on the branch to be repaired that has an anomaly.
[0079] According to embodiments of this disclosure, if the detection results indicate that the test case set for the branch to be repaired does not meet expectations, then the test case set for the branch to be repaired is incomplete. Therefore, the test case set needs to be improved until the detection results for the test case set can indicate that the test case set meets expectations.
[0080] In one embodiment, if the detection results indicate that the test case set for the branch to be repaired does not meet expectations, the test case set cannot be used for subsequent component testing. Subsequent component testing can only be performed using the test case set if the detection results indicate that the test case set for the branch to be repaired meets expectations.
[0081] In one embodiment, if the detection results indicate that the test case set for the branch to be repaired does not meet expectations, a suggestion can be made to improve the test case set. For example, this suggestion can be sent via email.
[0082] According to embodiments of this disclosure, when the test case set meets expectations, for a target component on a branch to be repaired, the target version and anomaly location of the target component can be obtained based on the anomaly parameters of the branch to be repaired. Therefore, based on the anomaly location of the target component, the target component requiring a version update can be found, and based on the target version, the version of the target component can be updated to the target version.
[0083] When operating S240, test case sets are executed on the target component after version update. If test case execution fails in the test case set, the target component after version update is repaired based on the exception repair knowledge base.
[0084] According to embodiments of this disclosure, for anomalies in the target component, the anomalies are first fixed by updating the component version. If the anomalies persist after the version update, the anomalies need to be fixed by modifying the target component's program. Therefore, after updating the target component, the updated target component needs to be tested to determine whether the anomalies still exist, i.e., whether the version update has successfully fixed the anomalies in the target component.
[0085] In one embodiment, the updated target component is tested, specifically by executing a test case set on the updated target component. Therefore, it can be determined whether the updated target component still has any anomalies based on the execution of each test case in the test case set.
[0086] According to embodiments of this disclosure, a test case set is executed on the updated target component. If any test case fails to execute, it indicates that the updated target component still has anomalies. Therefore, in this case, the updated target component still needs to undergo anomaly repair again.
[0087] Specifically, the target component after the version update is subjected to further anomaly repair. This can be achieved by using an anomaly repair knowledge base to perform anomaly repair on the target component after the version update. The anomaly repair knowledge base is pre-established so that it can be directly used to repair anomalies in the target component during actual anomaly repair applications.
[0088] In one embodiment, based on an anomaly repair knowledge base, anomaly repair is performed on the target component after the version update, which may specifically refer to modifying the program of the target component after the version update.
[0089] According to the embodiments of this disclosure, test cases are executed on the target component after the version update. If there are no test cases that fail to execute in the set of test cases, that is, all test cases in the set of test cases are executed successfully, it indicates that the target component after the version update no longer has any abnormalities, that is, the abnormalities of the target component after the version update have been fixed.
[0090] In one embodiment, test cases are executed on the updated target component. If no test cases fail to execute, the updated target component can be submitted to the developers for review to further ensure that the anomalies have been fixed. If the developers approve the review, it can be determined that the anomalies of the updated target component have been fixed.
[0091] According to embodiments of this disclosure, a test case set and exception parameters for the branch to be repaired in the pipeline are obtained. Based on the version control in the exception parameters, the target program is retrieved from the version control corresponding to the branch to be repaired. This allows for testing of the obtained test case set for the branch to be repaired based on the target program, ensuring the test case set is complete. Since the test case set is used for subsequent component testing to determine if the component has any exceptions, it is necessary to ensure the test case set is complete to avoid problems in component testing due to issues with the test case set. Therefore, if the test case set meets expectations, based on the target version and exception location of the target component in the exception parameters, the target component is updated to achieve one exception repair. To determine if the target component still has exceptions after the version update, the updated target component is tested using the test case set. If any test case fails to execute, it is determined that the updated target component still has exceptions. Based on this, the updated target component is repaired again using an exception repair knowledge base. Thus, by automating the repair of exceptions in components in the pipeline, the efficiency of component rectification in the application is improved.
[0092] According to embodiments of this disclosure, operations S210 to S240 described above can be performed on each branch of the pipeline to achieve abnormal repair of all components in the pipeline.
[0093] According to embodiments of this disclosure, based on the target program, a test case set is tested to obtain a test result, including: mutating the target program on a temporary branch to obtain a mutated target program; executing the test case set on the mutated target program to obtain a first test result; and executing the test case set on the target program to obtain a second test result.
[0094] The detection results include the first detection sub-result and the second detection sub-result.
[0095] According to embodiments of this disclosure, during the testing of a test case set, since it is necessary to mutate the target program of the branch to be repaired, a temporary branch can be created so that the target program can be mutated on the temporary branch, thus avoiding the direct mutation of the target program of the branch to be repaired on the branch to be repaired, which would affect the branch to be repaired.
[0096] In one embodiment, mutating the target program may specifically include randomly modifying some conditions, operators, etc. in the target program.
[0097] According to embodiments of this disclosure, executing a test case set on the mutated target program yields a first detection sub-result; executing the test case set on the target program yields a second detection sub-result. Therefore, based on the first and second detection sub-results, it can be determined whether the test case set meets expectations.
[0098] According to embodiments of this disclosure, the target program of the branch to be repaired is mutated. Then, test case sets are executed using both the original target program and the mutated target program to detect the test case sets. Furthermore, based on the first detection sub-result for the mutated target program and the second detection sub-result for the original target program, it can be determined whether the test case set meets expectations, i.e., whether the test case set is complete.
[0099] According to embodiments of this disclosure, the detection results indicate that the test case set for the branch to be repaired meets expectations, including: a first detection sub-result indicating that there are no test cases that have passed execution in the test case set; and a second detection sub-result indicating that there are no test cases that have failed execution in the test case set.
[0100] According to embodiments of this disclosure, since the first detection sub-result is obtained by executing a test case set on the mutated target program, all test cases in the executed test case set should produce errors, meaning that there should be no test cases that pass execution in the executed test case set. Therefore, the first detection sub-result should indicate that there are no test cases that pass execution in the test case set.
[0101] According to embodiments of this disclosure, since the second detection sub-result is obtained by executing a test case set on the target program, none of the test cases in the executed test case set should produce errors; that is, there should be no test cases that fail to execute in the executed test case set. Therefore, the second detection sub-result should indicate that there are no test cases that fail to execute in the test case set.
[0102] Based on this, if there are no successfully executed test cases in the first detection sub-result characterization test case set and no failed test cases in the second detection sub-result characterization test case set, it can be concluded that the test cases for the branch to be repaired meet expectations.
[0103] Based on this, if there are test cases that have passed execution in the first detection sub-result characterization test case set and / or test cases that have failed execution in the second detection sub-result characterization test case set, it can be indicated that the test cases for the branch to be repaired do not meet expectations.
[0104] According to embodiments of this disclosure, if the first detection sub-result indicates that there are no successfully executed test cases in the test case set and the second detection sub-result indicates that there are no failed test cases in the test case set, it can be determined that the test case set meets expectations, i.e., the test case set can be used in subsequent component testing processes. Therefore, if it is determined that the test case set does not meet expectations, the test case set can be improved in advance, avoiding problems in component testing due to issues with the test case set.
[0105] According to embodiments of this disclosure, the establishment of an anomaly repair knowledge base includes the following operations: obtaining pre-repair and post-repair programs for historical anomalies; extracting distinguishing features between the pre-repair and post-repair programs for each type of anomaly in the historical anomalies; determining at least one repair template for repairing any type of anomaly based on the distinguishing features of any type of anomaly in each type of anomaly; and establishing an anomaly repair knowledge base based on the distinguishing features of each type of anomaly and at least one repair template for the distinguishing features of each type of anomaly.
[0106] According to embodiments of this disclosure, an anomaly repair knowledge base can be pre-established before actual anomaly repair application, so that anomaly repair can be performed based on the pre-established anomaly repair knowledge base during the actual anomaly repair process.
[0107] According to embodiments of this disclosure, since components may still have abnormalities after version updates, it is necessary to modify the program of the updated component to fix the abnormalities.
[0108] Based on this, the pre-repair and post-repair procedures for historical repair anomalies can be obtained. Historical repair anomalies can represent anomalies from the past that have already been repaired.
[0109] According to embodiments of this disclosure, the distinguishing features between the pre-repair program and the post-repair program for each type of anomaly in historical repair anomalies can be extracted. Specifically, for each type of anomaly, the difference segments between the pre-repair program and the post-repair program are analyzed, and the distinguishing features between the pre-repair program and the post-repair program are extracted from the two dimensions of change model and context features.
[0110] In one embodiment, the change pattern can characterize and identify common repair operations, such as adding conditional statements, replacing dangerous functions, or adding filtering logic. Contextual features can characterize the context environment in the program to be modified (the program before repair), such as function call chains and class hierarchies.
[0111] According to embodiments of this disclosure, based on the distinguishing characteristics of any type of exception, the program modifications required for that type of exception can be determined. Based on this, and due to the use of tools for modifying the program, at least one repair template for fixing any type of exception can be determined based on the determined required program modifications. The repair template is used to modify the program of the component.
[0112] Therefore, an anomaly repair knowledge base can be established based on the distinguishing features of each type of anomaly and at least one repair template for each type of anomaly.
[0113] According to embodiments of this disclosure, the selection of repair templates for a certain type of anomaly in the anomaly repair knowledge base can be as shown in Table 2 below.
[0114] Table 2
[0115]
[0116] As shown in Table 2 above, the feature descriptions in Table 2 are the change modes.
[0117] According to embodiments of this disclosure, an anomaly repair knowledge base is established in advance before practical application. Since the anomaly repair knowledge base includes repair templates for fixing anomalies, anomalies can be repaired in practical application based on repair templates that match the actual anomalies in the anomaly repair knowledge base.
[0118] Figure 3 The flowchart illustrating the anomaly repair of a target component after a version update according to an embodiment of the present disclosure is shown schematically.
[0119] like Figure 3 As shown, the method 300 includes operations S310 to S330.
[0120] In operation S310, based on the updated version of the target component, at least one repair template for the target component is determined from the anomaly repair knowledge base.
[0121] According to embodiments of this disclosure, if the target component still has anomalies after the version update, it is necessary to perform anomaly repair on the target component again after the version update.
[0122] According to embodiments of this disclosure, since the pre-established anomaly repair knowledge base is built based on programs, at least one repair template for the target component can be determined from the anomaly repair knowledge base based on the updated version of the target component's program. For the same type of anomaly, there can be multiple repair methods; a repair template can represent one repair method.
[0123] In one embodiment, the program of the updated target component can be scanned based on an anomaly repair knowledge base to determine if there are fields, such as code snippets, in the anomaly repair knowledge base that are similar to those in the updated target component's program. Therefore, based on these similar fields, at least one repair template for the target component can be determined from the anomaly repair knowledge base.
[0124] In operation S320, the target repair template is determined from at least one repair template according to the number of successful repairs of each repair template in the anomaly repair knowledge base.
[0125] According to embodiments of this disclosure, as shown in Table 2 above, the anomaly repair knowledge base records the number of successful repairs for each type of anomaly in at least one repair template. Therefore, the target repair template for anomaly repair of the target component can be determined based on the number of successful repairs for each of the at least one repair template.
[0126] In one embodiment, the repair template with the most successful repairs among at least one repair template can be selected as the target repair template. For example, for the anomaly corresponding to Table 2 above, template 4 can be selected.
[0127] When operating S330, the target component is repaired using the target repair template.
[0128] According to embodiments of this disclosure, after determining the target repair template, the target component can be repaired by using the target repair template.
[0129] According to embodiments of this disclosure, since the anomaly repair knowledge base is built based on programs, repair templates, etc., at least one repair template for the target component can be determined from the anomaly repair knowledge base based on the program of the target component. Based on this, a target repair template can be selected to repair the target component based on the number of successful repairs of the repair template. By selecting the repair template with the highest number of successful repairs for the anomaly repair of the target component, the probability of successfully repairing anomalies in the template component is ensured.
[0130] According to embodiments of this disclosure, the above-mentioned anomaly repair method further includes: executing a test case set on the target component after anomaly repair, and if no test case fails to execute in the test case set, determining that the anomaly repair of the target component is successful, and updating the number of successful repairs for the target repair template in the anomaly repair knowledge base; or generating a strategy for creating a new repair template if at least one repair template fails to repair the anomaly of the target component.
[0131] According to the embodiments of this disclosure, after performing anomaly repair on the target component after version update based on the anomaly repair knowledge base, it is also necessary to check whether the anomaly of the target component after anomaly repair has been successfully repaired, that is, whether there is no anomaly in the target component.
[0132] In one embodiment, detecting whether the anomaly of the target component has been successfully fixed may specifically include: executing a test case set on the target component after anomaly repair. Therefore, it can be determined whether the target component still has anomalies based on the execution status of each test case in the test case set after anomaly repair.
[0133] According to the embodiments of this disclosure, a test case set is executed on the target component after the anomaly is repaired. If there are no test cases that fail to execute in the executed test case set, it can be determined that the anomaly repair of the target component is successful, that is, there is no anomaly in the target component.
[0134] Based on this, since the anomaly repair of the target component was successful, the anomaly repair template for the target component was also successfully repaired. Therefore, the number of successful repairs for the target repair template in the anomaly repair knowledge base can be updated.
[0135] Specifically, updating the number of successful repairs for the target repair template in the anomaly repair knowledge base is equivalent to incrementing the number of successful repairs for the target repair template in the anomaly repair knowledge base by 1.
[0136] Taking Table 2 above as an example, if the target repair template is the repair template with the highest number of successful repairs among at least one repair template, such as selecting template 4 as the template repair template, the target component after the version update will be repaired using the target repair template. A test case set will be executed on the target component after the anomaly repair. If there are test cases that fail to execute in the executed test case set, it can be determined that the anomaly repair of the target component has failed, that is, the anomaly repair of the target component by the target repair template has failed.
[0137] If there are multiple repair templates for the target component and the repair template with the most successful repairs fails to repair the abnormality of the target component, repeat the above operation S320 to redetermine a new target repair template. Specifically, the repair template with the second most successful repairs can be selected as the new target repair template, such as selecting template 3 as the new target repair template, and the target component is repaired again using this target repair template, that is, the above operation S330 is executed.
[0138] If multiple repair templates for the target component fail to repair the anomaly of the target component, that is, if at least one repair template fails to repair the anomaly of the target component, as shown in Table 2 above, where templates 1 through 4 all failed to repair the anomaly of the target component.
[0139] Therefore, none of the repair templates used for repairing template components in the exception repair knowledge base can successfully repair the exceptions in the target component. Based on this, a strategy for creating new repair templates can be generated. This strategy can be used to indicate when a new repair template needs to be created to repair the exceptions in the target component.
[0140] Furthermore, after creating a new repair template, the anomaly repair knowledge base is updated based on the newly created repair template.
[0141] According to embodiments of this disclosure, after anomaly repair of the target component, it is necessary to test the repaired component to determine whether the repair was successful. Specifically, this can be achieved by executing a test case set on the target component. If the repair is successful, the success rate of the target repair template used to repair the target component in the anomaly repair knowledge base is updated to provide a basis for selecting new repair templates for subsequent anomaly repairs based on the knowledge base. If each determined repair template fails to repair the anomaly, the templates in the anomaly repair knowledge base are not suitable for repairing the anomaly of the target component, and a new repair module needs to be created. Therefore, a strategy for creating new repair templates can be generated to indicate the need for new templates. Furthermore, the anomaly repair knowledge base can be updated based on the newly created repair templates, thereby improving the effectiveness of subsequent automatic rectification based on the knowledge base.
[0142] According to embodiments of this disclosure, the above-mentioned anomaly repair method further includes: if the anomaly repair of the target component is successful, merging the changes to the target component on the branch to be repaired into the official branch, wherein the official branch and the branch to be repaired have the same components.
[0143] According to embodiments of this disclosure, a corresponding formal branch exists for each branch to be repaired in the pipeline. The branch to be repaired is used to attempt to repair anomalies until the anomaly repair of the target component on the branch to be repaired is successful. At that point, the changes to the target component on the branch to be repaired are merged into the formal branch. Thus, the formal branch is only used for normal anomaly repair.
[0144] In one embodiment, for each target component on the pipeline branch to be repaired, if the anomaly repair of each target component on the branch to be repaired is successful, the changes to the target component need to be merged into the formal branch.
[0145] In one embodiment, changes to the target component on the branch to be repaired are merged into the official branch. Specifically, this can be achieved by: if the anomaly repair of the target component on the branch to be repaired is successful, determining the target version of the target component on the branch to be repaired and the target repair template that completed the anomaly repair of the target component. Based on the determined target version and the target repair template that can successfully repair the component, updating the version of the target component on the official branch to the target version, and using the target repair template to perform anomaly repair on the target component.
[0146] Since multiple repair templates may be used to find the one that successfully repairs the target component after version changes on the repair branch, only the final target repair template that successfully repairs the target component should be merged into the official branch.
[0147] According to embodiments of this disclosure, since the branch to be repaired and the official branch have the same components, the components are first repaired on the branch to be repaired. After the component is successfully repaired on the branch to be repaired, the same changes are then made on the official branch. Therefore, the existence of the branch to be repaired avoids directly repairing the components on the official branch, thus preventing any impact on the official branch during the repair process.
[0148] Based on the above-described anomaly repair method, this disclosure also provides an anomaly repair device. The following will be combined with... Figure 4 The device is described in detail.
[0149] Figure 4 A schematic block diagram of an anomaly repair apparatus according to an embodiment of the present disclosure is shown.
[0150] like Figure 4 As shown, the anomaly repair device 400 of this embodiment includes an acquisition module 410, a detection module 420, an update module 430, and a repair module 440.
[0151] The acquisition module 410 is used to acquire the test case set and exception parameters for the branch to be repaired in the pipeline. In one embodiment, the acquisition module 410 can be used to perform the operation S210 described above, which will not be repeated here.
[0152] The detection module 420 is used to pull the target program of the branch to be repaired from the repository based on the abnormal parameters, and to detect the test case set based on the target program to obtain the detection result. In one embodiment, the detection module 420 can be used to perform the operation S220 described above, which will not be repeated here.
[0153] The update module 430, when the detection results indicate that the test case set for the branch to be repaired meets expectations, updates the version of the target component on the branch to be repaired to the target version based on the target version and anomaly location in the anomaly parameters. The target component is any component on the branch to be repaired that exhibits an anomaly. In one embodiment, the update module 430 can be used to perform the operation S230 described above, which will not be repeated here.
[0154] The repair module 440 is used to execute a test case set on the target component after the version update, and, if any test case fails to execute, performs anomaly repair on the target component after the version update based on the anomaly repair knowledge base. In one embodiment, the repair module 440 can be used to execute the operation S240 described above, which will not be repeated here.
[0155] According to embodiments of this disclosure, the detection result includes a first detection sub-result and a second detection sub-result; the detection module 420 includes a mutation unit, a first execution unit, and a second execution unit.
[0156] The mutation unit is used to mutate the target program on a temporary branch to obtain the mutated target program.
[0157] The first execution unit is used to execute the test case set on the mutated target program and obtain the first detection sub-result.
[0158] The second execution unit is used to execute the test case set on the target program and obtain the second detection sub-result.
[0159] According to embodiments of this disclosure, the anomaly repair device 400 further includes a setup module.
[0160] Establish a module for building an anomaly repair knowledge base.
[0161] According to embodiments of this disclosure, the establishment module includes an acquisition unit, an extraction unit, a first determination unit, and an establishment unit.
[0162] The acquisition unit is used to acquire the pre-repair and post-repair programs for historical repair anomalies.
[0163] The extraction unit is used to extract the distinguishing features between the pre-repair program and the post-repair program for each type of anomaly in the historical repair anomalies.
[0164] The first determining unit is used to determine at least one repair template for repairing any one type of anomaly based on the distinguishing features of any one type of anomaly in each type of anomaly.
[0165] Establish a unit to build an anomaly repair knowledge base based on the distinguishing features of each anomaly and at least one repair template for each anomaly's distinguishing features.
[0166] According to embodiments of this disclosure, the repair module 440 includes a second determining unit, a third determining unit, and a repair unit.
[0167] The second determining unit is used to determine at least one repair template for the target component from the anomaly repair knowledge base based on the program of the target component after version update.
[0168] The third determining unit is used to determine the target repair template among at least one repair template according to the number of successful repairs of each repair template in the anomaly repair knowledge base.
[0169] The repair unit is used to repair anomalies in the target component using the target repair template.
[0170] According to embodiments of this disclosure, the anomaly repair device 400 further includes a determination module and a generation module.
[0171] The determination module is used to execute a test case set on the target component after the exception is fixed. If no test case fails to execute, the module determines that the exception of the target component has been successfully fixed and updates the number of successful fixes for the target fix template in the exception fix knowledge base.
[0172] The generation module is used to generate a strategy for creating a new repair template when at least one repair template fails to repair an anomaly of the target component.
[0173] According to embodiments of this disclosure, the anomaly repair device 400 further includes a merging module.
[0174] The merge module is used to merge changes to the target component on the branch to be fixed into the production branch if the anomaly of the target component is successfully fixed. The production branch and the branch to be fixed have the same components.
[0175] According to embodiments of this disclosure, any plurality of modules among the acquisition module 410, detection module 420, update module 430, and repair module 440 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the acquisition module 410, detection module 420, update module 430, and repair module 440 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the acquisition module 410, detection module 420, update module 430, and repair module 440 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.
[0176] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing an anomaly repair method according to an embodiment of the present disclosure.
[0177] like Figure 5 As shown, an electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage portion 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0178] RAM 503 stores various programs and data required for the operation of electronic device 500. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0179] According to embodiments of this disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device 500 may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 508 as needed.
[0180] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0181] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 502 and / or RAM 503 and / or one or more memories other than ROM 502 and RAM 503 described above.
[0182] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the anomaly repair methods provided in the embodiments of this disclosure.
[0183] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0184] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0185] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0186] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0187] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0188] Those skilled in the art will understand that the features described in the various embodiments of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0189] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. An anomaly repair method, characterized in that, The method includes: Obtain the test case set and exception parameters for the branch to be repaired in the pipeline; Based on the version library in the abnormal parameters, the target program of the branch to be repaired is pulled from the version library, and the test case set is tested based on the target program to obtain the test results; If the detection results indicate that the test case set for the branch to be repaired meets expectations, for the target component on the branch to be repaired, based on the target version and abnormal location of the target component in the abnormal parameters, the version of the target component on the branch to be repaired is updated to the target version, wherein the target component is any component on the branch to be repaired that has an abnormality. The test case set is executed on the target component after the version update, and if there is a test case execution failure in the test case set, the target component after the version update is repaired based on the exception repair knowledge base.
2. The method according to claim 1, characterized in that, The detection results include a first detection sub-result and a second detection sub-result; the detection of the test case set based on the target program to obtain detection results includes: The target program is mutated on a temporary branch to obtain the mutated target program; The test case set is executed on the mutated target program to obtain the first detection sub-result; The test case set is executed on the target program to obtain the second detection sub-result.
3. The method according to claim 2, characterized in that, The detection results indicate that the test case set for the branch to be repaired meets expectations, including: The first detection sub-result indicates that there are no successfully executed test cases in the test case set; The second detection sub-result indicates that there are no test cases that failed to execute in the test case set.
4. The method according to any one of claims 1 to 3, characterized in that, The establishment of the anomaly repair knowledge base includes the following operations: Obtain the pre-repair and post-repair procedures for historical repair anomalies; Extract the distinguishing features between the pre-repair procedure and the post-repair procedure for each type of anomaly in the historical repair anomalies; Based on the distinguishing features of any type of anomaly within each type of anomaly, at least one repair template is determined for repairing any type of anomaly. The anomaly repair knowledge base is established based on the distinguishing features of each type of anomaly and at least one repair template for each type of anomaly.
5. The method according to claim 4, characterized in that, The method of performing anomaly repair on target components after version updates based on the anomaly repair knowledge base includes: Based on the updated version of the target component, the program determines at least one repair template for the target component from the anomaly repair knowledge base; Based on the number of successful repairs of each of the at least one repair templates in the anomaly repair knowledge base, determine the target repair template among the at least one repair templates; The target component is repaired using the target repair template.
6. The method according to claim 5, characterized in that, The method further includes: Execute the test case set on the target component after anomaly repair. If no test cases in the test case set fail to execute, determine that the anomaly repair of the target component is successful, and update the number of successful repairs for the target repair template in the anomaly repair knowledge base; or In the event that at least one repair template fails to repair the abnormality of the target component, a strategy for creating a new repair template is generated.
7. The method according to claim 6, characterized in that, The method further includes: If the anomaly repair of the target component is successful, the changes to the target component on the branch to be repaired will be merged into the official branch, wherein the official branch and the branch to be repaired have the same components.
8. An anomaly repair device, characterized in that, The device includes: The acquisition module is used to acquire the test case set and exception parameters for the branch to be repaired in the pipeline; The detection module is used to pull the target program of the branch to be repaired from the version library based on the version library in the abnormal parameters, and to detect the test case set based on the target program to obtain the detection result; The update module is used to update the version of the target component on the branch to be repaired to the target version based on the target version and the abnormal position of the target component in the abnormal parameters, when the detection result indicates that the test case set for the branch to be repaired meets the expectations. The target component is any component on the branch to be repaired that has an abnormality. The repair module is used to execute the test case set on the target component after the version update, and to perform anomaly repair on the target component after the version update based on the anomaly repair knowledge base if there is a test case execution failure in the test case set.
9. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.