tangl.vm.dispatch¶
Dispatch decorators and handler entrypoints that allow higher layers to contribute runtime, provisioning, and replay behavior.
Related design docs
Related notes
Dispatch module¶
Phase bus hooks for the VM pipeline.
This module provides the registration (on_*) and execution (do_*) surface
for every phase in the resolution pipeline, plus the namespace gathering hook
that assembles scoped context from entity-local publication plus dispatch
contributors.
Design Principle — Explicit Names, DRY Bodies¶
Each on_* / do_* pair is an explicitly named module-level function (for IDE
support, import clarity, and grep-ability) but the body is generated from a shared
helper keyed by task name and aggregation mode.
The on_resolve / do_resolve hook is separate because it has a different call
signature (takes requirement + offers, not caller).
The on_gather_ns / do_gather_ns hook family is separate because it
assembles scoped namespaces from per-entity get_ns() publication plus
immediate dispatch contributions.
See also
tangl.vm.resolution_phasePhase ordering and semantics.
tangl.core.behaviorBehaviorRegistryandCallReceiptaggregation primitives.tangl.vm.runtime.frameConsumer of the
do_*functions.
Phase decorators¶
- on_validate(func=None, **kwargs)¶
Register a handler for the
validate_edgetask.
- on_provision(func=None, **kwargs)¶
Register a handler for the
provision_nodetask.
- on_prereqs(func=None, **kwargs)¶
Register a handler for the
get_prereqstask.
- on_update(func=None, **kwargs)¶
Register a handler for the
apply_updatetask.
- on_journal(func=None, **kwargs)¶
Register a handler for the
render_journaltask.
- on_finalize(func=None, **kwargs)¶
Register a handler for the
finalize_steptask.
- on_postreqs(func=None, **kwargs)¶
Register a handler for the
get_postreqstask.
Phase runners¶
Namespace and scope hooks¶
on_gather_ns / do_gather_ns assemble the scoped runtime namespace.
Entity get_ns() remains the lower-level local publication seam.
- on_gather_ns(func=None, **kwargs)[source]¶
Register a contributor to assembled scoped namespaces.
Use
wants_caller_kind=Typeto filter by caller type andwants_exact_kind=Falseto allow subclass matches.
- do_gather_ns(node, *, ctx)[source]¶
Assemble the scoped namespace for
nodein two phases.Phase 1 calls entity-local
get_ns()onnodeand its ancestor chain. Phase 2 merges immediate-callergather_nsdispatch contributions.The resulting
ChainMapis the assembled scoped view consumed byPhaseCtx.get_ns(node)and availability/render helpers.