Type to search pages and rules.

Use with Agents

Customer Rules and Hooks

Stack: anyConcern: application

Some products let customers build their own rules from triggers, conditions, and actions, and call customer endpoints when those rules fire. This page states the catalog those rules draw from, the tenant instances as data, and the may and may-not contract on hooks. A project selects it when tenants compose customer rules or the product calls customer hooks.

Markdown8 provisions
On this page

Activation#

Activation scope: project.

Applicable specification kinds: None.

The project selects customer-rules when tenants compose their own rules or customer endpoints receive hook calls. Product-owned reactions and jobs do not select it: they stay Behavior records either way.

Baseline Relationship#

This extension replaces no baseline provision. It switches on no record type: it divides customer rules into catalog records and tenant data.

Developers own the catalog of triggers, conditions, and actions as records, while each tenant instance stays tenant data. Each hook carries a may contract stating what the customer endpoint relies on and a may-not contract stating what it never assumes.

Standards#

Record the Customer Rules Catalog#

rulerequiredguidance
litespec/ext/customer-rules#record-the-customer-rules-catalog
Statement

Each trigger, condition, and action in the customer rules catalog MUST be a record.

Why

The catalog is the product's promise surface: every tenant rule is built from it. Each entry as a record pins what it does, what it costs, and what it refuses, so tenant rules compose from parts the team stands behind.

Example

The action invoice.send-reminder is a record stating its rate cap and its suppression rule.

Checka reviewer answers

Reviewed forWhich catalog triggers, conditions, or actions have no record? Look at the catalog records.

Marked guidance: a reviewer answers this question.

Treat Tenant Rules as Data#

rulerequiredguidance
litespec/ext/customer-rules#treat-tenant-rules-as-data
Statement

A tenant rule instance MUST live as tenant data, not as a record.

Why

Tenants write thousands of rules the team never sees, and recording each one would halt both sides. The catalog carries the records instead: instances compose only catalog entries, so the unrecorded part is the composition, never the parts.

Example

A tenant's rule remind overdue invoices every Monday is stored data, while its trigger, condition, and action each point at catalog entries.

Checka reviewer answers

Reviewed forWhich tenant rule instances are stored as records? Look at the catalog records and the tenant storage.

Marked guidance: a reviewer answers this question.

Refuse Unknown Catalog Entries#

rulerequiredguidance
litespec/ext/customer-rules#refuse-unknown-catalog-entries
Statement

An instance naming a trigger, condition, or action outside the catalog MUST be refused.

Why

A renamed or retired entry lingers in old instances, and a crafted request can name entries that never existed. Refusing unknown entries keeps every running rule inside the catalog instead of executing a name nobody defined.

Example

An instance naming the retired trigger expense.submitted is refused with the catalog's current trigger list.

Checka reviewer answers

Reviewed forWhich instance tests accept an entry outside the catalog, or refuse it without the current catalog? Look at the instance tests.

Marked guidance: a reviewer answers this question.

Version Catalog Entries#

rulerequiredguidance
litespec/ext/customer-rules#version-catalog-entries
Statement

Each catalog entry MUST carry a version that instances cite.

Why

Catalog entries evolve: a condition gains an operator, an action changes its payload. Versions pin each instance to the behavior it was composed against, so an entry upgrade never silently rewrites running tenant rules.

Example

The condition order.total-above moves from version 3 to version 4, and existing instances keep running version 3 until the tenant re-saves.

Checka reviewer answers

Reviewed forWhich catalog entries carry no version, or which stored instances cite none? Look at the catalog records and the stored instances.

Marked guidance: a reviewer answers this question.

State What a Hook May Rely On#

rulerequiredguidance
litespec/ext/customer-rules#state-what-a-hook-may-rely-on
Statement

Each hook MUST state its may contract: the payload, retries, timeout, and signature the customer endpoint relies on.

Why

A customer endpoint is built by strangers against the hook's word. The may contract states the payload shape, the retry count and spacing, the timeout, and the signature, so the endpoint is written against facts instead of guesses.

Example

The hook invoice.paid states three retries spaced a minute apart, a ten-second timeout, and an HMAC signature header.

Checka reviewer answers

Reviewed forWhich hook records omit the payload, retries, timeout, or signature their customer endpoint relies on? Look at each hook record.

Marked guidance: a reviewer answers this question.

State What a Hook May Not Assume#

rulerequiredguidance
litespec/ext/customer-rules#state-what-a-hook-may-not-assume
Statement

Each hook MUST state its may-not contract: the ordering, timing, and payload bounds the customer endpoint never assumes.

Why

What the contract omits, customers invent: they assume order, instant delivery, and payloads that never grow. The may-not contract closes those gaps up front, so a hook that fires twice or arrives late breaks no promise.

Example

The hook invoice.paid states that deliveries may repeat, may arrive out of order, and carry no line-item detail.

Checka reviewer answers

Reviewed forWhich hook records omit the ordering, timing, or payload bounds their endpoint leaves unassumed? Look at each hook record.

Marked guidance: a reviewer answers this question.

Isolate Hook Failures from the Trigger#

rulerequiredguidance
litespec/ext/customer-rules#isolate-hook-failures-from-the-trigger
Statement

A hook MUST leave its trigger's outcome unchanged when the customer endpoint fails.

Why

The trigger's work is done before the hook fires: the invoice is paid, the expense is reimbursed. Failing the trigger because a customer endpoint timed out punishes the product for a stranger's outage. The hook records its own outcome and retries on its own schedule.

Example

A hook call that times out is retried three times and then logged as failed, while the paid invoice stays paid.

Checka reviewer answers

Reviewed forWhich hook tests show a trigger outcome change when the endpoint fails? Look at the hook tests.

Marked guidance: a reviewer answers this question.

Conventions#

Bound Tenant Rule Runs per Period#

conventiondefaultguidance
litespec/ext/customer-rules#bound-tenant-rule-runs-per-period
Default

Each tenant instance states a monthly run cap taken from the catalog default.

ReplacementA project names its run-cap scheme in its automation documentation.

Why

One tenant's runaway rule can starve every other tenant's automation. A monthly cap from the catalog default bounds the damage, and the tenant raises it by asking instead of by accident.

Checka reviewer answers

Reviewed forWhich stored instances carry no monthly run cap, with no cap scheme named in the customer rules documentation? Look at the stored instances and that documentation.

Marked guidance: a reviewer answers this question.

Dependencies#

Packages: None.

Related extensions: integrations for the provider isolation and failure mapping behind hook calls.

Guides: None.