Reviewing AI-Generated Code: A Practical Merge Checklist
A clear review process for AI-assisted code changes, including scoped diffs, access controls, independent tests, and evidence before merging.
A suggested code change can look convincing even when nobody has proved it works. The safest review starts with a narrow question: what should change, and how will someone independently confirm the result? Use this checklist whether the proposal came from an assistant, a coworker, or an automated coding agent.
1. Define the outcome before opening the diff
Begin with one sentence describing the task in the language of a user or operator. If a change is supposed to make a search faster, identify which search, whose account, and what improvement can actually be measured. An impressive patch is not evidence of an improved outcome.
GitHub describes pull requests as a place to propose, discuss, and merge changes before they become part of the project. [1]
- Write down the expected behavior and one example input before inspecting any generated files.
- Identify the files or services that are allowed to change, and flag unrelated additions.
- Record a simple rollback point so the team can return to a known revision.
- Separate requirements from nice-to-have refactoring; the latter belongs in another change.
2. Review the boundaries and permissions
A coding assistant can alter more than the function that appears in its summary. Read configuration, dependencies, routes and permissions alongside the visible patch. Treat any new network destination, token scope, or database write as a decision requiring explicit justification.
OWASP recommends least-privilege authorization as a foundation for access-control design. [3]
OWASP recommends validating permissions on every request, not only at the time a user first signs in. [4]
- Check that no secrets, session tokens, personal information, or debug dumps entered the commit.
- Compare new access permissions against the smallest capability needed for the feature.
- Inspect every new write endpoint for authentication, target ownership and server-side authorization.
- Ask whether the patch introduces an outbound call or background job that will continue after the user leaves.
3. Require independent verification
A generated explanation that says a test passed is still just an explanation. A reviewer should see a real test command, its exit status and a receipt tied to the exact proposed revision. When the test environment cannot reproduce a provider call or mobile interaction, describe that limitation instead of replacing it with a guess.
GitHub documents a separate review stage for proposed pull-request changes. [2]
- Run the closest relevant automated test against the actual branch, not a previous version.
- Inspect negative cases: unauthorized access, missing input, retries and duplicate submissions.
- Record the revision identifier alongside the passing test result and build artifact.
- Check one narrow manual scenario when the feature depends on browser layout or a physical device.
4. Use a hypothetical example to spot hidden risk
Imagine a pull request that adds an AI-written helper for creating support tickets. The helper produces a plausible ticket and a successful local unit test. Before merging, a reviewer would still need to verify the authenticated customer, target project, correct ticket fields and behavior on an interrupted network request.
- First, test a read-only preview using synthetic ticket data without sending a write.
- Then, require a user-visible confirmation that names the target project and intended ticket.
- After an authorized test write, retrieve the created ticket from the destination to confirm its existence.
- Finally, retry with the same idempotency key and verify that a second ticket was not created.
5. Decide whether this specific change is ready
The right approval question is not whether the author sounds confident. It is whether the evidence supports the exact code that will be deployed. Keep the scope small, ask for clear acceptance conditions, and hold changes that cannot be tested or reversed safely.
- Pass only when the diff is scoped, tests are current and access boundaries are understood.
- Hold when provider behavior or account isolation is unknown, even if local formatting checks pass.
- Reject any untraceable claim that a vulnerability was fixed or an external action completed.
- Document what was not checked and who can inspect the result after release.
What to do next
A short review checklist may feel slower than one-click merging. It becomes faster when the same team uses it consistently, because future reviews can compare evidence instead of reconstructing intent. If a result cannot be independently confirmed today, leave it as a proposed change rather than a completed outcome.
Original sources and verification
The cited evidence statements were checked against the original publishers at preparation time. This automated match checks exact source passages and a fixed, pre-reviewed claim mapping; it does not independently prove every possible inference or reflect future changes. Recheck sources before any consequential decision.
- GitHub Docs — About pull requests — original publisher; relevant evidence verified automatically before this publication.
- GitHub Docs — Reviewing proposed changes — original publisher; relevant evidence verified automatically before this publication.
- OWASP Authorization Cheat Sheet — Least privilege — original publisher; relevant evidence verified automatically before this publication.
- OWASP Authorization Cheat Sheet — Every request — original publisher; relevant evidence verified automatically before this publication.
Put the checklist into practice
Start with the practical steps above, then verify the outcome in your own environment. You can also explore a guided workflow if useful.
Explore a guided workflow Save your progressEducational guidance, not a guarantee of security or functionality. Automated source-presence checks are distinct from a human or domain-expert review. Suggest a correction.