# How to Validate Copilot Suggestions

> Validate autocomplete and Copilot suggestions by checking their contract, assumptions, and tests before a small completion becomes a hidden behavior change.

- Canonical HTML: [https://unrust.dev/use-cases/validate-copilot-suggestions](https://unrust.dev/use-cases/validate-copilot-suggestions)
- Markdown representation: [https://unrust.dev/use-cases/validate-copilot-suggestions/index.md](https://unrust.dev/use-cases/validate-copilot-suggestions/index.md)

Published: 2026-07-14

## Direct answer

Validate an autocomplete suggestion by treating it as an untrusted draft with a narrow surface area. Read the surrounding function first, compare the completion with the caller's contract, and inspect assumptions about types, empty values, errors, and side effects. Accepting a short suggestion can be fast when the evidence is clear; the speed comes from a bounded verification loop, not from trusting the source.

## Read the gap around the completion

A completion is only meaningful in its local context. Inspect the names, type constraints, callers, and nearby tests that tell you what the missing lines must preserve. This prevents a familiar-looking pattern from being pasted into a function with a different ownership or error contract.

## Verify assumptions before expanding the diff

Check whether the suggestion introduces a default, coercion, catch block, mutation, or dependency call that changes the function's meaning. If one assumption is unclear, reduce the suggestion to the part you can explain and verify before accepting more generated code.

## Practice loop

1. Pause before accepting a completion and state the enclosing function's promised behavior.
2. Name one input edge and one failure path the completion must preserve or handle.
3. Accept only the smallest portion you can explain, then run the nearest relevant test.

## Limits of this page

This process does not replace knowledge of the product or its runtime environment. A timed session may show an uncertain assumption, but it cannot say whether that uncertainty came from an unfamiliar codebase, time pressure, or a broader skill gap.

## Source context

Editorially reviewed for Unrust using public language documentation, common code-review practice, and small original examples written for this resource system.

## Related resources

- [How to Inspect an Autocomplete Completion](https://unrust.dev/use-cases/inspect-an-autocomplete-completion/index.md): Inspect an autocomplete completion by checking the surrounding contract, its hidden defaults, and the smallest test that shows whether the proposed lines belong there.
- [Find TypeScript Logic Flaws Before Shipping](https://unrust.dev/languages/typescript/find-the-flaw/index.md): Find TypeScript flaws by checking whether conditionals, narrowing, and assertions preserve the runtime contract instead of assuming types make every branch safe.

Next step: [Take the free diagnostic](https://unrust.dev/diagnostic/index.md)
