Skip to main content

Assertion contracts and limits

Language: canon-expr/1. Source implementation; no release is claimed.

The concept guide explains compilation, acquisition and offline evaluation. These limits are read from the library constants; changing one requires compatibility review.

BudgetMaximum
Combined source bytes65536
Tokens per expression16384
Nesting32
Expanded nodes4096
Assertions1024
Unique requests4096
Bound values or evidence payload bytes1048576

Typed documents​

This is the exact ESS model embedded by the expression library. Semantic constraints are exercised by its conformance suite. Integer wire strings preserve i128 values through JSON; decimal coefficients use the same canonical strings.

domain: canon.expr
summary: Typed expression programs, catalog contracts, collected observations and pure evaluation reports.
naming:
wire: expr
display: Expression

types:
# read from: docs/design/assertion-api.md (Scalar)
- name: canon.expr.Scalar
kind: enum
variants: ["bool", "string", "integer", "decimal"]

# read from: docs/design/assertion-api.md (Type)
- name: canon.expr.Type
kind: union
tag: kind
variants:
scalar: canon.expr.Scalar
list: canon.expr.Type
map: canon.expr.Type
record: Map<String, canon.expr.Type>
optional: canon.expr.Type

# read from: docs/design/assertion-api.md (Exact)
- name: canon.expr.Exact
kind: struct
fields:
- name: coefficient
type: String
- name: scale
type: Integer

# read from: docs/design/assertion-api.md (Value)
- name: canon.expr.Value
kind: union
tag: kind
variants:
bool: Boolean
string: String
integer: String
decimal: canon.expr.Exact
list: List<canon.expr.Value>
record: Map<String, canon.expr.Value>
map: Map<String, canon.expr.Value>
optional: Optional<canon.expr.Value>

# read from: docs/design/assertion-api.md (Builtin)
- name: canon.expr.Builtin
kind: enum
variants: ["length", "contains", "starts_with", "ends_with", "present"]

# read from: docs/design/assertion-api.md (Provider)
- name: canon.expr.Provider
kind: struct
fields:
- name: provider
type: String
- name: operation
type: String
- name: digest
type: String

# read from: docs/design/assertion-api.md (Implementation)
- name: canon.expr.Implementation
kind: union
tag: kind
variants:
observation: canon.expr.Provider
recipe: String
pure: canon.expr.Builtin

# read from: docs/design/assertion-api.md (Parameter)
- name: canon.expr.Parameter
kind: struct
fields:
- name: name
type: String
- name: value_type
type: canon.expr.Type
- name: default
type: Optional<canon.expr.Value>

# read from: docs/design/assertion-api.md (Function)
- name: canon.expr.Function
kind: struct
fields:
- name: parameters
type: List<canon.expr.Parameter>
- name: returns
type: canon.expr.Type
- name: implementation
type: canon.expr.Implementation

# read from: docs/design/assertion-api.md (Catalog)
- name: canon.expr.Catalog
kind: struct
fields:
- name: format
type: String
- name: functions
type: Map<String, canon.expr.Function>

# read from: docs/design/assertion-api.md (Bindings)
- name: canon.expr.Bindings
kind: struct
fields:
- name: values
type: Map<String, canon.expr.Value>
- name: source_identity
type: String
- name: context_identity
type: String

# read from: docs/design/assertion-api.md (Request)
- name: canon.expr.Request
kind: struct
fields:
- name: id
type: String
- name: provider
type: String
- name: operation
type: String
- name: digest
type: String
- name: arguments
type: Map<String, canon.expr.Value>
- name: result_type
type: canon.expr.Type

# read from: docs/design/assertion-api.md (Outcome)
- name: canon.expr.Outcome
kind: union
tag: kind
variants:
known: canon.expr.Value
unavailable: String

# read from: docs/design/assertion-api.md (Observation)
- name: canon.expr.Observation
kind: struct
fields:
- name: request_id
type: String
- name: plan_id
type: String
- name: observed_at
type: Integer
- name: valid_until
type: Optional<Integer>
- name: outcome
type: canon.expr.Outcome

# read from: docs/design/assertion-api.md (EvalContext)
- name: canon.expr.EvalContext
kind: struct
fields:
- name: now
type: Integer
- name: source_identity
type: String
- name: context_identity
type: String

# read from: docs/design/assertion-api.md (Truth)
- name: canon.expr.Truth
kind: enum
variants: ["true", "false", "unknown"]

# read from: docs/design/assertion-api.md (Evaluation)
- name: canon.expr.Evaluation
kind: struct
fields:
- name: expression
type: String
- name: truth
type: canon.expr.Truth
- name: reasons
type: List<String>

# read from: docs/design/assertion-api.md (Report)
- name: canon.expr.Report
kind: struct
fields:
- name: plan_id
type: String
- name: truth
type: canon.expr.Truth
- name: assertions
type: List<canon.expr.Evaluation>

# read from: docs/design/assertion-api.md (PlanDocument)
- name: canon.expr.PlanDocument
kind: struct
fields:
- name: id
type: String
- name: sources
type: List<String>
- name: catalog
type: canon.expr.Catalog
- name: bindings
type: canon.expr.Bindings
- name: context_types
type: Map<String, canon.expr.Type>
- name: requests
type: List<canon.expr.Request>