On this page

policy

Intent

A reusable authorization/business rule with explicit required/provided semantic context and an optional expression rule.

Exact selection subject:

yaml
subject: policy

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

Scope envelope

ScopeContext
eachpolicy: PolicyContext
allpolicies: PolicyContext[]
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
policy.idstringOpaque stable semantic identity.
policy.nameNameContextStable semantic identity and finite naming variants.
policy.descriptionstring|nullHuman semantic description.
policy.tagsstring[]Semantic classifiers; empty when none.
policy.explanationsExplanationContext[]Advisory usage/security/implementation notes.
policy.groupSemanticLinkContext|nullOwning semantic group.
policy.featureSemanticLinkContext|nullCanonical owning feature, when present.
policy.context.requiresNamedValueContext[]Named values the policy expects.
policy.context.providesNamedValueContext[]Named values the policy provides.
policy.context.requires[].nameNameContextExplicit context key.
policy.context.requires[].valueSemanticLinkContextProperty/schema value.
policy.ruleSemanticLinkContext|nullReusable expression rule.

Usage rules

  • Current requires/provides maps become explicit named arrays.
  • Target-specific guard/decorator syntax stays in the pack.

Runtime IR implications to audit

  • Mostly normalization; keep reverse feature membership efficient.

Template example — Handlebars / guard skeleton

hbs
export class
{{file.symbol}}
{ canActivate(context: PolicyContext): boolean {
{{#each policy.context.requires}}
  const
  {{name.camel}}
  = context.require("{{name.local}}");
{{/each}}
return evaluatePolicy("{{policy.name.qualified}}", context); } }

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 policy 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