---
library: "bootstrap"
slug: "StateAudit"
name: "StateAudit"
ref: "StateAudit#63cf"
hash: "sema:StateAudit#mh:SHA-256:63cfd2311667bd0cf3634a23d7c6bb15018d7903ec89e6f5453a827251d7a43c"
type: "Primitives"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/StateAudit"
---

# StateAudit

Verifying system state after an operation

Infrastructure · Primitives

## Mechanism

A safety pattern where an agent performs an explicit [Audit](https://semahash.org/vocabularies/bootstrap/patterns/Audit.md) of the [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) immediately after a write to ensure the [StateTransition](https://semahash.org/vocabularies/bootstrap/patterns/StateTransition.md) occurred as expected. Catches silent API failures.

## Invariants

- Audit timestamp is later than the write it verifies.
- Compares observed [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) against the [StateTransition](https://semahash.org/vocabularies/bootstrap/patterns/StateTransition.md) that was expected, not merely that a write returned.

## Failure modes

- Silent write failure: the write reported success and the [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) did not change. This is the case the pattern exists for.
- Audit reads a stale replica, so a successful write looks silently failed.

## Where this came from

—

## Builds on

- [Audit](https://semahash.org/vocabularies/bootstrap/patterns/Audit.md) (references)
- [State](https://semahash.org/vocabularies/bootstrap/patterns/State.md) (references)
- [StateTransition](https://semahash.org/vocabularies/bootstrap/patterns/StateTransition.md) (references)

## Used by

- [SpotAudit](https://semahash.org/vocabularies/bootstrap/patterns/SpotAudit.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: StateAudit#63cf
- Hash: sema:StateAudit#mh:SHA-256:63cfd2311667bd0cf3634a23d7c6bb15018d7903ec89e6f5453a827251d7a43c

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/StateAudit
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/StateAudit.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
