@dlovans/tenet-core 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,7 +118,7 @@ function applyAction(state, action, ruleId, lawRef) {
118
118
  }
119
119
  // Emit error if specified
120
120
  if (action.error_msg) {
121
- addError(state, '', ruleId, 'runtime_warning', action.error_msg, lawRef);
121
+ addError(state, '', ruleId, action.error_kind ?? 'constraint_violation', action.error_msg, lawRef);
122
122
  }
123
123
  }
124
124
  /**
package/dist/core/lint.js CHANGED
@@ -507,6 +507,19 @@ function checkAction(ctx, action, rulePath, ruleId, fieldsSetBy) {
507
507
  }
508
508
  }
509
509
  }
510
+ // Validate error_kind if present
511
+ if (action.error_kind !== undefined) {
512
+ const validKinds = new Set([
513
+ 'type_mismatch', 'missing_required', 'constraint_violation',
514
+ 'attestation_incomplete', 'runtime_warning', 'cycle_detected', 'notice',
515
+ ]);
516
+ if (typeof action.error_kind !== 'string' || !validKinds.has(action.error_kind)) {
517
+ addIssue(ctx, 'error', 'invalid_error_kind', `Rule '${ruleId}' has invalid error_kind '${action.error_kind}'`, {
518
+ path: `${rulePath}.then.error_kind`,
519
+ rule_id: ruleId,
520
+ });
521
+ }
522
+ }
510
523
  if (action.ui_modify) {
511
524
  for (const field of Object.keys(action.ui_modify)) {
512
525
  // W18: ui_modify targets undefined field
@@ -86,6 +86,7 @@ export interface Action {
86
86
  set?: Record<string, unknown>;
87
87
  ui_modify?: Record<string, unknown>;
88
88
  error_msg?: string;
89
+ error_kind?: ErrorKind;
89
90
  }
90
91
  export interface TemporalBranch {
91
92
  valid_range: [string | null, string | null];
@@ -99,7 +100,7 @@ export interface StateModel {
99
100
  export interface DerivedDef {
100
101
  eval: Record<string, unknown>;
101
102
  }
102
- export type ErrorKind = 'type_mismatch' | 'missing_required' | 'constraint_violation' | 'attestation_incomplete' | 'runtime_warning' | 'cycle_detected';
103
+ export type ErrorKind = 'type_mismatch' | 'missing_required' | 'constraint_violation' | 'attestation_incomplete' | 'runtime_warning' | 'cycle_detected' | 'notice';
103
104
  export interface ValidationError {
104
105
  field_id?: string;
105
106
  rule_id?: string;
@@ -17,5 +17,6 @@ export declare function validateDefinitions(state: EvalState): void;
17
17
  export declare function checkAttestations(state: EvalState, applyAction: (action: Action, ruleId: string, lawRef: string) => void): void;
18
18
  /**
19
19
  * Determine document status based on ErrorKind.
20
+ * Non-blocking kinds (runtime_warning, cycle_detected, notice) do not affect status.
20
21
  */
21
22
  export declare function determineStatus(state: EvalState): DocStatus;
@@ -180,6 +180,7 @@ export function checkAttestations(state, applyAction) {
180
180
  }
181
181
  /**
182
182
  * Determine document status based on ErrorKind.
183
+ * Non-blocking kinds (runtime_warning, cycle_detected, notice) do not affect status.
183
184
  */
184
185
  export function determineStatus(state) {
185
186
  for (const err of state.errors) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dlovans/tenet-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Declarative logic VM for JSON schemas - reactive validation, temporal routing, and computed state",
6
6
  "main": "dist/index.js",