Loading VIBA…

Verification Is a Pipeline, Not a Prompt: Reviewing AI-Generated Code Before Production

Verification Is a Pipeline, Not a Prompt: Reviewing AI-Generated Code Before Production

Verification Is a Pipeline, Not a Prompt: Reviewing AI-Generated Code Before Production

Generating code is now the cheap part. Deciding whether to trust it is the expensive part. The failure mode is rarely a syntax error — it's a plausible-looking function that solves a slightly different problem than the one you described, passes the tests generated alongside it, and ships.

The instinct is to ask the same model "is this correct?" That isn't verification; it's a second opinion from the same assumptions. What works better is treating verification as a pipeline: several distinct review passes, each with a different job, each producing evidence you can inspect, and a human holding the merge button at the end.

Separate the author from the reviewer

A model reviewing its own output tends to confirm its own framing. If it decided a retry belongs inside the HTTP client, it will read the diff as correct. Give the review job to a different model with a different role, and the disagreement becomes useful signal.

With VIBA, you can run several models in one shared session, assign each a role, and keep the transcript in one place. A workable split:

- Author — writes the change. - Spec-checker — restates the requirement in its own words before reading the diff, then flags anything the diff does that the restatement doesn't cover. - Adversary — looks only for ways the change breaks: partial failures, duplicate side effects, unbounded loops, empty inputs. - Test-writer — writes tests from the requirement alone.

Imagine a change that adds a retry wrapper around a payment call. The adversary's job isn't to critique style; it's to answer one question: under what conditions does this charge a customer twice? That's narrow and answerable, and it's exactly the kind of thing a single "review this" prompt tends to skate past.

Check the code against the requirement, not against itself

The most common defect in AI-generated code is a quiet mismatch between what you asked for and what got built. The code is coherent. It's just answering a neighbouring question.

Write your acceptance criteria down before you read the diff. Then ask for an explicit mapping: for each criterion, which part of the change satisfies it, and how you would know. Anything without a mapping is either missing work or an undocumented decision — both worth a conversation before deploy.

This is where developer QA habits pay off. You're not reading the code to see whether it looks reasonable. You're reading it to find the criterion that has no home.

Make the code prove itself with tests it didn't write

Tests generated in the same pass as the implementation inherit the implementation's misunderstandings. If the author misread the pagination boundary, the test asserts the same wrong boundary and passes. Most AI tools will happily produce that pair without ever flagging the shared assumption.

Break the loop by generating tests from the specification only, with the implementation hidden. Then run them. A test that fails against the implementation is the most valuable artifact in the process, because it's a disagreement between two independent readings of the same requirement.

Good candidates for that independent pass:

- Boundary conditions: zero items, one item, exactly one page, one past the last page. - Failure paths: the upstream call times out, returns 500, returns a malformed body. - Idempotency: run the operation twice, check the side effect happened once. - Ordering: does the change assume something ran first?

This is also where tooling earns its place. Running UI testing and repo testing inside the same session as the review keeps evidence next to the discussion instead of scattered across terminals and tabs. Beta testing on a staging path, with the same tests, catches the difference between "passes locally" and "passes where it will actually run."

Keep the merge decision human — and keep the receipts

Verification should end with a person deciding, not a green checkmark. Approving key steps yourself is the point: the pipeline narrows the decision, it doesn't make it.

Two things make that decision easier. First, ranked repair reports — when several issues surface, you want them ordered by what actually matters, not dumped as a flat list of twelve findings. Second, cost per agent. Verification has a budget, and knowing what each reviewer costs lets you judge when a second adversarial pass is worth it and when it isn't.

Keep the artifacts, too: the requirement restatement, the failing test, the diff, the note about what you deliberately left out. Six weeks later, when someone asks why the retry lives where it does, the reasoning is the thing you'll need — not the code, which is self-evident.

The takeaway

Verification of AI-generated code is a process, not a prompt. Separate the author from the reviewer, check the change against the requirement rather than against itself, generate tests independently of the implementation, and keep a human on the merge. Multi-agent collaboration doesn't replace software testing — it gives you more independent readings of the same requirement, which is what testing was always for.

If you want to run that pipeline in one shared session — several models, assigned roles, approval steps you control, and per-agent cost visibility — start at https://www.viba.guru.

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