AI Code Acceptance: Why Review is Still Essential Beyond Specs and Tests
The rise of AI-generated code raises a critical question: if specifications are clear and automated tests pass, can we skip code review? This article argues that while specs and tests are necessary, they are insufficient for comprehensive quality assurance. It explores the limitations of specifications and test harnesses, the hidden risks of AI generating both implementation and tests, and introduces a risk-based review framework to maintain software quality and accountability in the AI era.
1. The Issue is Evidence, Not Authorship
After AI generates code, is code review still necessary? If the requirements specification is clear enough and automated acceptance tests pass, can the code be merged directly?
The conclusion is clear: Specs and tests are necessary validation criteria, but they are usually insufficient to bear the full judgment of software quality alone. Code review is still needed, but it should shift from line-by-line checking to risk-driven, evidence-oriented review.
Here, “Spec” refers to requirements and behavioral specifications, while “Harness” refers to the acceptance framework that organizes test execution, prepares test environments, and evaluates results. They answer “what the system should do” and “whether the system does it under given conditions,” respectively.
Code review supplements these by answering additional questions:
- Is the implementation based on correct business assumptions?
- Are there failure paths not yet covered by tests?
- Do permissions, data consistency, and resource usage comply with system constraints?
- Does the code introduce unnecessary complexity, increasing future modification costs?
- Does this change weaken existing test and security boundaries?
Therefore, arguing over whether to “only look at behavior” or “also look at code” creates a false dichotomy. The real judgment needed is: which risks can be covered by automated evidence, which still require human analysis, and is this evidence trustworthy?
2. AI Accelerates Code Generation, Not Understanding
Code commits in traditional development could also be massive and not naturally easy to review. However, AI has significantly lowered the cost of batch code generation: interfaces, data structures, tests, configurations, and documentation can be produced simultaneously in a very short time.
This creates a new engineering imbalance: generation speed increases rapidly, while verification and understanding capabilities may not keep pace.
A commit with massive changes, even with detailed descriptions, can mask truly important modifications. For example, the bulk might be standard data query logic, but mixed in could be an adjustment to a permission check, a change in transaction boundaries, and a modification to a failure retry strategy. The risks of these three changes may far exceed those of the rest of the code.
AI-generated descriptions cannot be naturally treated as reliable evidence. They might accurately summarize design intent but miss the deviation between actual implementation and intent. Therefore, documentation should be the entry point for review, not the conclusion.
What teams need to control first is not “how many lines a human can review per day,” but “how many independent concepts need to be understood per commit.” Rather than mechanically limiting line counts, more effective practices include:
- A commit should solve only one primary problem.
- Separate structural adjustments from behavioral changes as much as possible.
- Provide separate explanations for data migrations, permission changes, and interface compatibility.
- Clarify what is automatically generated versus what constitutes key business decisions.
- Commit descriptions should also list uncovered scenarios and known limitations.
Code can be generated quickly, but the boundaries of responsibility cannot be blurred accordingly.
3. The Limits of Specs: Complete Does Not Mean Exhaustive Risk
The value of a specification lies in making implicit requirements explicit. However, real-world specs often describe only the happy path, such as “After a user submits an application, the system updates the status and sends a notification.”
This description does not answer:
- Does repeated submission by the user require idempotent processing?
- How to recover if the update succeeds but the notification fails?
- Can a user operate on someone else’s application?
- When multiple requests modify the status simultaneously, which result is valid?
- How are incomplete operations handled after a service interruption?
- Does all historical data satisfy the new field constraints?
If these questions are not in the spec, the acceptance framework can hardly verify them out of thin air.
This is especially true in existing systems, where correctness often relies on undocumented constraints: a certain field cannot regress, certain operations must retain audit records, a specific downstream call cannot be inside a database transaction. These constraints may be hidden in legacy code, operational experience, and business habits.
Therefore, a high-quality Spec should not only have functional descriptions but also include:
- Preconditions: Under what circumstances the operation is allowed.
- Invariants: Rules that must hold true before and after execution.
- Failure semantics: What partial success, timeout, cancellation, and retry mean respectively.
- Non-functional constraints: Security, performance, resource consumption, and observability requirements.
- Compatibility requirements: How old interfaces, old data, and old calling methods are handled.
- Explicit non-goals: Which problems this change does not solve.
But even if these are achieved, one cannot easily claim that the spec covers all risks. The specification itself also needs review.
4. The Limits of Harness: Passing Tests Only Proves Performance Under Limited Conditions
Passing tests means the system has not exposed problems under the executed test conditions and judgment rules. It is not directly equivalent to “correct under all circumstances.”
1. Test inputs do not equal the real input space
Typical use cases are easy to cover, but complex combinations are hard to exhaust. For example, empty data, massive inputs, abnormal encoding, concurrent requests, clock changes, and external dependency timeouts might be tested individually, but new problems can still arise when they occur simultaneously.
For systems with many states, boundary testing, random input testing, state transition testing, and invariant-based checks can be added. However, these methods still have scopes of application; no single testing technique should be treated as a complete guarantee.
2. Judgment rules may contain bias
The acceptance framework needs a source for the “correct answer.” If the expected result comes from a misunderstanding, the test will reliably verify incorrect behavior.
For example, if the requirement explicitly requires data isolation by tenant, but the test only verifies the fields and sorting of the query results without constructing a cross-tenant access scenario, data isolation may still fail even if all tests pass.
This is why critical tests must be traced back to business rules, rather than just being reverse-generated from implementation code.
3. Test environments may mask real risks
Substituting dependencies, simplifying data, and using a single-process environment help execute tests quickly, but they can also hide the behavior of the real system:
- Mocked dependencies return immediately, while real calls might timeout.
- Test data volume is small, while real queries might scan massive records.
- Sequential execution works fine, but concurrency causes duplicate writes.
- New environments have no issues, but migrating existing data fails.
The acceptance framework needs to be built in layers; fast tests should not be burdened with system-level proof tasks they cannot handle.
5. The Engineering Gap Between Working and High-Quality Code
One cannot simply assert that AI can only write working code, not high-quality code. Models can learn common design patterns and produce better-quality implementations under clear constraints, sufficient context, and effective feedback.
Conversely, one cannot infer that code is maintainable just because it runs.
Code quality is not a single metric but a balance of various engineering goals, including:
- Are responsibilities clear?
- Is the dependency direction reasonable?
- Are state changes easy to track?
- Is error handling consistent?
- Can production faults be located?
- Is it easy to modify and test?
- Does it comply with the system’s existing design constraints?
For example, adding multiple layers of abstraction to accomplish a simple query might be functionally correct but increases understanding costs. Conversely, stuffing multiple business rules into a single function allows for quick short-term delivery but makes subsequent modifications prone to cascading effects.
Review should not devolve into personal style arguments. Judgments should be grounded in explainable consequences: Does this implementation increase the probability of failure? Does it expand the scope of impact from changes? Does it make testing and troubleshooting more difficult?
6. The Correlation Blind Spot When AI Writes Both Implementation and Tests
There is no problem letting AI generate tests; the problem is treating implementation and tests generated from the same source as independent proof of correctness.
If the model misunderstands the requirement, it might simultaneously:
- Write incorrect business logic;
- Generate matching tests for the incorrect logic;
- Explain in the documentation why these tests prove the implementation is correct.
This does not mean the model is intentionally cheating, but rather that the implementation and acceptance might share the same incorrect assumption.
Another risk is altering judgment criteria when fixing tests. For example, deleting failing cases, relaxing assertions, skipping critical paths, or changing scenarios that must fail to allow passing. If these changes are not reviewed, both the test count and pass rate can be misleading.
It is recommended to establish the following constraints:
- Critical acceptance conditions must be confirmed by the requirements owner or maintainer.
- Both implementation changes and test changes must enter the review scope.
- Deleting tests, adding skip conditions, or reducing assertion strength require separate explanations.
- For key rules like permissions, data integrity, and compatibility, retain controlled regression cases.
- Review whether tests were actually executed, not just whether the report shows success.
Independence does not necessarily mean every test must be written by a different person, but at least key rules should have an independent source of confirmation.
7. Allocate Review Intensity by Risk, Not Uniformly
Manually checking all AI output line-by-line is both expensive and potentially ineffective. A more reasonable approach is to establish risk grading.
| Risk Level | Typical Changes | Suggested Review Focus |
|---|---|---|
| Low | Non-behavioral text changes, local formatting, controlled generated file updates | Confirm scope, source, and generation rules; run necessary checks |
| Medium | Standard business logic, local API implementations, internal data transformations | Review critical paths, error handling, test coverage, and compatibility |
| High | Permissions, sensitive data, financial logic, concurrency control, data migration, core configuration | Deep manual review, supplement independent acceptance and release contingency plans |
Grading cannot rely solely on lines changed. A single-character modification to a permission condition might be more dangerous than hundreds of lines of display logic.
Meanwhile, lower risk does not mean permanently exempt from review. Only when the generation process is stable, the output scope is controllable, automated verification is sufficient, and there are no behavioral or security boundary changes, is it appropriate to reduce manual effort.
8. Leverage AI for Review, But Don’t Make It the Final Judge
AI is suitable for highly repetitive tasks that require rapid context assembly, such as:
- Summarizing changes by business capability rather than recounting file by file.
- Flagging changes in permission checks, transaction boundaries, and external calls.
- Finding exception paths, unreleased resources, and duplicate implementations.
- Mapping spec items to code and tests.
- Suggesting potentially missing edge cases.
To improve output credibility, a fixed structure can be required for review results:
“Risk description - Location - Trigger condition - Possible consequence - Verification method - Uncertainty”.
For example, “There might be a concurrency issue here” is too vague; a more valuable expression is: “Two requests might read the same state simultaneously and execute subsequent writes respectively; it is recommended to use concurrency testing to verify whether duplicate operations occur, and to confirm if database constraints or other atomicity guarantees exist.”
Humans need to verify these conclusions and allow AI to explicitly state when context is insufficient. Different models or prompts can provide additional review perspectives, but they cannot be guaranteed to lack common blind spots.
Especially for changes involving security boundaries and data integrity, they should not be approved for merging solely based on AI reporting “no issues found.”
9. An Executable Delivery Loop
For teams utilizing AI in development, the following process can be adopted:
Step 1: Confirm Specs Before Generating Implementation
Break down requirements into independently verifiable small tasks, clarifying normal behavior, failure behavior, and invariants. Determine acceptance methods for high-risk rules before writing code, avoiding building tests around the implementation after the fact.
Step 2: Constrain Change Scope
Require the generation process to avoid unrelated refactoring and extra dependencies. When optimizations outside the requirements are discovered, raise them separately instead of automatically mixing them into the current commit.
Step 3: Execute Basic Automated Checks
Execute static checks, type checking, unit tests, integration tests, and security checks based on project characteristics. Automated reports should include the actual execution scope, not just a success flag.
Step 4: Conduct AI Pre-review
Let AI organize the risk map, spec coverage, and test gaps. The output must link to specific changes and not just provide generic advice.
Step 5: Manually Review Key Decisions
Focus on checking business assumptions, permission boundaries, transactions and concurrency, failure recovery, compatibility, and test changes. For high-risk parts, reviewers should be able to explain “why this implementation is reasonable,” not just “the tests passed.”
Step 6: Tiered Release and Observation
Merging is not the end of quality work. Choose gradual rollout, reversible releases, or other controlled release methods based on risk, while monitoring error rates, latency, resource consumption, and business anomalies.
Special attention is needed: application version rollback does not mean data can be automatically recovered. Compatibility strategies and recovery plans should be designed in advance for data structure changes and irreversible writes.
10. Tight Deadlines Require Cutting Irrelevant Work, Not Quality Responsibility
“No time to review” often reflects an imbalance in the delivery process, not that review itself lacks value.
If a team continuously accepts oversized commits, lets implementation and acceptance share unconfirmed assumptions, and relies on post-launch troubleshooting for remediation, it superficially saves review time but actually shifts costs to incident response and future maintenance.
A more realistic sequence of improvement is:
- Reduce task and commit scope.
- Automate formatting, type, and standard rule checks.
- Build stable regression tests for critical business.
- Use AI to reduce context assembly and initial troubleshooting costs.
- Focus human effort on high-risk decisions.
- Include review and acceptance time in delivery planning.
Teams should also monitor review lead time, post-launch defects, rollback situations, and rework costs, rather than just tracking code generation speed. Speed only has engineering value when the results are reliable.
Conclusion
Specs define goals, the Harness provides repeatable behavioral evidence, code review identifies implementation-level risks, and release and monitoring verify performance in the real environment. The four complement rather than replace each other.
The AI era does not require returning to pure manual line-by-line checking, nor does it mean treating all-green tests as an automatic pass. Instead, it requires building a trusted verification chain: requirements are confirmed by someone, acceptance criteria are protected, critical implementations undergo review, and launch results can be observed and recovered.
Who generates the code can change, but the responsibility for software quality does not disappear because of it.
