Program change risk prediction method and device

By generating a directed graph of program changes and entering a risk model, the problem of incomplete coverage of risk points caused by program code changes in software testing is solved, and the rapid and accurate risk prediction of program changes is achieved, ensuring the stable operation of the program.

CN119883871AActive Publication Date: 2025-04-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311311918.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-11
Publication Date
2025-04-25
Estimated Expiration
2043-10-11

AI Technical Summary

Technical Problem

During the software testing process, the test risk points caused by program code changes are incomplete, resulting in the failure to realize the functions after program transformation, affecting customer experience and economic benefits.

Method used

By obtaining the target change program, a directed graph of the target program change is generated, and input it with the historical risk structure chart into the program change risk model, iteratively adjusts the model parameters, and finally creates a program change risk model to predict risks.

Benefits of technology

It realizes rapid and accurate risk prediction of program changes, ensures stable program operation and reduces risk losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883871A_ABST
    Figure CN119883871A_ABST
Patent Text Reader

Abstract

The invention provides a program change risk prediction method and device, relates to the technical field of artificial intelligence, and can be applied to the technical field of finance or other technical fields. The program change risk prediction method comprises the steps of obtaining a target change program; generating a target program change directed graph according to the target change program; and inputting the target program change directed graph and the historical risk structure graph into a program change risk model to obtain a program change risk. According to the method, risk prediction can be quickly and accurately performed on program change, stable program operation is guaranteed, and risk loss is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for predicting program change risks. Background Art

[0002] During software testing, test risk points generally come from changes in program code. The modification of program code is often completed through static analysis to sort out the risk points of the program change, but this method often relies on the professional quality of analysts. At the same time, due to the complex calling relationship between programs, a program is often called directly or indirectly by multiple callers, which leads to incomplete sorting of the impact points of program code modification, resulting in incomplete coverage of test risk points, and the function of the program after modification cannot be realized normally, and even affects the original function, affecting customer experience and economic benefits. Summary of the invention

[0003] The main purpose of the embodiments of the present invention is to provide a method and device for predicting the risk of program changes, so as to quickly and accurately predict the risks of program changes, ensure the stability of program operation, and reduce risk losses.

[0004] In order to achieve the above object, an embodiment of the present invention provides a method for predicting program change risk, comprising:

[0005] Obtain target change procedures;

[0006] Generate a target program change directed graph according to the target change program;

[0007] The target program change directed graph and the historical risk structure graph are input into a program change risk model to obtain the program change risk.

[0008] In one embodiment, the step of creating a program change risk model includes:

[0009] Determine a directed graph of historical program changes according to the historical change program;

[0010] Determine program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph;

[0011] Iteratively adjust the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program;

[0012] When the current iteration number is equal to the preset iteration number, a program change risk model is created according to the program change risk model parameters.

[0013] In one embodiment, determining the program risk prediction data according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph includes:

[0014] Determining the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph;

[0015] The program risk prediction data is determined according to the similarity and a preset similarity coefficient.

[0016] In one embodiment, determining the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph includes:

[0017] Determine a historical program change vector according to the historical program change directed graph and the first program change risk model parameters, and determine a historical risk vector according to the historical risk structure graph and the first program change risk model parameters;

[0018] The similarity between the historical program change directed graph and each historical risk structure graph is determined according to the historical program change vector, the historical risk vector and the second program change risk model parameter.

[0019] In one embodiment, determining the program risk prediction data according to the similarity and a preset similarity coefficient includes:

[0020] Determining comprehensive risk data according to the similarity and the similarity coefficient;

[0021] The program risk prediction data is determined based on a comparison result between the comprehensive risk data and a preset risk threshold.

[0022] In one embodiment, it also includes:

[0023] determining a risk event label according to the actual risk data;

[0024] Determine the change code attribute according to the risk event program corresponding to the risk event label;

[0025] The historical risk structure diagram is generated according to the risk event label and the change code attribute.

[0026] In one embodiment, the risk event label includes a risk event name, a risk event keyword, and a risk event procedure;

[0027] Determining the risk event label according to the actual risk data includes:

[0028] Determine the risk event name, risk event cause, risk event impact and risk event procedure based on the actual risk data;

[0029] The risk event keywords are determined according to the risk event cause and the risk event impact.

[0030] The embodiment of the present invention further provides a program change risk prediction device, comprising:

[0031] An acquisition module, used for acquiring a target change program;

[0032] A target program change directed graph module, used for generating a target program change directed graph according to the target change program;

[0033] The program change risk module is used to input the target program change directed graph and the historical risk structure graph into the program change risk model to obtain the program change risk.

[0034] In one embodiment, it also includes:

[0035] A historical program change directed graph module is used to determine a historical program change directed graph according to the historical change program;

[0036] A program risk prediction data module, used to determine program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph;

[0037] An iteration module, used for iteratively adjusting the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program;

[0038] The program change risk model creation module is used to create a program change risk model according to the program change risk model parameters when the current iteration number is equal to the preset iteration number.

[0039] In one embodiment, the program risk prediction data module includes:

[0040] A similarity unit, used to determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph;

[0041] A program risk prediction data unit is used to determine program risk prediction data according to the similarity and a preset similarity coefficient.

[0042] In one embodiment, the similarity unit includes:

[0043] A historical risk vector subunit, used to determine the historical program change vector according to the historical program change directed graph and the first program change risk model parameters, and to determine the historical risk vector according to the historical risk structure graph and the first program change risk model parameters;

[0044] The similarity subunit is used to determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change vector, the historical risk vector and the second program change risk model parameter.

[0045] In one embodiment, the program risk prediction data unit includes:

[0046] A comprehensive risk data subunit, configured to determine comprehensive risk data according to the similarity and the similarity coefficient;

[0047] The program risk prediction data subunit is used to determine the program risk prediction data according to the comparison result between the comprehensive risk data and the preset risk threshold.

[0048] In one embodiment, it also includes:

[0049] A risk event label module, used to determine a risk event label according to the actual risk data;

[0050] A change code attribute module, used to determine the change code attribute according to the risk event program corresponding to the risk event label;

[0051] The historical risk structure diagram module is used to generate the historical risk structure diagram according to the risk event label and the change code attribute.

[0052] In one embodiment, the risk event label includes a risk event name, a risk event keyword, and a risk event procedure;

[0053] The risk event label module includes:

[0054] A risk parameter determination unit, configured to determine the risk event name, risk event cause, risk event impact and risk event procedure according to the actual risk data;

[0055] The risk event keyword unit is used to determine the risk event keyword according to the risk event cause and the risk event impact.

[0056] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the steps of the program change risk prediction method when executing the computer program.

[0057] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the program change risk prediction method are implemented.

[0058] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the program change risk prediction method when the computer program / instruction is executed by a processor.

[0059] The program change risk prediction method and device of the embodiment of the present invention generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk. The risk prediction of the program change can be performed quickly and accurately to ensure the stable operation of the program and reduce risk losses. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0061] Figure 1 is a flow chart of a method for predicting program change risk in an embodiment of the present invention;

[0062] Figure 2 is a flow chart of generating a historical risk structure diagram in an embodiment of the present invention;

[0063] Figure 3 is a flow chart of S201 in an embodiment of the present invention;

[0064] Figure 4 is a flow chart of creating a program change risk model in an embodiment of the present invention;

[0065] Figure 5 is a flow chart of S402 in an embodiment of the present invention;

[0066] Figure 6 is a flow chart of S501 in an embodiment of the present invention;

[0067] Figure 7 is a flow chart of S502 in an embodiment of the present invention;

[0068] Figure 8 is a structural block diagram of a program change risk prediction device in an embodiment of the present invention;

[0069] Fig. 9 A schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0071] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0072] The acquisition, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of national laws and regulations. The user information in the embodiments of this application is obtained through legal and compliant channels, and the acquisition, storage, use, and processing of user information are authorized and agreed by the customer.

[0073] The present invention can automatically extract specific entities and relationships based on historical risks, and build a historical risk directed graph based on this to describe historical risk points and their corresponding program changes; at the same time, when the current program changes, the directed graph of the current program changes can also be automatically extracted. Based on the constructed directed graph, when the program code changes, the trained graph neural network model is used to automatically evaluate the code changes, sort out the impact of the code changes, and provide the nodes that need to be focused on, so as to quickly and accurately predict the risks of program changes. The present invention is described in detail below with reference to the accompanying drawings.

[0074] Figure 1 : is a flow chart of a method for predicting program change risk in an embodiment of the present invention. Figure 1 As shown in the figure, the program change risk prediction methods include:

[0075] S101: Obtain target change program.

[0076] S102: Generate a target program change directed graph according to the target change program.

[0077] For example, when a code segment K changes, a target program change directed graph associated with the K code segment can be generated.

[0078] S103: Input the target program change directed graph and the historical risk structure graph into a program change risk model to obtain program change risk.

[0079] Among them, the program change risk includes the risk type, and the test can be focused on this risk.

[0080] Figure 1 The execution subject of the program change risk prediction method shown is a computer. Figure 1 As can be seen from the process shown, the program change risk prediction method and device of the embodiment of the present invention generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk. This can quickly and accurately predict the risk of program changes, ensure stable program operation, and reduce risk losses.

[0081] Figure 2 is a flow chart of generating a historical risk structure diagram in an embodiment of the present invention. Figure 2 As shown, the program change risk prediction method also includes:

[0082] S201: Determine a risk event label according to the actual risk data.

[0083] The risk event label includes the risk event name, risk event keywords and risk event procedure.

[0084] In specific implementation, risk event labels can be determined through risk report text analysis, program error log analysis, program error code analysis, etc. Taking risk report text analysis as an example, when a risk event occurs in a program, the risk report should include the risk event number, the cause of the risk event, the program attributing the risk event, the impact of the risk event, etc., and the risk event label is constructed through text analysis.

[0085] Figure 3 is a flow chart of S201 in an embodiment of the present invention. Figure 3 As shown, S201 includes:

[0086] S301: Determine the risk event name, risk event cause, risk event impact and risk event procedure according to the actual risk data.

[0087] Among them, the risk event label name is the risk event number; according to the risk event attribution program, the program corresponding to the risk event can be further located, so as to sort out the program changes.

[0088] S302: Determine the risk event keyword according to the risk event cause and the risk event impact.

[0089] In specific implementation, the risk event keywords can be determined through word frequency analysis. For example, when three of the words in the risk event causes and risk event impacts are the top three words with practical significance in terms of frequency of occurrence, these three words can be used as the risk event keywords for the historical risk event.

[0090] S202: Determine a change code attribute according to the risk event program corresponding to the risk event label.

[0091] In specific implementation, assume that there is currently a risk event A. The corresponding program of the risk event in the risk report shows that the program that caused the risk event in the current period is program B. Therefore, the changes that occurred in program B in this period are further sorted out. By comparing the code texts of the previous and next versions, it can be sorted out that program B has three changes, X, Y, and Z, in this period. By evaluating these three changes, it is found that the breakpoint occurs at X. The breakpoint can be found by analyzing the production log or executing the code segment. For example, there is ERROR-level information in the production log.

[0092] In addition, there may be a situation where no program changes have occurred in the current period, but the error breakpoint is still in the program. This situation is caused by changes in the upstream and downstream programs, resulting in incompatibility between the programs. Assume that only program B has been changed in this period, but the program that caused the risk event in the current period is program D. Although change X may run correctly in program B, when it is transferred to program D, it may not be processed because program D is not compatible with the changes in program B in this period, thus triggering a production event. Therefore, the corresponding code snippet in program D should also be extracted. In addition, for the extracted code snippets, their relevant attributes should also be marked, such as the type of change in this period (addition of fields, deletion of fields, change of dictionary values, etc.), program function type (online trading, batch processing, data synchronization, etc.), code change degree (code amount change range can be divided into large, medium, small, etc.), and other attributes.

[0093] Among them, the change code attribute is mainly obtained through the code amount change range. The code change range mainly refers to the code modification amount of each change in the current program change. For example, there are three changes X, Y, and Z in program B, among which the code modification amount at X is 1000 lines, the code modification amount at Y is 500 lines, and the code modification amount at Z is 100 lines. According to the threshold set in advance, if it is higher than 600 lines, it is considered that the code change degree is large, and if it is lower than 300 lines, it is considered that the code change degree is small, and the rest is the code change degree is medium.

[0094] S203: Generate the historical risk structure diagram according to the risk event label and the change code attribute.

[0095] For example, under the label of historical risk event A, there are three program code changes corresponding to B, C, and D, among which B is the program code fragment that triggers the risk event, and D is the direct program where the risk event error occurs. From this, we can obtain the BCD directed graph (historical risk structure graph), and the risk point in B must be marked in the directed graph, that is, the attributes of the risk point are added to the node attributes of B.

[0096] Figure 4 1 is a flow chart of creating a program change risk model in an embodiment of the present invention. Figure 4 As shown, the steps to create a program change risk model include:

[0097] S401: Determine a directed graph of historical program changes according to historical program changes.

[0098] S402: Determine program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph.

[0099] Figure 5 4 is a flow chart of S402 in an embodiment of the present invention. Figure 5 As shown, S402 includes:

[0100] S501: Determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph.

[0101] Figure 6 is a flow chart of S501 in an embodiment of the present invention. Figure 6 As shown, S501 includes:

[0102] S601: Determine a historical program change vector according to the historical program change directed graph and the first program change risk model parameters, and determine a historical risk vector according to the historical risk structure graph and the first program change risk model parameters.

[0103] In the specific implementation, the historical program change directed graph and the historical risk structure graph need to be vectorized first. The historical program change directed graph extracts the code fragments where program changes have occurred and extends them to their final nodes, thereby forming a directed graph of several program changes. Both the historical program change directed graph and the historical risk structure graph are graph structure data and cannot be directly included as input variables in the model training process. Therefore, the graph structure data needs to be vectorized first.

[0104] The present invention can be processed by convolution extraction, but is not limited to this method. Convolution extraction first performs onehot encoding on the graph structure, that is, encoding each node and each edge in the graph structure and converting it into a data matrix; then convolution compression is performed on the data matrix, and the features of each neighbor node are weighted. The specific processing function is:

[0105]

[0106] Among them, y(u n ) is the historical program change vector or historical risk vector of the nth directed graph node; f 1 As the activation function, you can use functions such as relu and sigmoid; d n is the frequency of the nth directed graph node, d m is the frequency of the mth directed graph node, u m is the data matrix of the mth directed graph node, and the first program change risk model parameters include the first program change risk model weight W 1 and the first procedure changes the risk model bias b 1 .

[0107] S602: Determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change vector, the historical risk vector and the second program change risk model parameter.

[0108] Among them, the inner product between two vectors can be used to determine the similarity between the pair of vectors, and the similarity calculation function used is the formula for inner product calculation using a neural tensor network.

[0109] S502: Determine program risk prediction data according to the similarity and a preset similarity coefficient.

[0110] Figure 7 is a flow chart of S502 in an embodiment of the present invention. Figure 7 As shown, S502 includes:

[0111] S701: Determine comprehensive risk data according to the similarity and the similarity coefficient.

[0112] In specific implementation, the historical risk value can be calculated by weighted average, using historical risk label attributes such as the number of historical risk occurrences and risk impact levels as similarity coefficients. Taking the number of historical risk occurrences as an example, there are currently two types of risk events, F and G, of which the historical number of risk event F accounts for 0.8, and the historical number of risk event G accounts for 0.2. The risk event H that has occurred now has similarities calculated with the historical risk structure diagrams of risk events F and G, respectively, of f and g, so it can be calculated that the comprehensive risk data of risk event H is 0.8f+0.2g.

[0113] S702: Determine the program risk prediction data according to the comparison result of the comprehensive risk data and the preset risk threshold.

[0114] For example, when the comprehensive risk data is greater than the risk threshold, it is considered that there is a risk and the model output is 1; otherwise, it is considered that there is no risk and the model output is 0.

[0115] S403: Iteratively adjusting the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program.

[0116] S404: When the current number of iterations is equal to the preset number of iterations, a program change risk model is created according to the program change risk model parameters.

[0117] The specific process of the embodiment of the present invention is as follows:

[0118] 1. Determine the risk event name, risk event cause, risk event impact and risk event procedure based on the actual risk data.

[0119] 2. Determine the risk event keywords based on the risk event cause and the risk event impact.

[0120] 3. Determine the change code attribute according to the risk event program corresponding to the risk event label, and generate the historical risk structure diagram according to the risk event label and the change code attribute.

[0121] 4. Determine a historical program change vector based on the historical program change directed graph and the first program change risk model parameters, and determine a historical risk vector based on the historical risk structure graph and the first program change risk model parameters.

[0122] 5. Determine the similarity between the historical program change directed graph and each historical risk structure graph based on the historical program change vector, the historical risk vector and the second program change risk model parameter.

[0123] 6. Determine comprehensive risk data based on the similarity and the similarity coefficient.

[0124] 7. Determine the program risk prediction data based on the comparison result between the comprehensive risk data and the preset risk threshold.

[0125] 8. Iteratively adjust the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program.

[0126] 9. When the current number of iterations is equal to the preset number of iterations, a program change risk model is created according to the program change risk model parameters.

[0127] 10. Obtain a target change program, and generate a target program change directed graph according to the target change program.

[0128] 11. Input the target program change directed graph and the historical risk structure graph into a program change risk model to obtain the program change risk.

[0129] In summary, the program change risk prediction method provided by the embodiment of the present invention can quickly and accurately predict the risks of program changes, avoid the risk situations that have occurred in history, thereby ensuring the stability of program operation and reducing the risk losses caused by program changes.

[0130] Based on the same inventive concept, an embodiment of the present invention also provides a program change risk prediction device. Since the principle of solving the problem by the device is similar to that of the program change risk prediction method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0131] Figure 8 is a structural block diagram of a program change risk prediction device in an embodiment of the present invention. Figure 8 As shown, the program change risk prediction device includes:

[0132] An acquisition module, used for acquiring a target change program;

[0133] A target program change directed graph module, used for generating a target program change directed graph according to the target change program;

[0134] The program change risk module is used to input the target program change directed graph and the historical risk structure graph into the program change risk model to obtain the program change risk.

[0135] In one embodiment, it also includes:

[0136] A historical program change directed graph module is used to determine a historical program change directed graph according to the historical change program;

[0137] A program risk prediction data module, used to determine program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph;

[0138] An iteration module, used for iteratively adjusting the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program;

[0139] The program change risk model creation module is used to create a program change risk model according to the program change risk model parameters when the current iteration number is equal to the preset iteration number.

[0140] In one embodiment, the program risk prediction data module includes:

[0141] A similarity unit, used to determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph;

[0142] A program risk prediction data unit is used to determine program risk prediction data according to the similarity and a preset similarity coefficient.

[0143] In one embodiment, the similarity unit includes:

[0144] A historical risk vector subunit, used to determine the historical program change vector according to the historical program change directed graph and the first program change risk model parameters, and to determine the historical risk vector according to the historical risk structure graph and the first program change risk model parameters;

[0145] The similarity subunit is used to determine the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change vector, the historical risk vector and the second program change risk model parameter.

[0146] In one embodiment, the program risk prediction data unit includes:

[0147] A comprehensive risk data subunit, configured to determine comprehensive risk data according to the similarity and the similarity coefficient;

[0148] The program risk prediction data subunit is used to determine the program risk prediction data according to the comparison result between the comprehensive risk data and the preset risk threshold.

[0149] In one embodiment, it also includes:

[0150] A risk event label module, used to determine a risk event label according to the actual risk data;

[0151] A change code attribute module, used to determine the change code attribute according to the risk event program corresponding to the risk event label;

[0152] The historical risk structure diagram module is used to generate the historical risk structure diagram according to the risk event label and the change code attribute.

[0153] In one embodiment, the risk event label includes a risk event name, a risk event keyword, and a risk event procedure;

[0154] The risk event label module includes:

[0155] A risk parameter determination unit, configured to determine the risk event name, risk event cause, risk event impact and risk event procedure according to the actual risk data;

[0156] The risk event keyword unit is used to determine the risk event keyword according to the risk event cause and the risk event impact.

[0157] In practical applications, the program change risk prediction device includes a historical risk label acquisition module, a program change acquisition module, a historical risk directed graph generation module, a graph neural network training module and a risk point prediction module.

[0158] The historical risk label acquisition module includes a risk event label module, which is used to extract and summarize production and operation problems that have occurred in history, and organize the corresponding code changes, and finally form a program change relationship that marks historical risk points for subsequent directed graph generation.

[0159] The program change acquisition module includes a change code attribute module. Based on the risk event corresponding program in the historical risk label, it first obtains the program to which the risk event belongs, then sorts out the modifications that have occurred in the program during the period, and finally obtains the program change code fragment that triggers the risk event.

[0160] The historical risk directed graph generation module includes a historical risk structure graph module. After completing the acquisition of historical risk labels and program changes, the two are combined to form the final directed graph module. Based on the extraction of the above two modules, historical risk labels and their corresponding program change code snippets are currently obtained. By extracting and combining program change code snippets under historical risk labels, a risk directed graph corresponding to the risk label can be obtained.

[0161] The graph neural network training module includes a historical program change directed graph module, a program risk prediction data module, an iteration module and a program change risk model creation module. After obtaining the historical risk directed graph, the graph neural network is used to judge the graph similarity between the changed program directed graph and the historical risk directed graph, thereby deriving a training process to determine whether the program change will involve risks.

[0162] The test scope and strategy prediction module includes an acquisition module, a target program change directed graph module and a program change risk module. It is used to perform dynamic analysis based on the program changes after the graph neural network model training is completed to determine whether there are risks in the program changes.

[0163] In summary, the program change risk prediction device of the embodiment of the present invention generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk. It can quickly and accurately predict the risk of program changes, ensure stable program operation, and reduce risk losses.

[0164] Fig. 9 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig. 9 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig. 9 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0165] In one embodiment, the program change risk prediction method function may be integrated into the central processing unit 9100. The central processing unit 9100 may be configured to perform the following control:

[0166] Obtain target change procedures;

[0167] Generate a target program change directed graph according to the target change program;

[0168] The target program change directed graph and the historical risk structure graph are input into a program change risk model to obtain the program change risk.

[0169] From the above description, it can be seen that the program change risk prediction method provided in the present application generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk. This method can quickly and accurately predict the risk of program changes, ensure stable program operation, and reduce risk losses.

[0170] In another embodiment, the program change risk prediction device can be configured separately from the central processing unit 9100. For example, the program change risk prediction device can be configured as a chip connected to the central processing unit 9100, and the function of the program change risk prediction method can be implemented through the control of the central processing unit.

[0171] like Fig. 9 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig. 9 In addition, the electronic device 9600 may also include Fig. 9 For components not shown, reference may be made to the prior art.

[0172] like Fig. 9 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0173] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0174] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0175] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer 9141 (sometimes referred to as a buffer memory). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

[0176] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0177] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0178] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0179] The embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps of the program change risk prediction method in the above embodiment, where the execution subject is a server or a client. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all the steps of the program change risk prediction method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0180] Obtain target change procedures;

[0181] Generate a target program change directed graph according to the target change program;

[0182] The target program change directed graph and the historical risk structure graph are input into a program change risk model to obtain the program change risk.

[0183] In summary, the computer-readable storage medium of the embodiment of the present invention generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk, which can quickly and accurately predict the risk of program changes, ensure stable program operation, and reduce risk losses.

[0184] The embodiment of the present invention also provides a computer program product capable of implementing all the steps of the program change risk prediction method in the above embodiment, where the execution subject is a server or a client. The computer program product includes a computer program / instruction. When the computer program / instruction is executed by a processor, all the steps of the program change risk prediction method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0185] Obtain target change procedures;

[0186] Generate a target program change directed graph according to the target change program;

[0187] The target program change directed graph and the historical risk structure graph are input into a program change risk model to obtain the program change risk.

[0188] In summary, the computer program product of the embodiment of the present invention generates a target program change directed graph based on the target change program, inputs the target program change directed graph and the historical risk structure graph into the program change risk model, and obtains the program change risk. It can quickly and accurately predict the risk of program changes, ensure stable program operation, and reduce risk losses.

[0189] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0190] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0191] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0192] Although the present specification embodiment provides the method operation steps as described in the embodiment or flow chart, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiment is only one way in the order of execution of many steps, and does not represent a unique execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel (such as a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment) according to the method shown in the embodiment or the accompanying drawings. The term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements not only includes those elements, but also includes other elements not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements.

[0193] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing the embodiments of this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0194] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.

[0195] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0196] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0198] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0199] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0200] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0201] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, the embodiments of this specification may take the form of complete hardware embodiments, complete software embodiments or embodiments combining software and hardware. Moreover, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0202] The various embodiments in this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0203] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiments of this specification. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0204] The above is only an example of the embodiment of the present specification and is not intended to limit the embodiment of the present specification. For those skilled in the art, the embodiment of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiment of the present specification shall be included in the scope of the claims of the embodiment of the present specification.

Claims

1. A method for predicting program change risk, characterized in that: include: Obtain target change procedures; Generate a target program change directed graph according to the target change program; The target program change directed graph and the historical risk structure graph are input into a program change risk model to obtain the program change risk.

2. The program change risk prediction method according to claim 1, characterized in that: The steps to create a program change risk model include: Determine a directed graph of historical program changes according to the historical change program; Determine program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph; Iteratively adjust the program change risk model parameters according to the program risk prediction data and the actual risk data corresponding to the historically changed program; When the current iteration number is equal to the preset iteration number, a program change risk model is created according to the program change risk model parameters.

3. The program change risk prediction method according to claim 2, characterized in that: Determining program risk prediction data according to the historical program change directed graph, program change risk model parameters and the historical risk structure graph includes: Determining the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph; The program risk prediction data is determined according to the similarity and a preset similarity coefficient.

4. The method for predicting program change risk according to claim 3, characterized in that: Determining the similarity between the historical program change directed graph and each historical risk structure graph according to the historical program change directed graph, the program change risk model parameters and the historical risk structure graph includes: Determine a historical program change vector according to the historical program change directed graph and the first program change risk model parameters, and determine a historical risk vector according to the historical risk structure graph and the first program change risk model parameters; The similarity between the historical program change directed graph and each historical risk structure graph is determined according to the historical program change vector, the historical risk vector and the second program change risk model parameter.

5. The method for predicting program change risk according to claim 3, characterized in that: Determining the program risk prediction data according to the similarity and the preset similarity coefficient includes: Determining comprehensive risk data according to the similarity and the similarity coefficient; The program risk prediction data is determined based on a comparison result between the comprehensive risk data and a preset risk threshold.

6. The method for predicting program change risk according to claim 2, characterized in that: Also includes: determining a risk event label according to the actual risk data; Determine the change code attribute according to the risk event program corresponding to the risk event label; The historical risk structure diagram is generated according to the risk event label and the change code attribute.

7. The method for predicting program change risk according to claim 6, characterized in that: The risk event label includes the risk event name, risk event keywords and risk event procedure; Determining the risk event label according to the actual risk data includes: Determine the risk event name, risk event cause, risk event impact and risk event procedure based on the actual risk data; The risk event keywords are determined according to the risk event cause and the risk event impact.

8. A program change risk prediction device, characterized in that: include: An acquisition module, used for acquiring a target change program; A target program change directed graph module, used for generating a target program change directed graph according to the target change program; The program change risk module is used to input the target program change directed graph and the historical risk structure graph into the program change risk model to obtain the program change risk.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the program change risk prediction method described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the program change risk prediction method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Incremental code defect detection method and system based on graph network model

    CN113127341A

  • Model training method and device, test method and device, electronic equipment and storage medium

    CN113296836A

  • Program change influence range identification method and device, equipment and storage medium

    CN114201399A

  • Pull request risk prediction for bug-introducing changes

    US11645188B1