Interface: OsfqlRefusal
@kortexya/reasoninglayer / OsfqlRefusal
Interface: OsfqlRefusal
Section titled “Interface: OsfqlRefusal”Defined in: src/types/osfql.ts:1550
Machine-actionable detail of a write the engine refused.
Remarks
Section titled “Remarks”Present on an OsfqlError (errorType: 'execution', HTTP 422) when the
failure is a REFUSAL with a typed cause, so a gate or a self-repair loop can
rewrite the statement instead of parsing prose. code is one of:
link_endpoint_not_found,link_endpoint_ambiguous,link_endpoint_binding_mismatch,upsert_ambiguous— the write-designation ladder;key_value_clash,key_meet_bottom,key_meet_non_principal— the write contradicts the term that already holds the sort’s@key;key_identity_conflict— the write’s@keyvalues name more than one stored term (reasoninglayer#1255): duplicates of one entity through one key, or different entities through several. The message names those the writer may read, in id order; candidates is2, read as “two or more”. The named terms stay editable by id;bound_constraint_violated— aCHECK ONaxiom of the sort refused the values, or an axiom of a term that reads a written term through a reference refused the write (reasoninglayer#1245); sort then names that term’s sort;bound_constraint_over_engine_records— aCHECK ONa sort whose subtree holds a sort whose terms only the engine writes (reasoninglayer#1249). A program replayed from an export is refused the same way;reference_term_unknown— aCOPY,MERGE,IMPORTorUSEwould write a reference to a term its writer may not read (reasoninglayer#1239), asPOST /api/v1/termsrefuses it. The message names no hidden id, and nothing is kept;constraint_over_unread_data— aCHECK ONaxiom that reads data the program’s writer may not read refused the values of anINSERT(reasoninglayer#1230), the axiom of a term that reads a written term included (#1245). The message is the one bare refusal, the same whichever such axiom refused and however; it names no bound, feature or constraint. Test it withisOsfqlConstraintOverUnreadData(error);write_targets_derived_fact— every term the write designated is a rule’s conclusion; the repairs name the premises to write and the rule to withdraw;retract_has_referrers— other terms designate a matched term;CASCADEorDETACHrepairs it;retract_named_by_rules— rule terms name a matched term; withdraw the rules first;retract_cascade_too_large— theCASCADEclosure exceeds cascadeLimit; retract in batches;write_creates_rule— the write carried a non-empty list underwhen, which would make the term a rule; theuse_deriverepair states it withDERIVE. A scalarwhenis ordinary data.engine_feature_write_refused— the statement names a feature only the engine writes (a runtime-record tag such as_pref_user, or bookkeeping such as_derived_by) onINSERT,UPSERT,UPDATE,CURRY,APPLY,REMOVEor anAWAITaction (reasoninglayer#1269). No principal is exempt, so repairs is empty; sort names the written sort (empty forCURRY,APPLYandREMOVE). The REST term doors answer the same code with422;program_registrant_not_actor— anAWAITfrom a request with no native user (X-Authenticated-User: user:<uuid>) to register its demon as (reasoninglayer#1256). Send the attested user: setClientConfig.authenticatedUser, orRequestOptions.authenticatedUserfor one call;program_trigger_unreadable— anAWAITon a trigger sort the caller may not read (reasoninglayer#1256); sort names the trigger sort;bound_feature_undeclared— aCHECK ONnames a feature the sort does not declare or inherit, and the name is all digits or the sort is@closed(reasoninglayer#1265). Bound a feature by a constant with@range(min, max)on its declaration;governed_sort_write_refused— the write, delete or rule conclusion targets a@governedsort (or a descendant of one), whose terms only an engine-internal door writes. No principal is exempt and no rewrite repairs it.
Each count has ONE meaning across every code: candidates is what the
refused statement’s pattern designated, referrers what blocks a
RETRACT, cascadeLimit the bound a RETRACT … CASCADE exceeded.
Example
Section titled “Example”const refusal: OsfqlRefusal = { code: 'upsert_ambiguous', sort: 'customer', candidates: 2, repairs: [ { kind: 'add_discriminator_or_key', rewrite: 'UPSERT customer(<add @key feature or discriminator>);', }, ],};Properties
Section titled “Properties”candidates
Section titled “candidates”candidates:
number
Defined in: src/types/osfql.ts:1599
How many terms the refused statement’s own pattern designated.
Remarks
Section titled “Remarks”link_endpoint_not_found:0;link_endpoint_ambiguous,upsert_ambiguous:2, read as “two or more” (the designation scan stops at the second match);link_endpoint_binding_mismatch:1, the bound term;write_targets_derived_fact: the exact number designated, all of them derived facts;key_value_clash,key_meet_bottom,key_meet_non_principal:1, the existing keyed term;bound_constraint_violated:1, the term being written;write_creates_rule:1for the term anINSERTwrites, or the number of terms anUPDATEdesignated;governed_sort_write_refused:1;retract_has_referrers,retract_named_by_rules,retract_cascade_too_large: the exact number of asserted terms theRETRACTpattern matched. It is NOT the number of blocking terms — read referrers for that.
cascadeLimit?
Section titled “cascadeLimit?”
optionalcascadeLimit?:number
Defined in: src/types/osfql.ts:1612
For retract_cascade_too_large only: the bound the CASCADE closure
exceeded. The closure walk stops at the bound, so its full size is not
reported — only that it is larger. Absent for every other code.
code:
string
Defined in: src/types/osfql.ts:1552
Typed refusal cause, snake_case, copied verbatim.
denialCode?
Section titled “denialCode?”
optionaldenialCode?:GovernanceRefusalCode
Defined in: src/types/osfql.ts:1568
The precise code of a client-door write, delete or Manage denial (reasoninglayer#1207, #1231), beside the published code.
Remarks
Section titled “Remarks”code keeps the published write_refused,
governed_sort_write_refused or authz_relation_derived; this field
names the code the REST routes answer the same denial with
(reserved_sort_write_refused, sort_write_not_granted,
filing_term_unread, reserved_sort_delete_refused,
sort_delete_not_granted, operational_authority_denied, …), and
sort_manage_not_granted for a sort the program defines, changes or
moves without a Manage grant (execution, 422; an ALTER SORT move
is refused, 403). Absent for a refusal that is no client-door denial.
referrers?
Section titled “referrers?”
optionalreferrers?:number
Defined in: src/types/osfql.ts:1606
The terms outside the matched set that block a RETRACT: for
retract_has_referrers the data terms that designate a matched term, for
retract_named_by_rules the rule terms that name one. Absent for every
other code.
repairs
Section titled “repairs”repairs:
OsfqlRepair[]
Defined in: src/types/osfql.ts:1619
Concrete rewrites, most-preferred first. Empty when no statement rewrite
repairs the refusal: key_value_clash, key_meet_bottom,
bound_constraint_violated, constraint_over_unread_data,
retract_named_by_rules and retract_cascade_too_large.
optionalrole?:string
Defined in: src/types/osfql.ts:1577
The link endpoint role (source / target) when the statement is a link.
sort:
string
Defined in: src/types/osfql.ts:1575
The sort the refusal concerns: the sort the refused statement’s pattern
names or, for key_*, bound_constraint_violated and
write_targets_derived_fact through a bound variable, the sort of the
term being written.