AI-generated code review checklist before merge
Use an AI-generated code review checklist to inspect scope, access, failure paths and test evidence, with a worked diff before merging.
A pull request adds a working download button. The agent reports that its checks passed. In the generated file, a warehouse lead can still see another warehouse's orders. An AI-generated code review checklist should help you trace the requirement through the request, query and returned data before you merge.
This guide uses a fictional warehouse export to show what to inspect, how to write a useful finding and what evidence to request after a fix. The examples are teaching material, not a client incident or an implemented feature. Use them alongside the approved specification and your repository's review conventions.
Start with the scope and revision
Read the approved behaviour before opening the diff. For this example, a warehouse lead may download approved, non-cancelled order lines with a positive quantity still to ship. They may export only a warehouse they manage. The file contains order reference, SKU, outstanding quantity and warehouse code.
Record the base and head commits being reviewed. Read the changed files in their surrounding context, including the route, permission check and output writer. A summary written by the implementing agent helps you navigate; compare it with the actual changes.
Google's code-review guidance covers design, functionality, complexity, tests and context beyond the changed lines. Apply those checks to agent-authored code too. A generated change still has to fit the existing application.
If a small export also introduces a permissions framework, changes global error handling or reformats unrelated modules, ask why. Separate unrelated work so the reviewer can assess the feature and its risks.
Trace one request to its output
Follow the warehouse lead's request from the download control to the file. Identify where the server establishes identity, checks export permission and limits the requested warehouse. Then inspect which records and fields reach the CSV writer.
The following fictional pseudocode diff illustrates an incomplete change. It is deliberately framework-neutral and is not executable code. Assume authentication and the general export permission have already been checked upstream.
+ warehouse = findWarehouse(request.warehouseId)
lines = approvedOutstandingLines(warehouse.id)
return csv(lines)The query selects the requested warehouse. Nothing shown establishes that this lead may manage it. A selector displaying only warehouse A would still leave a direct request for warehouse B open.
Write the finding with a trigger and consequence: “A lead who manages A can supply B's valid warehouse identifier. This path loads B without checking warehouse membership, so the resulting CSV can expose B's order lines. Resolve the warehouse through the lead's authorised set before selecting export rows.”
OWASP's authorisation guidance calls for validating permissions on every request. The review needs to establish where that check happens in this application. A function name or hidden button is insufficient evidence.
Review the proposed repair
A conceptual repair changes how the warehouse is resolved and makes the output fields explicit:
- warehouse = findWarehouse(request.warehouseId)
+ warehouse = requireManagedWarehouse(
+ currentUser, request.warehouseId
+ )
lines = approvedOutstandingLines(warehouse.id)
- return csv(lines)
+ rows = dispatchColumns(lines)
+ return existingSafeCsvWriter(rows)Inspect those helpers in the real implementation. The first must enforce membership and the agreed denial behaviour. The field mapper must emit only the allowed columns. The writer must preserve the application's CSV encoding and spreadsheet-safe cell handling. This snippet names responsibilities; it does not demonstrate that they have been implemented correctly.
For the illustrative spec, request A as an authorised exporter and inspect the returned file. Then request B using its valid identifier. Expect the agreed non-disclosing 404, and confirm that B's records are absent from A's CSV. Keep general export permission and warehouse membership as separate checks.
Use an AI-generated code review checklist
Use this checklist to guide inspection of the actual change. Its questions identify evidence to gather; ticking the rows cannot establish that a feature is correct.
| Area | Check against the agreed change | Useful evidence |
|---|---|---|
| Intended behaviour | Do partial shipments show the remaining quantity? Are cancelled and unapproved lines excluded? | Representative input records and actual file rows. |
| Access and output | Does the server enforce warehouse membership? Are extra fields absent from the response? | Authorised download plus a direct request for another warehouse. |
| Failure paths | What happens with an empty result, denied access or a generation failure? | Observed status, response content and user feedback for each relevant case. |
| Data consistency | What does the file promise if a shipment changes during generation? | The chosen read strategy and checks appropriate to that database and export path. |
| Dependencies | Does a new package solve a needed problem? Were its version, provenance and compatibility checked? | Manifest and lockfile diff, official documentation and relevant check output. |
| Operations | Can the agreed volume be handled? Does the change alter logs, configuration, storage or deployment? | Relevant measurements, configuration diff and release or recovery notes. |
| Scope and maintenance | Does the change follow existing patterns and avoid unrelated work? | Whole diff, surrounding code and updated user or developer documentation. |
Spend more time where this change can cause harm. An export needs careful attention to data boundaries and cell content. A payment callback needs different failure and duplicate-delivery checks. Bring in a reviewer who understands the affected domain when the existing team cannot assess it confidently.
Check what the verification proves
Ask for the exact commands, environment, reviewed commit and actual results. “Tests passed” leaves the scope unclear. A focused query test may prove row selection while leaving the route's permission check unexercised.
For each important requirement, identify the strongest existing check that reaches it. Inspect changed tests as code: did an assertion disappear, did a case become skipped, or did the expected output change to match the implementation? Google's review guidance explicitly asks whether a test would fail if the code were broken.
For the warehouse example, an assertion that a CSV exists cannot establish warehouse isolation. Inspect the records and fields returned for the relevant actor. After a repair, rerun the affected checks against the repaired commit. A green run from an earlier revision does not verify the latest change.
Give a reviewer agent a bounded job
A reviewer agent can inspect the diff against the approved spec and identify candidate defects. Give it the commit range, repository instructions, relevant files and available check output. Ask each finding to name the affected path, triggering input and consequence.
Use a separate review pass to challenge implementation choices. Then verify the findings against the code and behaviour. A reviewer agent can misread an existing access check or miss a failure path. Its approval message adds no substitute for evidence or human judgement.
Our AI-assisted development workflow keeps merge and release decisions with people. Review findings support those decisions. The full workflow guide shows how the spec, plan and implementation evidence reach this review stage.
Record the final merge decision
Keep a short record with the pull request so another reviewer can see what was checked. Fill in actual revisions and results; the following is an empty template.
Reviewed base and head commits:
Approved spec and plan revisions:
Behaviour and files reviewed:
Findings:
- Trigger, consequence, location and severity
- Fixed in which commit, or accepted by whom and why
Verification:
- Command, environment, commit and actual result
- Required checks not run and their consequence
Remaining risks or follow-up work:
Human merge decision and date:
Release requirements and responsible person:Before merging the export, the decision-maker should be able to locate the warehouse access check, the allowed output fields and the evidence from the repaired revision. Keep any missing check or accepted risk in that record. For a commissioned build, agree these acceptance and review expectations with the delivery team when defining the Build milestones.
Start with a paid Blueprint, not a guess
One to two weeks to agree the scope, the risks and the measure of success — then a fixed price for the Build.