# Tests

> Every pebble carries tests your AI writes first; pebblebase runs them and rolls back table changes that break them.

Every pebble keeps its own tests: what must hold, and what must be refused. Your AI writes them before it builds, and pebblebase runs them.

## Tests first

Before building, your AI turns your request into tests, including entries that must fail, such as a negative amount or a date that doesn't exist. Then it builds until they pass.

## Changes that break something roll back

Once the tests pass, pebblebase reruns them whenever your AI changes the pebble's tables or rules. A change that breaks a passing test is rolled back, so the parts you rely on keep working.

Tests run on a private copy of the pebble, so they never touch your records.
