Module: Hecks::Runtime
- Defined in:
- lib/hecks/runtime.rb,
lib/hecks/runtime/event.rb,
lib/hecks/runtime/value.rb,
lib/hecks/runtime/caller.rb,
lib/hecks/runtime/errors.rb,
lib/hecks/runtime/loader.rb,
lib/hecks/runtime/routing.rb,
lib/hecks/runtime/identity.rb,
lib/hecks/runtime/instance.rb,
lib/hecks/runtime/registry.rb,
lib/hecks/runtime/era_check.rb,
lib/hecks/runtime/era_guard.rb,
lib/hecks/runtime/dispatcher.rb,
lib/hecks/runtime/era_tamper.rb,
lib/hecks/runtime/interpreting.rb,
lib/hecks/runtime/tenant_check.rb,
lib/hecks/runtime/tenant_scope.rb,
lib/hecks/runtime/command_rules.rb,
lib/hecks/runtime/rebuild_sweep.rb,
lib/hecks/runtime/reference_hop.rb,
lib/hecks/runtime/storage_shape.rb,
lib/hecks/runtime/entity_element.rb,
lib/hecks/runtime/value/coercion.rb,
lib/hecks/runtime/refusal_wording.rb,
lib/hecks/runtime/value/admission.rb,
lib/hecks/runtime/capability_graph.rb,
lib/hecks/runtime/saga_interpreter.rb,
lib/hecks/runtime/query_interpreter.rb,
lib/hecks/runtime/remote_dispatcher.rb,
lib/hecks/runtime/entity_interpreter.rb,
lib/hecks/runtime/policy_interpreter.rb,
lib/hecks/runtime/command_interpreter.rb,
lib/hecks/runtime/dependency_planning.rb,
lib/hecks/runtime/reaction_invocation.rb,
lib/hecks/runtime/era_guard/shape_diff.rb,
lib/hecks/runtime/registry/verification.rb,
lib/hecks/runtime/command_rules/emission.rb,
lib/hecks/runtime/read_model_interpreter.rb,
lib/hecks/runtime/command_rules/arithmetic.rb,
lib/hecks/runtime/command_rules/references.rb,
lib/hecks/runtime/registry/saga_persistence.rb,
lib/hecks/runtime/value/invariant_violation.rb,
lib/hecks/runtime/port_operation_interpreter.rb,
lib/hecks/runtime/command_rules/admissibility.rb,
lib/hecks/runtime/command_rules/authorization.rb,
lib/hecks/runtime/saga_interpreter/correlation.rb,
lib/hecks/runtime/command_interpreter/argument_gate.rb,
lib/hecks/runtime/command_interpreter/mutation_applier.rb
Defined Under Namespace
Modules: Caller, DependencyPlanning, EntityElement, EraCheck, EraGuard, EraTamper, Identity, Interpreting, ReactionInvocation, RebuildSweep, ReferenceHop, RefusalWording, Routing, StorageShape, TenantCheck, TenantScope Classes: AbsentArgument, AlreadyExists, AttributeAbsent, CapabilityGraph, CommandInterpreter, CommandRules, Dispatcher, EnsuresNotMet, EntityInterpreter, Event, GivenNotMet, Instance, InvariantViolation, LifecycleRefused, Loader, NotFound, PolicyInterpreter, PortOperationInterpreter, ProjectionAbsent, QueryInterpreter, ReadModelInterpreter, Registry, RemoteDispatcher, RemoteRefusal, SagaInterpreter, TypeMismatch, Unauthorized, UnknownArgument, UnknownVerb, Value, WiringError
Constant Summary collapse
- DOMAIN_REFUSALS =
The domain saying NO — the errors a reaction may legitimately meet and record as an undelivered outcome. A policy whose target refuses is a fact about the domain ; the originating command still stands.
Everything ELSE is a defect : a NoMethodError in an interpreter, a NameError from a missing constant, a TypeError from a bad assumption. A blanket
rescue StandardErrorused to fold both into one line —delivered: false, reason: "..."— so a crash in the runtime was indistinguishable from a rule doing its job, and read as normal operation in the log.UnknownVerb IS one of these, and deliberately : a cross-domain policy (
across "Notifications") fires in deployments where that domain is not loaded, and recording the undelivered reaction rather than raising is the design — spec/policy_spec states it in so many words, "records a reaction it cannot deliver rather than swallowing it". InvariantViolation belongs here and was missing. A value object refusing its own rule is the domain saying no as plainly as a given is — but the class is declared over in value.rb and never made the list, so the policy and saga interpreters, which rescue exactly these, would let it propagate as though the RUNTIME had broken. A reaction whose target violates an invariant is declined, not crashed. Found by spec/domain_refusal_spec on its first run : every corpus refusal must be a class named here, and 23 of banking's were InvariantViolation. THE NAMES COME FROM THE LANGUAGE, the classes from this module.DomainRefusaldeclares WHICH refusals are the domain's own — a rule the caller broke — as against a runtime fault. Resolving each name here means a refusal declared but never defined fails at load with a NameError, rather than being quietly absent from a list nothing re-checks. Hecks::Vocabulary.fetch("DomainRefusal").map { |name| const_get(name) }.freeze
Class Attribute Summary collapse
-
.current_registry ⇒ Object
readonly
The registry declarations are currently landing in, or nil outside a boot.
Class Method Summary collapse
-
.as_caller(role:, actor_id: nil, &block) ⇒ Object
Bind the ambient caller (see Runtime::Caller) for the duration of the block — who a command's declared
role, if any, is checked against. -
.boot(path, shared: nil, install_facade: true, environment: nil) ⇒ Object
Load a bluebook directory and return the Dispatcher bound to it.
-
.boot_files(paths, shared: nil, install_facade: true, environment: nil) ⇒ Object
pathsform — see Loader.boot_files. -
.with_registry(registry) ⇒ Object
Bind the ambient registry for the duration of the block, restoring whatever was there before.
Class Attribute Details
.current_registry ⇒ Object (readonly)
The registry declarations are currently landing in, or nil outside a boot. Read by the DSL collectors on the top-level module and by the extraction port.
66 67 68 |
# File 'lib/hecks/runtime.rb', line 66 def current_registry @current_registry end |
Class Method Details
.as_caller(role:, actor_id: nil, &block) ⇒ Object
Bind the ambient caller (see Runtime::Caller) for the duration of
the block — who a command's declared role, if any, is checked
against.
92 |
# File 'lib/hecks/runtime.rb', line 92 def as_caller(role:, actor_id: nil, &block) = Caller.as(role: role, actor_id: actor_id, &block) |
.boot(path, shared: nil, install_facade: true, environment: nil) ⇒ Object
Load a bluebook directory and return the Dispatcher bound to it.
install_facade:, environment: — see Loader.boot.
70 71 72 |
# File 'lib/hecks/runtime.rb', line 70 def boot(path, shared: nil, install_facade: true, environment: nil) Loader.boot(path, shared: shared, install_facade: install_facade, environment: environment) end |
.boot_files(paths, shared: nil, install_facade: true, environment: nil) ⇒ Object
paths form — see Loader.boot_files.
75 76 77 |
# File 'lib/hecks/runtime.rb', line 75 def boot_files(paths, shared: nil, install_facade: true, environment: nil) Loader.boot_files(paths, shared: shared, install_facade: install_facade, environment: environment) end |
.with_registry(registry) ⇒ Object
Bind the ambient registry for the duration of the block, restoring whatever was there before. Nesting is safe ; a raise still restores.
81 82 83 84 85 86 87 |
# File 'lib/hecks/runtime.rb', line 81 def with_registry(registry) previous = @current_registry @current_registry = registry yield ensure @current_registry = previous end |