Skip to content

Function: isDependantsExceedCommitBudget()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isDependantsExceedCommitBudget

Function: isDependantsExceedCommitBudget()

Section titled “Function: isDependantsExceedCommitBudget()”

isDependantsExceedCommitBudget(error): error is ConstraintViolationError

Defined in: src/errors.ts:310

Whether error is the refusal of a write that would adjust more dependants than one commit can hold (reasoninglayer#1245).

unknown

Anything caught from an SDK call.

error is ConstraintViolationError

true when error is a ConstraintViolationError whose code is dependants_exceed_commit_budget; false otherwise.

A dependant is a term whose bound constraint reads a feature the write changes. A write re-judges its dependants in the same commit, and refuses the whole write when there are more of them than that commit can hold. The message names the count and the budget; nothing is written. The term write doors answer it: PUT /api/v1/terms/{id}, POST /api/v1/terms (a @key merge), POST /api/v1/terms/bulk, POST /api/v1/inference/facts and POST /api/v1/actions/apply. Split the change into smaller writes.

try {
await client.terms.updateTerm(accountId, { features: { limit: 3 } });
} catch (e) {
if (isDependantsExceedCommitBudget(e)) splitTheChange();
}