On this page

expression

Intent

A named renderer-neutral evaluable expression used by policies, defaults, invariants, and semantic conditions.

Exact selection subject:

yaml
subject: expression

The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly.

Scope envelope

ScopeContext
eachexpression: ExpressionContext
allexpressions: ExpressionContext[]
collection candidatescollects.group, collects.feature

For collects.<dimension>, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable.

Context tree

Context pathTypeMeaning / template use
expression.idstringOpaque stable semantic identity.
expression.nameNameContextStable semantic identity and finite naming variants.
expression.descriptionstring|nullHuman semantic description.
expression.tagsstring[]Semantic classifiers; empty when none.
expression.explanationsExplanationContext[]Advisory usage/security/implementation notes.
expression.groupSemanticLinkContext|nullOwning semantic group.
expression.featureSemanticLinkContext|nullCanonical owning feature, when present.
expression.nodeExpressionNodeContextNormalized recursive AST root.
expression.node.kindliteral|context|duration|comparison|arithmetic|logical|unary|function|referenceExplicit node discriminator.
expression.node.valueCanonicalValue|ExpressionNodeContext|nullLiteral/unary/function input.
expression.node.contextstring|nullNamed evaluation context.
expression.node.pathSemanticPathContext|nullPath inside named context.
expression.node.operatorstring|nullComparison/arithmetic/logical/unary operator.
expression.node.valuesExpressionNodeContext[]N-ary operands.
expression.node.left/rightExpressionNodeContext|nullBinary comparison operands.
expression.node.functionstring|nullTemporal function.
expression.node.time_zonestring|nullTimezone argument.
expression.node.durationDurationContext|nullDuration literal.
expression.node.targetSemanticLinkContext|nullReusable expression link.

Usage rules

  • Normalize structurally different current nodes into an explicit kind tree.
  • Recursive expression refs remain bounded unless a future request protocol explicitly expands them.

Runtime IR implications to audit

  • Reusable expressions should gain consistent metadata/group ownership.
  • Provide a normalized inspectable node discriminator.

Template example — Jinja / predicate

jinja
def {{ expression.name.snake }}(ctx):
{% if expression.node.kind == "comparison" %}
    return {{ render_expression(expression.node.left) }} {{ render_operator(expression.node.operator) }} {{ render_expression(expression.node.right) }}
{% endif %}

The example uses semantic context only. Any renderType/render_type helper shown is a pack-owned macro/partial consuming the documented TypeContext, not hidden Dryv context.

Audit questions

  • Can a real expression pack generate code without parsing raw IR storage conventions?
  • Is any field here present only because the current IR happens to store it?
  • Does any nested item need first-class selection of its own?
Search in