Loading VIBA…

Verify the Diff, Not the Summary: Reviewing AI-Generated Code Before Production

Verify the Diff, Not the Summary: Reviewing AI-Generated Code Before Production

Verify the Diff, Not the Summary: Reviewing AI-Generated Code Before Production

An AI agent that writes code also writes a summary of what it did. The summary is usually accurate in spirit and incomplete in detail. It says "added pagination to the orders endpoint" and does not mention that it also bumped a dependency, removed a retry block, and changed a timeout. If you verify the summary, you are reviewing a description of the change. If you verify the diff, you are reviewing the change. The second one is what ships.

Read the change surface before you read the logic

The change surface is every file, line, dependency, config key, and schema touched by the diff. Start there.

Imagine a task: add pagination to the orders endpoint. The diff touches the orders handler, adds a query parameter, and updates the tests. That is expected. It also touches the auth middleware, bumps an HTTP client, and deletes a retry block. Each of those is a separate change with a separate justification, and none of them were asked for.

Common out-of-scope edits include new dependencies, new environment variable reads, changed timeouts and retry counts, deleted error handling, skipped tests, changed log levels, and formatting churn that hides real edits. Formatting churn deserves special attention, because a diff that reformats a file can hide a one-line logic change in the middle of it. Review the diff with whitespace ignored, then review it again without.

Ask one question of every hunk: what is the smallest change that satisfies the task? Anything beyond that needs its own reason.

Size the scrutiny to the blast radius

Not every line deserves the same review. Sort the change by what it can affect.

- Local logic: pure functions, formatting, internal helpers. Read it and run the tests. - Module boundaries: interfaces between components. Check the callers. - Data shape: schemas, migrations, serialization, cache keys. Check both directions, because old data will be read by new code and new data may be read by old code. - External contracts: API responses, event payloads, webhooks. Check the consumers you do not own. - Security and permissions: authentication checks, input validation, query construction. These get a second reviewer. - Infrastructure and config: environment variables, feature flags, timeouts, resource limits. Confirm the value exists in production.

A change that touches one tier is easy to review. A change that touches four tiers in one diff is a change that should probably be split into four.

Here is a small example with a large blast radius. Renaming a field from userid to userId in a response looks cosmetic. It breaks every client that reads the old name. The change is one line; the failure is external.

Verify the claims the code makes about the outside world

AI-generated code is confident about things it cannot know. It assumes a function exists, a package is installed, an environment variable is set, an error code is returned, a library API is unchanged. Check each assumption against the actual system.

- Does this function exist in the repo? Search for it. - Does this package exist, and is it the version in the lockfile? Check the registry, not the model's memory. - Does this environment variable exist in production config? Check the config, not the code. - Does this API return that field, that status code, that error shape? Check the documentation or a recorded response. - Does the type checker agree? Run the build.

For example, a model might import a helper that exists in a different service, or call a method that was removed in the installed major version. Both compile in the model's head and fail in CI.

A cheap habit: for every import and every external call in the diff, write down where it comes from and confirm it. That list is short, and it catches most of the failures that pass tests.

Make verification repeatable and shared

A verification step that lives in one reviewer's head is not a process. Move what you can into CI: type checking, linting, unit tests, a dependency diff, a schema diff, a migration dry run, and a check that fails when a test is skipped.

Then use AI tools for the parts that need judgment. This is where multi-agent collaboration earns its place. VIBA lets you run several models, including ChatGPT, Claude and Gemini, in one shared session, assign each a role, approve key steps yourself, and see cost per agent.

A workable split for a single change: one agent writes, one reviews the diff for scope, one checks external claims against the repo and lockfile, and one drafts the rollback plan. You approve the gate before anything merges. VIBA also offers UI testing, repo testing, beta testing and ranked repair reports, which covers the parts of software testing that are hard to script.

The point is not to add agents for their own sake. The point is that developer QA gets stronger when the reviewer is not the same actor that wrote the code, and when the evidence is visible to a human who can stop the line.

Conclusion

Verification is not a vibe check on a summary. Read the change surface, size the review to the blast radius, check every claim the code makes about the world outside the file, and automate what you can so the judgment calls get the attention they deserve. Then deploy.

If you want to see how role-based agents and human approval gates fit together, start at https://www.viba.guru.

See VIBA: https://www.viba.guru