> For the complete documentation index, see [llms.txt](https://kerno.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kerno.gitbook.io/docs/guides/validate-code-changes.md).

# Validate code changes

Validation is the day-to-day loop. After every change, Kerno checks which endpoints were affected, runs the relevant scenarios, and reports what changed against the baseline. When you confirm the results, your agent updates the baseline to reflect the new behaviour, adds scenarios for new endpoints, and removes ones that are no longer relevant.

### Prerequisites

Before you begin, make sure you have:

* A baseline captured for the endpoints you want to validate. See [Capture a Baseline](/docs/guides/capture-a-baseline.md).

### Step 1 — Run validation

After making a change, ask your coding agent to validate it:

> "Use Kerno to validate the changes we made."

Kerno uses your git diff to detect which endpoints were affected, runs their scenarios against your live stack, and compares the results to the baseline. By default, only the endpoints touched by your changes are re-run.

If you want to validate a single endpoint, just specify it:

> "Use Kerno to validate POST /users."

{% hint style="info" %}
The default scope uses your working tree diff. If you have already committed your changes and there is nothing uncommitted, validation will return no endpoints. In that case, target the endpoint or file directly instead.
{% endhint %}

For a full breakdown of targeting options, see [Scopes](/docs/references/scopes.md) reference.

### Step 2 — Review the results

For each scenario, Kerno seeds real test data, makes authenticated calls against your live stack, and validates the full response contract including field presence, types, and structure against the baseline. It catches things basic status checks miss: a field that silently changed type, an auth rule that stopped being enforced, a response that looks right on the surface but breaks a downstream consumer.

After running, Kerno reports whether a diff was detected. A diff is not necessarily a problem — it just means the endpoint's behaviour changed. You decide whether that was intentional.

**No diff detected.** The endpoint behaves exactly as the baseline recorded.

**Diff detected.** Your agent will summarize what changed in plain language, for example "the role field was removed from the response" or "the status changed from 200 to 401".

{% hint style="info" %}
If an endpoint has no baseline yet, Kerno captures one automatically. You will see the current behaviour of your code with no diff as there is nothing to compare against yet
{% endhint %}

```mermaid
flowchart LR
    A[Code change] --> B[Kerno detects\naffected endpoints]
    B --> C[Runs scenarios\nagainst live stack]
    C --> D[Reports diffs]
    D --> E{Intentional?}
    E -->|Yes| F[Baseline updated\nNew endpoints added\nStale scenarios removed]
    E -->|No| G[Fix code]
    G --> A
```

{% hint style="info" %}
**Note:** Kerno ignores differences that don't affect behaviour: key ordering, array element ordering, and numeric precision differences. Dynamic values like tokens, UUIDs, and timestamps are also ignored since they change on every run.
{% endhint %}

### Resources

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-comment-question" style="color:$info;">:comment-question:</i> <strong>Support</strong></td><td>Get help from the Kerno team.</td><td><a href="https://discord.gg/UncXsxUz">https://discord.gg/UncXsxUz</a></td></tr><tr><td><i class="fa-lightbulb" style="color:$info;">:lightbulb:</i> <strong>FAQs</strong></td><td>Get answers to common questions.</td><td><a href="/pages/zJKOG1wiwndWnBdcDH4o">/pages/zJKOG1wiwndWnBdcDH4o</a></td></tr><tr><td><i class="fa-shield-check" style="color:$info;">:shield-check:</i> <strong>Security</strong></td><td>Learn how Kerno handles your code and data.</td><td><a href="/pages/a868OKb6TDxWBmJlCO1H">/pages/a868OKb6TDxWBmJlCO1H</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kerno.gitbook.io/docs/guides/validate-code-changes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
