AI Can Write Code. But Who Is Responsible for Its Quality?
How automated testing, code review, and CI/CD help us build reliable software with AI coding agents.
AI coding agents are no longer just suggesting code.
Some can analyze tasks, inspect repositories, modify multiple files, run tests, and prepare pull requests.
This changes how software is developed.
But it also brings an important question:
If AI writes a significant part of our code, who is responsible for its quality?
The real challenge is not whether AI can generate code.
It is whether that code actually solves the intended problem, remains secure, and can be maintained in the future.
Let's look at how we can approach this.
1. Working Code Does Not Always Mean Correct Code
One of the most dangerous assumptions in software development is believing that code is correct simply because it runs.
Imagine an e-commerce application with an order creation service.
We ask an AI coding agent to implement the following operations:
- Create an order.
- Decrease the available stock.
- Update the payment status.
- Save the order in the database.
The generated code might compile and even pass the existing tests.
But several important questions remain:
- What happens if two users purchase the last item simultaneously?
- What happens if payment succeeds but the order cannot be saved?
- Can the customer be charged twice if the same payment request is sent again?
- If the database fails halfway through the operation, is the stock restored?
These are not problems that can be solved simply by generating code.
They require an understanding of business rules, system architecture, and possible failure scenarios.
A program running successfully does not prove that it satisfies every requirement.
2. Why Should AI-Generated Code Be Reviewed?
Large language models generate code based on patterns learned from their training data.
However, a reasonable-looking solution is not necessarily compatible with the requirements of an existing project.
There are three common risks.
Misunderstanding the Context
AI might generate a correct function but misunderstand existing business rules or relationships between services.
Missing Edge Cases
The generated code may work under normal conditions but fail when it encounters:
- Empty data.
- Unauthorized access.
- Concurrent requests.
- Unexpected exceptions.
False Confidence
Code can look clean, well-documented, and professional.
But readability is not the same as correctness.
This is why AI-generated code should not be treated as automatically trustworthy.
3. How Do Professional Teams Verify Code Quality?
Whether we use AI or not, reliable software requires multiple layers of verification.
These layers serve different purposes.
A. Static Analysis: Inspecting Code Without Running It
Static analysis examines source code without executing it.
It can help identify:
- Unused variables.
- Suspicious code structures.
- Potential null reference problems.
- Coding standard violations.
- Certain security risks.
In Java projects, tools such as SonarQube, Checkstyle, and SpotBugs can be useful.
However, static analysis cannot prove that business logic is correct.
It identifies certain classes of problems, not every possible defect.
B. Automated Testing: Verifying Behavior
Automated tests check whether software produces the expected results under defined conditions.
Three important test types are:
Unit Tests
These test a small and isolated part of the application.
For example, we can verify whether an order total is calculated correctly.
Integration Tests
These verify whether multiple components work together.
In a Spring Boot application, we might test the interaction between services, repositories, and a real test database.
End-to-End Tests
These verify a complete user workflow.
For example:
- A user logs in.
- Selects a product.
- Creates an order.
- Receives the expected result.
But there is an important detail:
A passing test does not automatically mean that the test suite is comprehensive.
A poorly designed test can even pass when the actual implementation is wrong.
C. Code Review: Understanding the Change
Code review is the process of examining changes made by another developer.
It remains important when AI is involved.
When reviewing a pull request, we should ask:
- Does this change actually solve the requested problem?
- Is it consistent with the existing architecture?
- Does it introduce security risks?
- Does it add unnecessary complexity?
- Could it break existing business rules?
- Does it introduce new failure scenarios?
AI can help with initial reviews, identify suspicious code, and save developers time.
However, automatically accepting every AI-generated review comment is another mistake.
Human judgment is particularly important when evaluating business rules and architectural decisions.
4. CI/CD: Making Quality Checks Part of Development
Quality checks should not depend entirely on manual reviews after implementation.
Modern software teams integrate these checks into CI/CD pipelines.
Continuous Integration (CI) helps developers integrate code changes regularly and verify them through automated checks.
Continuous Delivery/Deployment (CD) prepares software for release or automatically deploys it under appropriate conditions.
For example, when a developer opens a pull request on GitHub, we can automatically:
- Build the project.
- Run unit and integration tests.
- Perform static analysis.
- Scan dependencies for known vulnerabilities.
- Report failed checks.
Tools such as GitHub Actions make this process possible.
This means AI-generated code must pass the same quality gates as code written manually.
The important point is not whether AI generated the code.
It is whether that code meets the project's quality requirements before being merged.
5. Human-in-the-Loop: Why Human Oversight Still Matters
As AI agents become more capable, a new development approach is becoming increasingly relevant: Human-in-the-Loop.
In this approach, AI can perform certain tasks independently, while humans remain involved at important decision points.
Imagine giving an AI agent the following task:
"Find the authorization issue in the product deletion endpoint, implement a fix, add tests, and prepare a pull request."
The agent might:
- Inspect the repository.
- Identify the relevant files.
- Modify the implementation.
- Add tests.
- Run the test suite.
- Prepare a pull request.
But someone still needs to evaluate the result.
Does the change actually fix the authorization problem?
Does it break the existing security architecture?
Is it safe to deploy?
The developer's role does not disappear.
Instead, developers increasingly need to evaluate the correctness, risks, and system-wide impact of generated solutions.
AI can take over more implementation work, but that does not automatically make the entire software lifecycle reliable.
6. A Practical Checklist for Developers
Before merging a feature developed with AI assistance, consider the following questions.
Code Correctness
- Does the implementation satisfy the requirements?
- Have edge cases been considered?
- Are existing business rules preserved?
Testing and Quality
- Are relevant unit tests included?
- Are integration tests necessary?
- Do the tests verify meaningful scenarios?
Security
- Are authorization checks implemented correctly?
- Have sensitive values accidentally entered logs or source control?
- Do dependencies contain known vulnerabilities?
Architecture and Maintainability
- Does the implementation fit the existing architecture?
- Has unnecessary complexity been introduced?
- Can another developer understand and maintain the code?
Final Verification
- Have CI/CD checks passed?
- Has the pull request been reviewed?
- Has the implementation been verified in the appropriate environment?
This checklist cannot eliminate every risk.
But it provides a practical starting point for preventing unverified AI-generated code from entering a project.
Conclusion: The Future Developer Must Be Able to Verify Code, Not Just Generate It
AI is making software development faster.
Tasks that previously took hours can sometimes be completed in much less time.
But speed and quality are not the same thing.
An AI agent generating thousands of lines of code does not prove that the implementation follows the correct architecture, is secure, or satisfies real user requirements.
The important skills are still understanding requirements, knowing how systems work, evaluating risks, and verifying the final result.
AI can generate code.
But evaluating what that code actually does, what risks it introduces, and whether it is ready for production remains a serious engineering responsibility.
Perhaps one of the most important skills that will distinguish developers in the coming years will not be how much code they can generate.
It will be how well they can evaluate the quality of the code they produce.
What do you think? Will code review become even more important as AI agents take on more development tasks?
I'd love to hear your perspective.
Further reading: GitHub Actions Documentation · OWASP Application Security Verification Standard

Top comments (0)