Module: Hecks

Defined in:
lib/hecks/ports.rb,
lib/hecks.rb,
lib/hecks/ir.rb,
lib/hecks/fqn.rb,
lib/hecks/forms.rb,
lib/hecks/facade.rb,
lib/hecks/naming.rb,
lib/hecks/router.rb,
lib/hecks/codemod.rb,
lib/hecks/freezer.rb,
lib/hecks/fuzzing.rb,
lib/hecks/grammar.rb,
lib/hecks/literal.rb,
lib/hecks/runtime.rb,
lib/hecks/version.rb,
lib/hecks/adapters.rb,
lib/hecks/bluebook.rb,
lib/hecks/query_ir.rb,
lib/hecks/behaviors.rb,
lib/hecks/construct.rb,
lib/hecks/forms/app.rb,
lib/hecks/framework.rb,
lib/hecks/projector.rb,
lib/hecks/rendering.rb,
lib/hecks/forms/html.rb,
lib/hecks/forms/page.rb,
lib/hecks/vocabulary.rb,
lib/hecks/ports/agent.rb,
lib/hecks/ports/clock.rb,
lib/hecks/ports/query.rb,
lib/hecks/projections.rb,
lib/hecks/translation.rb,
lib/hecks/behaviors/ir.rb,
lib/hecks/bluebook/dsl.rb,
lib/hecks/forms/params.rb,
lib/hecks/behaviors/dsl.rb,
lib/hecks/doc/reference.rb,
lib/hecks/facade/handle.rb,
lib/hecks/ports/loading.rb,
lib/hecks/runtime/event.rb,
lib/hecks/runtime/value.rb,
lib/hecks/bluebook/query.rb,
lib/hecks/facade/surface.rb,
lib/hecks/fuzzing/replay.rb,
lib/hecks/grammar/evolve.rb,
lib/hecks/projections/ir.rb,
lib/hecks/runtime/caller.rb,
lib/hecks/runtime/errors.rb,
lib/hecks/runtime/loader.rb,
lib/hecks/adapters/driven.rb,
lib/hecks/behaviors/rspec.rb,
lib/hecks/bluebook/entity.rb,
lib/hecks/bluebook/policy.rb,
lib/hecks/facade/cli_door.rb,
lib/hecks/runtime/routing.rb,
lib/hecks/behaviors/runner.rb,
lib/hecks/bluebook/chapter.rb,
lib/hecks/bluebook/command.rb,
lib/hecks/bluebook/hexagon.rb,
lib/hecks/facade/json_door.rb,
lib/hecks/ports/extraction.rb,
lib/hecks/ports/projection.rb,
lib/hecks/projections/oidc.rb,
lib/hecks/projector/target.rb,
lib/hecks/runtime/identity.rb,
lib/hecks/runtime/instance.rb,
lib/hecks/runtime/registry.rb,
lib/hecks/bluebook/assembly.rb,
lib/hecks/facade/cli_runner.rb,
lib/hecks/forms/field_shape.rb,
lib/hecks/ports/persistence.rb,
lib/hecks/ports/persistence.rb,
lib/hecks/projections/model.rb,
lib/hecks/projections/shape.rb,
lib/hecks/runtime/era_check.rb,
lib/hecks/runtime/era_guard.rb,
lib/hecks/translation/audit.rb,
lib/hecks/adapters/driven/d1.rb,
lib/hecks/bluebook/aggregate.rb,
lib/hecks/bluebook/attribute.rb,
lib/hecks/bluebook/lifecycle.rb,
lib/hecks/bluebook/reference.rb,
lib/hecks/forms/record_table.rb,
lib/hecks/fuzzing/properties.rb,
lib/hecks/projector/exporter.rb,
lib/hecks/runtime/dispatcher.rb,
lib/hecks/runtime/era_tamper.rb,
lib/hecks/bluebook/expression.rb,
lib/hecks/bluebook/read_model.rb,
lib/hecks/bluebook/smoke_test.rb,
lib/hecks/embryonaut_bluebook.rb,
lib/hecks/ports/agent/answers.rb,
lib/hecks/ports/authorization.rb,
lib/hecks/query_specification.rb,
lib/hecks/adapters/driven/heki.rb,
lib/hecks/bluebook/domain_port.rb,
lib/hecks/bluebook/model_check.rb,
lib/hecks/bluebook/synthesizer.rb,
lib/hecks/bluebook/translation.rb,
lib/hecks/forms/field_renderer.rb,
lib/hecks/forms/index_renderer.rb,
lib/hecks/ports/access_control.rb,
lib/hecks/ports/authentication.rb,
lib/hecks/ports/query/ordering.rb,
lib/hecks/projections/diagrams.rb,
lib/hecks/runtime/interpreting.rb,
lib/hecks/runtime/tenant_check.rb,
lib/hecks/runtime/tenant_scope.rb,
lib/hecks/translation/reattest.rb,
lib/hecks/translation/scaffold.rb,
lib/hecks/adapters/driven/prism.rb,
lib/hecks/bluebook/value_object.rb,
lib/hecks/forms/record_renderer.rb,
lib/hecks/fuzzing/isolated_boot.rb,
lib/hecks/ports/query/in_memory.rb,
lib/hecks/projections/reference.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/adapters/driven/folder.rb,
lib/hecks/adapters/driven/lambda.rb,
lib/hecks/adapters/driven/memory.rb,
lib/hecks/adapters/driven/sqlite.rb,
lib/hecks/behaviors/expectations.rb,
lib/hecks/bluebook/dsl/malformed.rb,
lib/hecks/bluebook/dsl/word_gate.rb,
lib/hecks/facade/command_request.rb,
lib/hecks/facade/surface/chapter.rb,
lib/hecks/projections/statements.rb,
lib/hecks/projections/vocabulary.rb,
lib/hecks/projector/ir_projector.rb,
lib/hecks/runtime/entity_element.rb,
lib/hecks/runtime/value/coercion.rb,
lib/hecks/bluebook/assembly/build.rb,
lib/hecks/bluebook/assembly/marks.rb,
lib/hecks/bluebook/dsl/const_shim.rb,
lib/hecks/bluebook/meta_validator.rb,
lib/hecks/bluebook/pattern_subset.rb,
lib/hecks/bluebook/project_loader.rb,
lib/hecks/forms/reference_options.rb,
lib/hecks/fuzzing/value_generator.rb,
lib/hecks/projector/cli_projector.rb,
lib/hecks/runtime/refusal_wording.rb,
lib/hecks/runtime/value/admission.rb,
lib/hecks/adapters/driven/postgres.rb,
lib/hecks/bluebook/behaviour/query.rb,
lib/hecks/bluebook/process_manager.rb,
lib/hecks/forms/value_object_shape.rb,
lib/hecks/projections/parser_table.rb,
lib/hecks/projector/docs_projector.rb,
lib/hecks/runtime/capability_graph.rb,
lib/hecks/runtime/saga_interpreter.rb,
lib/hecks/bluebook/behaviour/entity.rb,
lib/hecks/bluebook/behaviour/policy.rb,
lib/hecks/bluebook/behaviour/traits.rb,
lib/hecks/bluebook/dsl/port_builder.rb,
lib/hecks/bluebook/project_register.rb,
lib/hecks/forms/query_form_renderer.rb,
lib/hecks/ports/identity_assignment.rb,
lib/hecks/ports/identity_generation.rb,
lib/hecks/ports/identity_resolution.rb,
lib/hecks/ports/persistence/lineage.rb,
lib/hecks/runtime/query_interpreter.rb,
lib/hecks/runtime/remote_dispatcher.rb,
lib/hecks/translation/rule_compiler.rb,
lib/hecks/bluebook/assembly/contract.rb,
lib/hecks/bluebook/behaviour/chapter.rb,
lib/hecks/bluebook/behaviour/command.rb,
lib/hecks/bluebook/behaviour/hexagon.rb,
lib/hecks/bluebook/dsl/binding_proxy.rb,
lib/hecks/bluebook/dsl/query_builder.rb,
lib/hecks/bluebook/dsl/world_builder.rb,
lib/hecks/bluebook/project_discovery.rb,
lib/hecks/fuzzing/sequence_generator.rb,
lib/hecks/router/namespace_installer.rb,
lib/hecks/runtime/entity_interpreter.rb,
lib/hecks/runtime/policy_interpreter.rb,
lib/hecks/adapters/driven/claude_code.rb,
lib/hecks/bluebook/assembly/contracts.rb,
lib/hecks/bluebook/dsl/entity_builder.rb,
lib/hecks/bluebook/dsl/policy_builder.rb,
lib/hecks/bluebook/dsl/rule_reference.rb,
lib/hecks/forms/command_form_renderer.rb,
lib/hecks/ports/persistence/execution.rb,
lib/hecks/projector/narrate_projector.rb,
lib/hecks/runtime/command_interpreter.rb,
lib/hecks/runtime/dependency_planning.rb,
lib/hecks/runtime/reaction_invocation.rb,
lib/hecks/translation/audit/layer_one.rb,
lib/hecks/translation/audit/layer_two.rb,
lib/hecks/translation/scaffold/differ.rb,
lib/hecks/translation/scaffold/writer.rb,
lib/hecks/adapters/driven/heki/journal.rb,
lib/hecks/adapters/driven/postgres_era.rb,
lib/hecks/adapters/driven/sqlite/codec.rb,
lib/hecks/adapters/driven/system_clock.rb,
lib/hecks/bluebook/behaviour/aggregate.rb,
lib/hecks/bluebook/behaviour/attribute.rb,
lib/hecks/bluebook/behaviour/lifecycle.rb,
lib/hecks/bluebook/dsl/adapter_builder.rb,
lib/hecks/bluebook/dsl/command_builder.rb,
lib/hecks/bluebook/expression/resolver.rb,
lib/hecks/bluebook/meta_validator/plan.rb,
lib/hecks/projections/model/deviations.rb,
lib/hecks/query_specification/hop_path.rb,
lib/hecks/runtime/era_guard/shape_diff.rb,
lib/hecks/adapters/driven/heki/snapshot.rb,
lib/hecks/adapters/driven/lambda/client.rb,
lib/hecks/bluebook/assembly/specializer.rb,
lib/hecks/bluebook/behaviour/read_model.rb,
lib/hecks/bluebook/dsl/bluebook_builder.rb,
lib/hecks/bluebook/dsl/generic_dispatch.rb,
lib/hecks/bluebook/expression/evaluator.rb,
lib/hecks/bluebook/meta_validator/judge.rb,
lib/hecks/facade/surface/aggregate_door.rb,
lib/hecks/ports/persistence/append_only.rb,
lib/hecks/runtime/registry/verification.rb,
lib/hecks/translation/scaffold/renderer.rb,
lib/hecks/adapters/driven/postgres/codec.rb,
lib/hecks/bluebook/behaviour/domain_port.rb,
lib/hecks/bluebook/dsl/aggregate_builder.rb,
lib/hecks/bluebook/dsl/hecksagon_builder.rb,
lib/hecks/bluebook/dsl/lifecycle_builder.rb,
lib/hecks/bluebook/meta_validator/shapes.rb,
lib/hecks/query_specification/common/dsl.rb,
lib/hecks/query_specification/field_path.rb,
lib/hecks/runtime/command_rules/emission.rb,
lib/hecks/runtime/read_model_interpreter.rb,
lib/hecks/translation/audit/unfed_report.rb,
lib/hecks/adapters/driven/heki/saga_store.rb,
lib/hecks/bluebook/behaviour/value_object.rb,
lib/hecks/bluebook/dsl/read_model_builder.rb,
lib/hecks/fuzzing/invalid_value_generator.rb,
lib/hecks/bluebook/dsl/attribute_collector.rb,
lib/hecks/bluebook/dsl/domain_port_builder.rb,
lib/hecks/bluebook/dsl/translation_builder.rb,
lib/hecks/bluebook/meta_validator/readings.rb,
lib/hecks/ports/persistence/binding_policy.rb,
lib/hecks/ports/persistence/remote_runtime.rb,
lib/hecks/runtime/command_rules/arithmetic.rb,
lib/hecks/runtime/command_rules/references.rb,
lib/hecks/adapters/driven/identity_registry.rb,
lib/hecks/adapters/driven/sql_query_builder.rb,
lib/hecks/adapters/driven/sqlite/projection.rb,
lib/hecks/bluebook/dsl/identity_declaration.rb,
lib/hecks/bluebook/dsl/value_object_builder.rb,
lib/hecks/fuzzing/sequence_generator/picker.rb,
lib/hecks/ports/persistence/null_saga_store.rb,
lib/hecks/runtime/registry/saga_persistence.rb,
lib/hecks/runtime/value/invariant_violation.rb,
lib/hecks/translation/audit/approval_digest.rb,
lib/hecks/adapters/driven/in_memory_ordering.rb,
lib/hecks/bluebook/behaviour/process_manager.rb,
lib/hecks/bluebook/expression/canonical_form.rb,
lib/hecks/bluebook/meta_validator/port_judge.rb,
lib/hecks/fuzzing/sequence_generator/catalog.rb,
lib/hecks/query_specification/common/options.rb,
lib/hecks/runtime/port_operation_interpreter.rb,
lib/hecks/adapters/driven/mock_stripe_adapter.rb,
lib/hecks/bluebook/dsl/port_operation_builder.rb,
lib/hecks/bluebook/meta_validator/syntax_boot.rb,
lib/hecks/bluebook/meta_validator/world_judge.rb,
lib/hecks/query_specification/common/order_by.rb,
lib/hecks/runtime/command_rules/admissibility.rb,
lib/hecks/runtime/command_rules/authorization.rb,
lib/hecks/adapters/driven/postgres_era/lineage.rb,
lib/hecks/bluebook/assembly/aggregate_assembly.rb,
lib/hecks/bluebook/dsl/process_manager_builder.rb,
lib/hecks/ports/persistence/repository_factory.rb,
lib/hecks/runtime/saga_interpreter/correlation.rb,
lib/hecks/adapters/driven/google_authentication.rb,
lib/hecks/adapters/driven/sqlite/schema_builder.rb,
lib/hecks/bluebook/meta_validator/adapter_judge.rb,
lib/hecks/query_specification/common/comparison.rb,
lib/hecks/query_specification/common/limit_spec.rb,
lib/hecks/adapters/driven/secure_random_identity.rb,
lib/hecks/bluebook/meta_validator/reconstruction.rb,
lib/hecks/query_specification/common/comparators.rb,
lib/hecks/query_specification/common/cursor_spec.rb,
lib/hecks/query_specification/common/null_policy.rb,
lib/hecks/query_specification/common/offset_spec.rb,
lib/hecks/adapters/driven/postgres/schema_builder.rb,
lib/hecks/fuzzing/sequence_generator/step_builder.rb,
lib/hecks/query_specification/common/where_clause.rb,
lib/hecks/adapters/driven/governance_authorization.rb,
lib/hecks/bluebook/meta_validator/translation_judge.rb,
lib/hecks/query_specification/common/null_semantics.rb,
lib/hecks/runtime/command_interpreter/argument_gate.rb,
lib/hecks/fuzzing/sequence_generator/outcome_tracker.rb,
lib/hecks/query_specification/common/inspection_spec.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager.rb,
lib/hecks/query_specification/read_model/specification.rb,
lib/hecks/runtime/command_interpreter/mutation_applier.rb,
lib/hecks/bluebook/expression/resolver/block_predicates.rb,
lib/hecks/query_specification/common/authorization_spec.rb,
lib/hecks/adapters/driven/postgres_era/lineage/era_store.rb,
lib/hecks/adapters/driven/postgres_era/lineage/tail_merge.rb,
lib/hecks/adapters/driven/postgres_era/lineage/field_cache.rb,
lib/hecks/adapters/driven/postgres_era/lineage/provisioning.rb,
lib/hecks/adapters/driven/postgres_era/lineage/head_compiler.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/minter.rb,
lib/hecks/adapters/driven/postgres_era/lineage/mint_transaction.rb,
lib/hecks/adapters/driven/postgres_era/lineage/resumable_backfill.rb,
lib/hecks/adapters/driven/postgres_era/lineage/transform_installer.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/era_resolver.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/coverage_check.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/merge_coordinator.rb

Overview

HAND-WRITTEN — the block-predicate/find family of the leaf grammar (Bluebook::Expression::Resolver's own .all?/.any?/.none?/ .find suffixes), split into this sibling file to keep resolver.rb under Metrics/ModuleLength (350) : this reopens the SAME Resolver module resolver.rb defines, the long nested module A; module B; ... form (not the compact A::B form) so bare constant/method lookups here (EvaluationError, Evaluator, describe, unwrap_scalar, walk_path) resolve exactly the way they do inside resolver.rb itself — this is one module, split across two files, not two modules. See resolver.rb's own header for the grammar this belongs to; see each struct/method below for its own "why".

Defined Under Namespace

Modules: Adapters, Behaviors, Bluebook, Codemod, Construct, Doc, EmbryonautBluebook, Facade, Forms, Framework, Freezer, Fuzzing, Grammar, IR, Literal, Namespace, Naming, Ports, Projections, Projector, QueryIR, QuerySpecification, Rendering, Runtime, Translation, Vocabulary Classes: Fqn, LoadOutsideBoot, Router, StateRef

Constant Summary collapse

VERSION =

ISOLATED, ON PURPOSE — the gemspec reads this file directly rather than require_relative "lib/hecks" (the whole framework), specifically so evaluating the gemspec never triggers ANY of this gem's own dependencies (prism among them) before Bundler has even resolved what to install. A real, live chicken-and-egg bug caught deploying to a Ruby version that doesn't bundle prism for free (AWS Lambda's ruby3.2): the gemspec's own require_relative "lib/hecks" pulled in adapters/driven/prism.rb's unconditional require "prism", which failed before Bundler ever read what the gemspec itself declared as a dependency — declaring it there, or even in the consuming Gemfile, never closed the gap, because gemspec evaluation happens before anything Bundler resolves is actually loadable yet.

"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.current_registryObject (readonly)

Returns the value of attribute current_registry.



41
42
43
# File 'lib/hecks.rb', line 41

def current_registry
  @current_registry
end

Class Method Details

.adapter(name, &block) ⇒ Object



99
# File 'lib/hecks.rb', line 99

def adapter(name, &block)   = collect(:add_adapter, Bluebook::DSL::AdapterBuilder.build(name, &block))

.as_caller(role:, actor_id: nil, &block) ⇒ Object

Bind who is dispatching for the duration of the block — checked against a command's declared role, if it has one. Unbound (the default), a command's role stays exactly what it is without this: decoration.

actor_id is OPTIONAL — a caller naming only a role is checked by string equality against the command's own role, exactly as before. A caller that also names WHO it is lets the check run against a real Governance RoleAssignment instead, once the command's domain has Governance attached — see CommandRules::Authorization's own header.



91
# File 'lib/hecks.rb', line 91

def as_caller(role:, actor_id: nil, &block) = Runtime.as_caller(role: role, actor_id: actor_id, &block)

.behaviors(name) ⇒ Object

Hecks.behaviors "Name" do ... end — deliberately NOT routed through collect the way bluebook/hecksagon/world are: a behaviors suite is a test artifact a runner reads on demand, never a thing a live domain boot needs, so it has no business landing in Runtime.current_registry.



16
17
18
19
20
21
22
23
# File 'lib/hecks/behaviors.rb', line 16

def behaviors(name, &)
  path = Behaviors.loading_path or
    raise Behaviors::LoadOutsideRunner,
          "Hecks.behaviors called outside Hecks::Behaviors.run(path) — " \
          "a .behaviors file is only ever loaded by the behaviors runner"

  Behaviors.last_suite = Behaviors::BehaviorsBuilder.build(name, source_path: path, &)
end

.bluebook(name, version: nil, &block) ⇒ Object



93
94
95
# File 'lib/hecks.rb', line 93

def bluebook(name, version: nil, &block)
  collect(:add_bluebook, Bluebook::DSL::BluebookBuilder.build(name, version: version, &block))
end

.boot(path, shared: nil, install_facade: true, environment: nil) ⇒ Object

The loading words below collect into the registry the RUNTIME is holding open ; booting and that ambient state belong to the runtime layer, so this module is their facade and Hecks::Runtime is where they live. install_facade: — see Runtime::Loader.boot. Defaults on; a caller that only dispatches by FQN string can skip the global sugar.

environment: — RECOVERED, not new: this parameter (and the environments/<name>.hecksagon / .world overlay it loads — see Adapters::Folder#load_domain) existed on a prior commit of this repo (933d1dd), was vendored out to a real consumer (lifeadelics/domain), and was then lost from this repo's own history (no branch here reaches that commit). Ported forward from the consumer's vendor snapshot — the only surviving copy — and generalized: the original only loaded a .hecksagon overlay; this also loads a same-named .world overlay, both merged into the base rather than replacing it (Registry#add_hecksagon / #add_world). hecks never reads ENV itself — a caller resolves its own env var name and passes the resulting string straight through, e.g. Hecks.boot(path, environment: ENV.fetch("MYAPP_ENV", "development")).



64
65
66
# File 'lib/hecks.rb', line 64

def boot(path, shared: nil, install_facade: true, environment: nil)
  Runtime.boot(path, shared: shared, install_facade: install_facade, environment: environment)
end

.boot_files(paths, shared: nil, install_facade: true, environment: nil) ⇒ Object

paths — an explicit list of files to boot (a .bluebook, its .hecksagon, optionally a .world), loaded in place from wherever they actually live — see Runtime::Loader.boot_files's own header for why this exists beside boot rather than as a special case of it.



72
73
74
# File 'lib/hecks.rb', line 72

def boot_files(paths, shared: nil, install_facade: true, environment: nil)
  Runtime.boot_files(paths, shared: shared, install_facade: install_facade, environment: environment)
end

.data_translation(name, from:, to:, &block) ⇒ Object



102
103
104
# File 'lib/hecks.rb', line 102

def data_translation(name, from:, to:, &block)
  collect(:add_translation, Bluebook::DSL::TranslationBuilder.build(name, from: from, to: to, &block))
end

.hecksagon(name, &block) ⇒ Object



97
# File 'lib/hecks.rb', line 97

def hecksagon(name, &block) = collect(:add_hecksagon, Bluebook::DSL::HecksagonBuilder.build(name, &block))

.port(name, &block) ⇒ Object



98
# File 'lib/hecks.rb', line 98

def port(name, &block) = collect(:add_port, Bluebook::DSL::PortBuilder.build(name, &block))

.with_registry(registry, &block) ⇒ Object



76
# File 'lib/hecks.rb', line 76

def with_registry(registry, &block) = Runtime.with_registry(registry, &block)

.world(name, &block) ⇒ Object



100
# File 'lib/hecks.rb', line 100

def world(name, &block)     = collect(:add_world, Bluebook::DSL::WorldBuilder.build(name, &block))