# `AshBackendDrivenOptimisticUi.Resource.Verifiers.ValidateRules`
[🔗](https://github.com/Undeadlol1/ash_backend_driven_optimistic_ui/blob/v0.1.0/lib/ash_backend_driven_optimistic_ui/resource/verifiers/validate_rules.ex#L1)

Rejects a `optimistic_ui` block the client could not run or that would drift
from the resource: an action that is missing or a read, a `set` on
something that is neither an attribute nor a public calculation, an `arg`
that is neither an argument nor an accepted attribute of the action (or any `arg` inside `on`), an `event` outside
`on`, a reference to an unknown field, through a relationship, or to the
actor.

`insert` is only for a create; `remove` is for any action on a record
already in the list (a destroy, or an update after which the list no longer
shows it); `edit` changes a row already there, so not in a create either. An insert `at: {:sorted_by, field}` must sort by an attribute.
Their nested list path (`into:` / `from:`), and a `clear`'s, must end in
the key of the list and its matches follow the same expression rules.

A `push` that sets its own `id:` is rejected too: ids come from
`AshBackendDrivenOptimisticUi.PushId`, never from a rule.

Whether some other resource pushes an `on` event is a cross-resource
question and is not checked here.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
