Program development system
The program development system uses generative AI to address diverse code errors, improving code quality and productivity by automatically correcting and retesting source code to meet quality standards.
Patent Information
- Application Number
- JP2024132111
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2026-02-20
AI Technical Summary
Conventional software program development systems struggle to automatically correct all types of errors, including those that affect functionality, output, security vulnerabilities, and maintainability, especially when source code fragments are numerous.
A program development system utilizing generative AI to automatically classify errors, create correction instructions, and correct source code, including improving readability and security, through a program creation, test implementation, classification, and correction processing units.
Automatically corrects source code to meet quality requirements, simplifies complex branching, and enhances development productivity by retesting and refining code quality.
Smart Images

Figure 2026029278000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a software program development technique, and more particularly to a technique that is effective when applied to a program correction system that corrects programs that do not satisfy quality requirements. [Background technology]
[0002] In typical software program development, for example, when a developer develops and creates source code and commits it, the required quality inspections and compilation (build) are carried out, followed by testing. If an error occurs during the build or test, the source code is returned to the developer, corrected, and retested. Systems are being considered to streamline this series of processes and support developers.
[0003] For example, Japanese Patent Publication No. 2022-041562 (Patent Document 1) describes a development support device that is equipped with an acquisition means for acquiring errors output as a result of executing a build on source code, and a selection means for selecting an external server device from multiple external server devices that is presumed to have a solution to the acquired error, and that is capable of efficiently acquiring solutions (modifications to source code) to errors that occur during the development of a software product.
[0004] In addition, Japanese Patent Publication No. 2022-165926 (Patent Document 2) describes generating bug patterns containing bug scenarios that may cause errors from source code fragments (buggy snippets) containing errors contained in questions about errors posted on software developer forums, and comparing these with source code under development to identify or generate repairs for errors in source code under development. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] Japanese Patent Publication No. 2022-041562 [Patent Document 2] Japanese Patent Publication No. 2022-165926 Summary of the Invention [Problem to be solved by the invention]
[0006] According to conventional technology, it is possible to create and present corrections for source code containing errors. However, while it is relatively easy to create corrections mechanically to a certain extent for errors that would cause errors during build, such as grammatical errors in the source code, it is difficult to create corrections for all errors, including errors where the functionality or output does not meet the specifications or errors that cause security vulnerabilities. Furthermore, when the number of source code fragments is large, it is difficult for developers to manually reflect the proposed corrections in the source code.
[0007] Therefore, an object of the present invention is to provide a program development system that can automatically instruct, correct, and retest source code when an error is detected during program quality inspection or building, i.e., when the program does not meet quality requirements.
[0008] The above and other objects and novel features of the present invention will become apparent from the description of this specification and the accompanying drawings. [Means for solving the problem]
[0009] Among the inventions disclosed in this application, the outline of representative inventions will be briefly explained as follows.
[0010] A program correction system that is a representative embodiment of the present invention is a program development system that corrects source code that contains errors, and includes a program creation unit that builds the source code to create a program, a test implementation unit that tests the program and performs specified checks on the source code, a classification processing unit that uses a generation AI to classify errors detected by the test implementation unit based on the type and content of the error, a correction instruction creation unit that uses a generation AI to create correction instructions for the error from a template corresponding to the error classified by the classification processing unit, and a correction processing unit that uses the generation AI to correct the source code based on the correction instructions. [Effects of the Invention]
[0011] The effects obtained by the representative inventions disclosed in this application can be briefly explained as follows.
[0012] That is, according to the representative embodiment of the present invention, when a program does not satisfy quality requirements, it is possible to automatically issue instructions to correct the source code, correct the code, and perform retesting. [Brief explanation of the drawings]
[0013] [Figure 1] 1 is a diagram illustrating an overview of a configuration example of a program development system according to an embodiment of the present invention. [Figure 2] 10 is a flowchart outlining an example of the flow of a process for automatically correcting source code according to an embodiment of the present invention. [Figure 3] This is a diagram outlining an example of source code with low maintainability and readability. [Figure 4] FIG. 10 is a diagram showing an outline of an example of modified source code according to an embodiment of the present invention. [Figure 5] FIG. 10 is a diagram outlining an example of a prompt for causing a correction instruction creating unit to create a correction instruction in an embodiment of the present invention. [Figure 6] FIG. 10 is a diagram showing an outline of an example of a correction instruction created by a correction instruction creating unit in the embodiment of the present invention. [Figure 7] FIG. 1 is a diagram showing an outline of an example of source code before modification according to an embodiment of the present invention. [Figure 8] FIG. 10 is a diagram showing an outline of an example of source code modifications recommended to a developer according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0014] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In all drawings used to explain the embodiments, the same parts are generally designated by the same reference numerals, and repeated explanations will be omitted. However, parts that have been designated and explained in one drawing may be referred to by the same reference numerals in the explanation of other drawings, although they will not be shown again.
[0015] <Summary> As mentioned above, when developing a program, it is relatively easy to create fixes mechanically to a certain extent for errors that would cause build errors, such as grammatical errors in the source code, and there are development tools that can create and instruct fixes or automatically correct them. However, it is difficult to create fixes that cover all errors that do not meet the quality requirements of the program, including errors where the functionality or output does not meet the specifications, errors that pose security vulnerabilities, and even source code that is difficult to maintain or read (source code that poses a risk of inducing future errors). Furthermore, when the number of source code fragments becomes large, it becomes difficult for developers to manually reflect the proposed fixes in the source code.
[0016] Therefore, one embodiment of the present invention, a program development system, uses so-called generative AI (Artificial Intelligence) such as ChatGPT (registered trademark) to automatically create correction instructions for source code (including test code) containing errors such as those described above, and makes it possible to automatically correct and retest the source code based on these instructions.
[0017] Figure 3 shows an example of source code with low maintainability and readability. In the source code shown in the figure, if statements are deeply nested within a method ((1) in the figure), and depending on the branch decision results in a series of if statements, the subsequent processing ((2) in the figure) is executed. Such deeply nested if statements reduce readability, making subsequent corrections difficult and creating an inherent risk of introducing errors.
[0018] FIG. 4 is a diagram outlining an example of source code after correction in one embodiment of the present invention. The source code in the diagram shows an example in which the source code in FIG. 3 described above has been automatically corrected by the program development system of this embodiment. In this example, the method name and arguments are maintained, but the processing within the method is divided into multiple methods (a method for branch decision ((4) in the diagram) and a method for processing after the branch decision ((5) in the diagram)), and the correction is made so that each method is called ((3) in the diagram). In addition, in the method that makes branch decision, deeply nested if statements are converted to switch statements ((4) in the diagram) while keeping the logic intact, improving readability.
[0019] In this way, this embodiment simplifies branching processes that are prone to errors when corrected manually, making it possible to automatically correct low-quality source code that is difficult to correct mechanically.
[0020] <System configuration> 1 is a diagram showing an overview of an example configuration of a program development system 1 according to an embodiment of the present invention. The program development system 1 is an information processing system that is configured, for example, by one or more server devices, virtual servers constructed on a cloud computing service, or information processing terminals, and that realizes various functions related to the development and maintenance of software programs by executing middleware such as an OS (Operating System), a DBMS (Database Management System), and a Web server program, which are loaded onto memory from a storage device such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive), and software that runs on the OS (Operating System), which are loaded onto memory from a storage device such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive), using a CPU (Central Processing Unit) (not shown).
[0021] This program development system 1 has various parts implemented as software, such as a program creation unit 11, a test implementation unit 12, a classification processing unit 21, a correction instruction creation unit 22, and a correction processing unit 23. It also has source code etc. 31 consisting of a repository that stores source code, test code, documents, etc. created by a developer 2. The classification processing unit 21, the correction instruction creation unit 22, and the correction processing unit 23 can each access and use a generation AI 20 implemented in an external or local environment via an API (Application Programming Interface) or the like.
[0022] The program creation unit 11 has a function of compiling and building the source code stored in the source code etc. 31 to create an executable program. It may also have a function of separately performing predetermined checks on the source code regarding quality such as maintainability and readability, and may be configured to use the generation AI 20 to realize the check function. It may also have a function of performing unit testing on the created program.
[0023] The test execution unit 12 has a function of performing predetermined tests on the program built by the program creation unit 11 based on test cases, etc. It may also have a function of performing unit tests on the program. It may also have a function of performing predetermined quality checks on source code, such as maintainability and readability. For example, various tests may be performed, such as calling APIs from external or other programs, screen transitions, the contents of output data in response to input data, and verification of security vulnerabilities. These tests are preferably performed automatically using known technology, but may also be performed manually by the developer 2.
[0024] The classification processing unit 21 has a function to classify errors detected by the check function in the program creation unit 11 or the results of testing in the test execution unit 12 according to their type and content (i.e., points to be corrected) using the generation AI 20. As described above, the types of errors include, for example, errors in which the program does not function or output as specified, errors due to security vulnerabilities, and source code with low maintainability and readability. In addition, because the correction content for each type differs depending on the type of security vulnerability, the error content (error pattern) is also classified.
[0025] The correction instruction creation unit 22 has a function of creating correction instructions for the generation AI 20 from correction instruction templates 32 prepared in advance for each error pattern (i.e., for each point to be corrected) based on the error classification results of the classification processing unit 21. The correction instructions created here are instructions (prompts) for the generation AI 20 to correct the source code. The details of the correction instruction processing will be described later.
[0026] The correction processing unit 23 has a function of correcting the source code using the generation AI 20 based on the correction instructions (prompts) created by the correction instruction creation unit 22. The corrected source code is stored in the source code etc. 31, and can be rebuilt by the program creation unit 11 to create a program. The details of the correction process will also be described later.
[0027] <Processing flow> 2 is a flowchart outlining an example of the flow of automatic source code correction processing in one embodiment of the present invention. First, developer 2 develops source code (S01). The developed source code is committed and registered in source code, etc. 31. Then, program creation unit 11 performs a quality inspection of the source code to determine whether it satisfies predetermined check items, such as low maintainability and low readability (S02). Around the same time, the source code is compiled or otherwise built to create a program (S03), and the created program is automatically tested by test execution unit 12 (S04).
[0028] Thereafter, it is determined whether or not there are any errors in the results of the quality inspection in step S02 and the test in step S04 (S05), and if there are no errors (No in step S05), the automatic correction process ends. On the other hand, if there are errors (Yes in step S05), it is determined whether the number of repeated errors has reached an upper limit (e.g., three times) (S06).
[0029] If the number of times the error has been repeated has not reached the upper limit (No in step S06), the classification processing unit 21 first classifies the content of the error into an error pattern using the generation AI 20 (S07), and the correction instruction creation unit 22 then selects a correction instruction template 32 corresponding to the error pattern using the generation AI 20 (S08), and creates a correction instruction (S09).
[0030] 5 is a diagram outlining an example of a prompt for causing the modification instruction creation unit 22 to create a modification instruction in one embodiment of the present invention. In the example of FIG. 5, for source code that is at risk of a security vulnerability (shown as "SQL (Structured Query Language) injection" in the figure), the content explains the vulnerability and instructs the generation AI 20 to output a method for correcting the vulnerability. Note that in the example of FIG. 5, the content of the prompt is in Japanese, but depending on the implementation, the modification instructions output in English may tend to be more accurate depending on the generation AI 20 used.
[0031] Fig. 6 is a diagram outlining an example of a correction instruction created by the correction instruction creation unit 22 in one embodiment of the present invention. The example in Fig. 6 shows an example of a correction instruction (prompt) when source code with low maintainability and readability is rewritten (refactored) without changing the processing content, but the basic configuration is similar for correction instructions regarding errors in which the program's functions or output are not as specified or errors due to security vulnerabilities.
[0032] As shown in the example of Figure 6, the correction instructions specify the rules for correction in itemized form and also include examples of corrections to actual source code. For example, in the corresponding correction instruction template 32, the content of the actual source code is embedded in the "example" section by obtaining it from the source code, etc. 31, to create the correction instructions (prompt). Note that there is an upper limit to the number of tokens that can be specified in a prompt. For example, if the source code is long, it may be possible to split it into separate correction instructions (prompts) and then combine them after creation.
[0033] 2, when the correction instruction creating unit 22 creates a correction instruction in step S09, the correction processing unit 23 corrects the target source code based on the correction instruction, that is, the correction processing unit 23 reflects the contents of the correction instruction in the target source code (S10). Then, for the corrected source code, the process returns to step S02 and repeats the series of processes after the quality inspection until no errors occur (No in step S05) or until the upper limit number of errors is reached (Yes in S06).
[0034] If the upper limit of the number of errors has been reached (Yes in step S06), the developer 2 is notified that the errors have not converged even through automatic correction and that automatic correction is difficult (S11), and the automatic correction process ends. At this time, correction instructions created by the correction instruction creation unit 22 may also be output to the developer 2 and recommended as correction content.
[0035] FIG. 7 is a diagram outlining an example of source code before modification. This example shows code that executes an SQL statement to access a database. In contrast, FIG. 8 is a diagram outlining an example of source code modification content recommended to developer 2 in one embodiment of the present invention. Here, the content of the modification proposal recommended for the source code in the example of FIG. 7 includes not only a proposal for the modified source code, but also an explanation of the purpose of the modification proposal and the modification method, etc., so that developer 2 can understand it. These contents can also be created by the modification instruction creation unit 22 using the generation AI 20. Developer 2 can modify the source code himself by referring to the recommended modification proposal, and then re-execute the processes from the quality inspection in step S02 of FIG. 2 onward.
[0036] As described above, according to the program development system 1, which is one embodiment of the present invention, by using the generation AI 20 for source code containing errors, it is possible to automatically create correction instructions for low-quality source code that is difficult to correct mechanically, such as simplifying branching processing that is prone to errors when corrected manually, or source code that does not meet quality requirements, and to automatically correct and retest the source code based on these instructions, thereby improving the productivity of program development, maintenance, etc.
[0037] The invention made by the inventor has been specifically described above based on the embodiments, but it goes without saying that the present invention is not limited to the above embodiments and can be modified in various ways without departing from the spirit of the invention. Furthermore, the above embodiments have been described in detail to clearly explain the present invention, and the present invention is not necessarily limited to those having all of the described configurations. Furthermore, it is possible to add, delete, or replace part of the configuration of the above embodiments with other configurations.
[0038] Furthermore, the above-described configurations, functions, processing units, processing means, etc. may be partially or entirely implemented in hardware, for example, by designing them as integrated circuits. The above-described configurations, functions, etc. may also be implemented in software, with a processor interpreting and executing a program that implements each function. Information such as the programs, tables, and files that implement each function can be stored in a storage device such as a memory, hard disk, or SSD, or in a storage medium such as an IC card, SD card, or DVD.
[0039] In addition, in the above figures, the control lines and information lines shown are those that are considered necessary for explanation, and do not necessarily show all the control lines and information lines that are actually implemented. In reality, it can be assumed that almost all components are interconnected. [Industrial Applicability]
[0040] The present invention can be used in a program correction system that corrects a program that does not satisfy a quality requirement. [Explanation of symbols]
[0041] 1...Program development system, 2...Developer, 11...Program Creation Department, 12...Test Implementation Department, 20... generation AI, 21... classification processing unit, 22... correction instruction creation unit, 23... correction processing unit, 31...Source code, etc., 32...Modification instruction template
Claims
1. A program development system for correcting source code containing errors, A program creation department that builds source code and creates programs; a test execution unit that tests the program and performs predetermined checks on the source code; a classification processing unit that classifies the errors detected by the test execution unit based on the type and content of the errors using a generation AI; a correction instruction creation unit that creates correction instructions for the error using a generation AI from a template corresponding to the error classified by the classification processing unit; A program development system having a modification processing unit that modifies the source code using a generation AI based on the modification instruction.
2. 2. The program development system according to claim 1, A program development system, wherein the modification instructions include one or more rules and modification examples for causing a generation AI to create modifications to the source code.
3. 2. The program development system according to claim 1, In the program development system, the types of errors classified by the classification processing unit include errors that do not satisfy program specifications, errors due to security vulnerabilities, and source code with low readability.
4. 2. The program development system according to claim 1, A program development system in which, if the test implementation unit detects an error repeatedly more than a predetermined number of times, the system notifies the user and presents to the user the corrections to be made to the source code created by the generation AI based on the correction instructions in the correction processing unit.
Citation Information
Patent Citations
Development support device, method, and program
JP2022041562A
Semi-supervised bug pattern revision
JP2022165926A