Skip to content

Type Alias: ConstraintViolationCode

@kortexya/reasoninglayer


@kortexya/reasoninglayer / ConstraintViolationCode

ConstraintViolationCode = "constraint_over_unread_data" | "dependants_exceed_commit_budget" | "dependant_not_writable" | "dependant_changed_concurrently" | "term_changed_concurrently" | "write_targets_derived_fact" | "write_targets_rule"

Defined in: src/types/terms.ts:702

The closed code a ConstraintViolationError carries (ConstraintViolationError.code).

  • constraint_over_unread_data — a bound constraint whose walk reads data the caller may not read (a feature that holds a term the caller’s Read grant does not show) refused the write (reasoninglayer#1230, #1235). POST /api/v1/terms, PUT /api/v1/terms/{id}, POST /api/v1/terms/bulk, POST /api/v1/inference/facts and POST /api/v1/actions/apply answer it with one bare body: feature and constraint are empty, and the message names nothing the caller was not shown. The constraint is still judged on the stored data. Nothing is written.
  • dependants_exceed_commit_budget — the write would adjust more terms whose bound constraints read it than one commit can hold (reasoninglayer#1245). The message names the count and the budget; feature and constraint are empty. Every counted dependant is one the caller may read. Nothing is written.
  • dependant_not_writable — an update bound constraint of a term that reads the write would adjust that term, which the caller reads but may not write (reasoninglayer#1245, #1251). termId names that term; feature and constraint are empty, and the message names the guard that refused it. Nothing is written.
  • dependant_changed_concurrently — another writer changed a term whose bound constraint reads this write after the write judged it (reasoninglayer#1245, #1251). The body is the coded { error, code, message, refs }: refs.dependant names that term (read it with errorBodyRefs), and termId is undefined. Nothing is written; retrying judges the term again.
  • term_changed_concurrently — another writer changed a term the request read before its commit (reasoninglayer#1263). The body is the coded { error, code, message, refs }: refs.term names that term (read it with errorBodyRefs). Nothing was written; reading again and retrying is safe. Every premised write answers it: term writes, review merge and correction, facet classification, ingestion, frame comments, app actions, page restore and UI generation.
  • write_targets_derived_fact — the write targets a fact a rule derived; always a DerivedFactWriteError.
  • write_targets_rule — the write targets a term of a rule; always a RuleTermWriteError.

Every other bound-constraint refusal carries no code and names its feature and constraint: the written term’s own constraint, or the constraint of a dependant over data the caller reads (#1245).

const code: ConstraintViolationCode = 'constraint_over_unread_data';