WebFV
Code verification / Field guide

Verify AI-generated code by risk and evidence

Choose checks that match the changed behavior and its dependencies, and state exactly what a passing result establishes.

By WebFV Editorial · Checked October 23, 2026 · Official tool documentation checked October 23, 2026

What the evidence coversDocumentation-based method guide. Tool syntax and limitations reviewed in official sources; no large repository, model, test suite or formal proof was run.

AI large-scale code verification needs several kinds of evidence, chosen for the risk of the change. Start with explicit requirements and a bounded diff. Use static checks for detectable code problems, types for declared interfaces, tests for executable behavior, and human review for intent and design. Reserve formal verification for properties that can be specified and modeled precisely.

A green test run does not establish that an entire AI-generated system is correct or secure. This guide explains a practical workflow based on official tool documentation. We did not run an AI model, analyze a large repository, or benchmark these tools.

First define what “verified” would mean

Before choosing tools, write down the intended behavior, affected components and failure consequences. For example, a pricing change might require that the total is never negative, discounts follow the documented order, and retrying a request does not create another charge.

Those are separate requirements. A formatter cannot check them, and a test that only asserts a successful response may check none of them. Derive expected results from the specification, independently calculated examples or an established contract. An AI-generated implementation and AI-generated tests can share the same mistaken assumption.

Treat AI output as a proposed change. Require the same reviewable evidence you would request for a human-authored change, with extra attention to invented APIs, unsupported assumptions and tests that merely mirror the implementation.

Choose checks by failure impact

The following tiers are a suggested planning method, not an industry certification or a guarantee:

Change risk Useful starting checks Reasons to expand
Presentation or isolated configuration Inspect the diff and affected output; check syntax and the relevant rule configuration Shared layout, environment or loading behavior changed
Local business logic Types where applicable, focused unit tests, boundary cases and a reviewer checking the expected behavior Callers depend on changed semantics or error handling
Service, database or external API boundary Integration or contract tests covering changed interactions, invalid inputs and failure responses Transactions, retries, schema changes or shared consumers are involved
Authorization, payments, concurrency or destructive operations Explicit invariants, negative cases, specialist human review and relevant security analysis A mistake crosses a trust boundary or causes irreversible effects; a precisely modeled core may justify formal methods

A short diff can still have high impact. Changing a permission predicate or transaction boundary deserves more attention than its line count suggests. Conversely, checking every unrelated component after an isolated text edit adds little evidence about that edit.

What each layer establishes—and what it misses

Static analysis and linting

ESLint's CLI accepts file or directory targets and applies the configured parser and rules. It can identify problems those rules recognize. Ignored files, missing plugins and disabled rules limit what was checked; an empty report alone does not explain that scope.

Security-oriented analysis is a separate layer. GitHub code scanning can use CodeQL or other analyzers to report potential security vulnerabilities and coding errors. Review findings in context. No findings should be recorded as “no alerts from these checks,” rather than “no vulnerabilities exist.” Availability, licensing and workflow costs depend on the repository and setup; this guide does not enable scanning or promise free private-repository coverage.

Type checking

A type checker checks the program against its type rules and configuration. It can expose incompatible interfaces and some invalid operations before execution. The TypeScript handbook explicitly explains that its type system permits some operations whose safety cannot be established at compile time.

Types therefore do not establish that a network response matches its declaration, that authorization is correct, or that an algorithm implements the intended business rule. Validate untrusted runtime data and test the relevant behavior instead of treating a type assertion as validation.

Unit tests

Unit tests exercise chosen inputs and assertions around a small behavior. Useful examples include an empty collection, an exact threshold, an invalid value and a known regression. Passing these cases establishes that those assertions held in that run and environment; it does not cover inputs the tests never considered.

Check the quality of the assertion as well as the pass count. If the only expected result is copied from the new implementation, a passing test can preserve its error. Avoid substituting a large count of shallow tests for a small set of meaningful requirements.

Integration and contract tests

Integration tests exercise interactions: serialization, database behavior, transactions or a service boundary. Contract tests can check whether a producer or consumer follows an agreed interface. Their strength depends on what actually participates in the test.

A mocked payment client does not demonstrate that a real provider accepted a request. A real test database may establish behavior against that database configuration, while leaving a production migration or network failure untested. State the environment and substitutions alongside the result.

Human review

Google's review guidance covers design, functionality, complexity, tests and edge cases, including concurrency concerns. A reviewer should ask whether the implementation satisfies the actual requirement and whether the chosen checks could detect a plausible mistake.

For AI-generated code, request concrete reasoning: identify the trust boundary, explain a changed invariant, or trace an error path. An approving comment from another model is additional analysis, not independent proof that the requirement is met.

Use tools with an explicit scope

These command shapes illustrate the documented interfaces. They are not commands we ran, and the paths are examples to replace with existing files. Use the repository's installed, configured tools and approved scripts; do not introduce an unpinned tool version just to obtain a green result.

For an already configured ESLint project, target a changed JavaScript file:

npx eslint src/policy.js

Inspect the actual findings and configuration. TypeScript needs the appropriate parser/configuration if you want ESLint to analyze .ts files.

For an installed TypeScript compiler, check a configured project without emitting JavaScript output:

tsc --noEmit --project packages/policy/tsconfig.json

The TypeScript configuration reference documents noEmit. This remains a project-level type check, not a single-file test; understand which files and dependencies the selected configuration includes.

For a Python project that already uses pytest, select an existing test node:

python -m pytest tests/test_policy.py::test_rejects_invalid_total -q

The pytest invocation guide documents file and node selection. Selecting one test keeps the target explicit, but fixtures and imported code still matter. A skipped test, a collection error or an empty selection is not a passing behavioral check.

These are examples for different ecosystems. A Python service does not need TypeScript tooling simply because it appears in this table of methods.

Scale the workflow through change impact

  1. Fix the reference point. Record the commit and intended behavior so results refer to a specific change.
  2. Map affected boundaries. Identify modified modules, callers, contracts and shared dependencies. Use the repository's ownership and dependency information rather than assuming changed files are isolated.
  3. Run the smallest meaningful checks first. Start with applicable static checks and focused behavior tests. Expand to affected integrations when the change crosses their boundary.
  4. Review failures before rerunning. Separate a reproducible defect from a missing dependency or environment problem. Do not remove assertions, silence findings or repeatedly retry until an unexplained failure disappears.
  5. Record the remaining gap. List untested dependencies or conditions and the reason a reviewer accepts them—or requires more evidence.

Reuse results only while their code, configuration and relevant dependencies remain applicable. When shared infrastructure or a contract changes, a wider affected scope may be necessary. That is a decision based on dependency impact, not a requirement to rerun every check for every edit.

When formal verification is the right term

Formal verification reasons about specified properties under a model and assumptions. Dafny's tutorial shows how annotations, including preconditions and postconditions, express properties that its verifier attempts to prove. Loop reasoning can also require invariants.

For a suitable isolated algorithm, this can support a stronger claim than checking a sample of inputs. The claim is still about the modeled code and the stated property. A mistaken specification, an unmodeled external service or an unchecked integration is outside what that proof establishes.

Do not relabel generated tests, a clean linter report or a model's explanation as formal verification. If a proof tool times out or leaves an obligation unproved, the result is unresolved—not automatically a defect and not a successful proof.

What to put in the handoff

A useful verification record names the change, the requirement, the exact check and the observed result. For example: “Commit X; selected policy tests passed against a local test database; provider integration and production migration were not exercised.” Keep actual tool output available when it is needed to review a finding.

Avoid a single “AI verified” badge that hides these distinctions. Report type-check results, selected test results, security findings and any formal proof obligations separately, with the scope and limitations needed to interpret each one.