On this page
policy
Intent
A reusable authorization/business rule with explicit required/provided semantic context and an optional expression rule.
Exact selection subject:
subject: policy
The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly.
Scope envelope
| Scope | Context |
|---|---|
each | policy: PolicyContext |
all | policies: PolicyContext[] |
| collection candidates | collects.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 path | Type | Meaning / template use |
|---|---|---|
policy.id | string | Opaque stable semantic identity. |
policy.name | NameContext | Stable semantic identity and finite naming variants. |
policy.description | string|null | Human semantic description. |
policy.tags | string[] | Semantic classifiers; empty when none. |
policy.explanations | ExplanationContext[] | Advisory usage/security/implementation notes. |
policy.group | SemanticLinkContext|null | Owning semantic group. |
policy.feature | SemanticLinkContext|null | Canonical owning feature, when present. |
policy.context.requires | NamedValueContext[] | Named values the policy expects. |
policy.context.provides | NamedValueContext[] | Named values the policy provides. |
policy.context.requires[].name | NameContext | Explicit context key. |
policy.context.requires[].value | SemanticLinkContext | Property/schema value. |
policy.rule | SemanticLinkContext|null | Reusable 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
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?