Skip to content

Learn · Rulebooks

Every check a logic rulebook can make

Patterns, ranges, addresses, shapes, and the checks that watch over time.

Checked against the product on · written for people writing code

These are the checks available to a logic rulebook. Each one runs against the fields on an incoming event and answers yes or no.

Checks that look at one event.
CheckWhat it testsExample
shapeThat named fields are present and hold the type you expect.amount is a number and customer.id is text.
value: one ofThat a field holds one of a set of values.state is up or down.
value: rangeThat a number falls between two bounds, ends included.temperature between -10 and 70.
value: address rangeThat an address falls inside a network range.source address inside 10.0.0.0/8.
exactThat a field equals a value, with an option to ignore case.event type equals link change.
compareGreater than, less than, equal to, different from, starts with, ends with, or matches a pattern.amount over 10000.
presentThat a field exists at all, or that it is empty.approver is missing.

Join any of them with all, any, none, or one-of to build the test you mean.

Checks that watch over time

Checks that need history.
CheckWhat it testsExample
windowA count, sum, average, smallest or largest over recent events.Eight transfers in an hour.
sequenceThat one thing happened, then another, within a period.A permission change, then an export, within ten minutes.
absenceThat something expected has not arrived.No heartbeat for fifteen minutes.
Note. Absence is swept on a timer as well as on arrival. A watched thing that goes quiet never arrives to be checked, and going quiet is the whole point of an absence check.

The bounds every rulebook is held to

Checks are compiled once when a version is published, so the bounds are enforced at that moment and cost nothing while events flow.

BoundLimitWhy
Checks in one rulebook256Keeps one rulebook readable and its run time predictable.
Nesting depth32A test nested deeper than this is hard for a person to confirm.
Pattern length512 charactersA long pattern is usually a sign the test belongs in several checks.
Pattern shapeRunaway patterns refusedA pattern that can loop on itself would stall the run. It is caught at publish.
Does a check ever ask a model?
No. A check runs as written, with no reading and no outside call. That is why it answers the same way every time.
What happens when two checks both match?
Every match is recorded. When they ask for different actions, the most careful action wins.
Can a logic rulebook use warning labels from a rule pack?
Yes. A check can raise a warning label, and your rules act on labels from either source the same way.