hecks 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hecks/adapters/driven/claude_code.rb +7 -7
- data/lib/hecks/adapters/driven/d1.rb +187 -23
- data/lib/hecks/adapters/driven/folder.rb +10 -10
- data/lib/hecks/adapters/driven/google_authentication.rb +8 -8
- data/lib/hecks/adapters/driven/governance_authorization.rb +31 -13
- data/lib/hecks/adapters/driven/heki/journal.rb +60 -2
- data/lib/hecks/adapters/driven/heki/saga_store.rb +5 -5
- data/lib/hecks/adapters/driven/heki.rb +13 -7
- data/lib/hecks/adapters/driven/identity_registry.rb +2 -2
- data/lib/hecks/adapters/driven/in_memory_ordering.rb +3 -3
- data/lib/hecks/adapters/driven/lambda/client.rb +34 -9
- data/lib/hecks/adapters/driven/lambda.rb +39 -33
- data/lib/hecks/adapters/driven/local_storage.rb +17 -10
- data/lib/hecks/adapters/driven/memory.rb +205 -9
- data/lib/hecks/adapters/driven/mock_stripe_adapter.rb +1 -1
- data/lib/hecks/adapters/driven/postgres/codec.rb +27 -11
- data/lib/hecks/adapters/driven/postgres/outbox.rb +40 -2
- data/lib/hecks/adapters/driven/postgres/reconnect.rb +23 -7
- data/lib/hecks/adapters/driven/postgres/schema_builder.rb +14 -14
- data/lib/hecks/adapters/driven/postgres.rb +175 -28
- data/lib/hecks/adapters/driven/postgres_era.adapter +5 -0
- data/lib/hecks/adapters/driven/prism.rb +4 -4
- data/lib/hecks/adapters/driven/sql_query_builder.rb +34 -22
- data/lib/hecks/adapters/driven/sqlite/codec.rb +38 -10
- data/lib/hecks/adapters/driven/sqlite/projection.rb +60 -32
- data/lib/hecks/adapters/driven/sqlite/schema_builder.rb +12 -12
- data/lib/hecks/adapters/driven/sqlite.rb +181 -21
- data/lib/hecks/adapters/driven.rb +4 -4
- data/lib/hecks/adapters/driving/github_webhook.rb +145 -0
- data/lib/hecks/behaviors/dsl.rb +2 -2
- data/lib/hecks/behaviors/expectations.rb +51 -23
- data/lib/hecks/behaviors/ir.rb +1 -1
- data/lib/hecks/behaviors/rspec.rb +1 -1
- data/lib/hecks/behaviors/runner.rb +2 -2
- data/lib/hecks/behaviors.rb +1 -1
- data/lib/hecks/bluebook/aggregate.rb +13 -13
- data/lib/hecks/bluebook/assembly/aggregate_assembly.rb +10 -10
- data/lib/hecks/bluebook/assembly/build.rb +1 -1
- data/lib/hecks/bluebook/assembly/contract.rb +39 -16
- data/lib/hecks/bluebook/assembly/contracts.rb +40 -38
- data/lib/hecks/bluebook/assembly/marks.rb +18 -18
- data/lib/hecks/bluebook/assembly/specializer.rb +19 -21
- data/lib/hecks/bluebook/assembly.rb +9 -9
- data/lib/hecks/bluebook/attribute.rb +9 -9
- data/lib/hecks/bluebook/behaviour/aggregate.rb +11 -11
- data/lib/hecks/bluebook/behaviour/attribute.rb +5 -5
- data/lib/hecks/bluebook/behaviour/chapter.rb +23 -5
- data/lib/hecks/bluebook/behaviour/command.rb +23 -23
- data/lib/hecks/bluebook/behaviour/domain_port.rb +27 -3
- data/lib/hecks/bluebook/behaviour/entity.rb +8 -8
- data/lib/hecks/bluebook/behaviour/hexagon.rb +4 -4
- data/lib/hecks/bluebook/behaviour/lifecycle.rb +5 -5
- data/lib/hecks/bluebook/behaviour/policy.rb +12 -12
- data/lib/hecks/bluebook/behaviour/process_manager.rb +7 -7
- data/lib/hecks/bluebook/behaviour/query.rb +1 -1
- data/lib/hecks/bluebook/behaviour/read_model.rb +8 -8
- data/lib/hecks/bluebook/behaviour/traits.rb +12 -12
- data/lib/hecks/bluebook/behaviour/value_object.rb +6 -6
- data/lib/hecks/bluebook/capabilities.rb +27 -0
- data/lib/hecks/bluebook/chapter.rb +28 -9
- data/lib/hecks/bluebook/command.rb +12 -12
- data/lib/hecks/bluebook/domain_port.rb +9 -9
- data/lib/hecks/bluebook/dsl/adapter_builder.rb +24 -0
- data/lib/hecks/bluebook/dsl/aggregate_builder/sealing.rb +49 -49
- data/lib/hecks/bluebook/dsl/aggregate_builder.rb +96 -96
- data/lib/hecks/bluebook/dsl/attribute_collector.rb +41 -41
- data/lib/hecks/bluebook/dsl/binding_proxy.rb +22 -2
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation.rb +111 -74
- data/lib/hecks/bluebook/dsl/bluebook_builder.rb +48 -30
- data/lib/hecks/bluebook/dsl/bootstrap_table.rb +116 -0
- data/lib/hecks/bluebook/dsl/command_builder.rb +103 -103
- data/lib/hecks/bluebook/dsl/const_shim.rb +46 -15
- data/lib/hecks/bluebook/dsl/domain_port_builder.rb +90 -25
- data/lib/hecks/bluebook/dsl/entity_builder.rb +56 -56
- data/lib/hecks/bluebook/dsl/generic_dispatch.rb +148 -132
- data/lib/hecks/bluebook/dsl/hecksagon_builder.rb +89 -30
- data/lib/hecks/bluebook/dsl/identity_declaration.rb +17 -17
- data/lib/hecks/bluebook/dsl/lifecycle_builder.rb +27 -4
- data/lib/hecks/bluebook/dsl/policy_builder.rb +30 -21
- data/lib/hecks/bluebook/dsl/port_builder.rb +38 -7
- data/lib/hecks/bluebook/dsl/port_operation_builder.rb +56 -22
- data/lib/hecks/bluebook/dsl/process_manager_builder.rb +35 -35
- data/lib/hecks/bluebook/dsl/query_builder.rb +5 -5
- data/lib/hecks/bluebook/dsl/read_model_builder.rb +34 -34
- data/lib/hecks/bluebook/dsl/rule_reference.rb +41 -39
- data/lib/hecks/bluebook/dsl/translation_builder.rb +9 -9
- data/lib/hecks/bluebook/dsl/value_object_builder.rb +16 -16
- data/lib/hecks/bluebook/dsl/word_gate.rb +59 -53
- data/lib/hecks/bluebook/dsl/world_builder.rb +51 -8
- data/lib/hecks/bluebook/entity.rb +11 -11
- data/lib/hecks/bluebook/expression/ast_json.rb +20 -20
- data/lib/hecks/bluebook/expression/ast_reader.rb +3 -3
- data/lib/hecks/bluebook/expression/canonical_form.rb +9 -9
- data/lib/hecks/bluebook/expression/evaluator.rb +18 -18
- data/lib/hecks/bluebook/expression/resolver/block_predicates.rb +18 -18
- data/lib/hecks/bluebook/expression/resolver.rb +60 -62
- data/lib/hecks/bluebook/hexagon.rb +1 -1
- data/lib/hecks/bluebook/lifecycle.rb +1 -1
- data/lib/hecks/bluebook/meta_validator/adapter_judge.rb +1 -1
- data/lib/hecks/bluebook/meta_validator/judge.rb +122 -86
- data/lib/hecks/bluebook/meta_validator/plan.rb +39 -39
- data/lib/hecks/bluebook/meta_validator/port_judge.rb +2 -2
- data/lib/hecks/bluebook/meta_validator/readings.rb +43 -43
- data/lib/hecks/bluebook/meta_validator/reconstruction.rb +44 -37
- data/lib/hecks/bluebook/meta_validator/shapes.rb +25 -21
- data/lib/hecks/bluebook/meta_validator/syntax_boot.rb +145 -31
- data/lib/hecks/bluebook/meta_validator/translation_judge.rb +6 -6
- data/lib/hecks/bluebook/meta_validator/world_judge.rb +5 -5
- data/lib/hecks/bluebook/meta_validator.rb +70 -70
- data/lib/hecks/bluebook/model_check.rb +301 -84
- data/lib/hecks/bluebook/pattern_subset.rb +9 -9
- data/lib/hecks/bluebook/policy.rb +15 -13
- data/lib/hecks/bluebook/process_manager.rb +14 -14
- data/lib/hecks/bluebook/project_register.rb +6 -6
- data/lib/hecks/bluebook/query.rb +4 -4
- data/lib/hecks/bluebook/read_model.rb +14 -14
- data/lib/hecks/bluebook/reference.rb +8 -8
- data/lib/hecks/bluebook/smoke_test.rb +19 -19
- data/lib/hecks/bluebook/synthesizer.rb +12 -12
- data/lib/hecks/bluebook/translation.rb +4 -4
- data/lib/hecks/bluebook/value_object.rb +6 -6
- data/lib/hecks/bluebook.rb +2 -2
- data/lib/hecks/codemod/legacy_dispatch_args.rb +299 -0
- data/lib/hecks/codemod/legacy_dispatch_recorder.rb +186 -0
- data/lib/hecks/codemod.rb +36 -35
- data/lib/hecks/construct.rb +6 -6
- data/lib/hecks/corpus.rb +317 -0
- data/lib/hecks/deprecation.rb +95 -0
- data/lib/hecks/doc/reference.rb +19 -19
- data/lib/hecks/embryonaut_bluebook.rb +11 -11
- data/lib/hecks/facade/cli_door.rb +69 -10
- data/lib/hecks/facade/cli_runner.rb +105 -24
- data/lib/hecks/facade/command_request.rb +23 -0
- data/lib/hecks/facade/handle.rb +79 -32
- data/lib/hecks/facade/json_door.rb +106 -25
- data/lib/hecks/facade/surface/aggregate_door.rb +42 -27
- data/lib/hecks/facade/surface/chapter.rb +26 -17
- data/lib/hecks/facade/surface.rb +16 -3
- data/lib/hecks/facade.rb +15 -4
- data/lib/hecks/forms/app.rb +46 -30
- data/lib/hecks/forms/command_form_renderer.rb +70 -9
- data/lib/hecks/forms/field_renderer.rb +142 -6
- data/lib/hecks/forms/field_shape.rb +183 -20
- data/lib/hecks/forms/html.rb +51 -7
- data/lib/hecks/forms/index_renderer.rb +14 -2
- data/lib/hecks/forms/params.rb +120 -23
- data/lib/hecks/forms/port_argument.rb +2 -2
- data/lib/hecks/forms/query_form_renderer.rb +2 -2
- data/lib/hecks/forms/record_renderer.rb +2 -2
- data/lib/hecks/forms/record_table.rb +1 -1
- data/lib/hecks/forms/value_object_shape.rb +3 -3
- data/lib/hecks/forms.rb +24 -4
- data/lib/hecks/fqn.rb +1 -1
- data/lib/hecks/framework/bluebook/governance.bluebook +9 -0
- data/lib/hecks/framework.rb +48 -17
- data/lib/hecks/freezer.rb +11 -11
- data/lib/hecks/fuzzing/bounded_exhaustive_expressions.rb +90 -90
- data/lib/hecks/fuzzing/combination_miner.rb +119 -0
- data/lib/hecks/fuzzing/concurrent_dispatch.rb +361 -0
- data/lib/hecks/fuzzing/coverage_campaign.rb +118 -0
- data/lib/hecks/fuzzing/differential.rb +158 -0
- data/lib/hecks/fuzzing/domain_generator.rb +694 -0
- data/lib/hecks/fuzzing/era_boundary.rb +124 -0
- data/lib/hecks/fuzzing/form_census.rb +199 -0
- data/lib/hecks/fuzzing/generated_domain_check.rb +95 -0
- data/lib/hecks/fuzzing/invalid_value_generator.rb +6 -6
- data/lib/hecks/fuzzing/isolated_boot.rb +226 -38
- data/lib/hecks/fuzzing/nondeterministic.rb +67 -0
- data/lib/hecks/fuzzing/persistence_parity.rb +161 -0
- data/lib/hecks/fuzzing/properties/corrections.rb +100 -0
- data/lib/hecks/fuzzing/properties/dispatch_and_mutations.rb +321 -41
- data/lib/hecks/fuzzing/properties/guards.rb +129 -26
- data/lib/hecks/fuzzing/properties/invariants_and_aggregation.rb +32 -32
- data/lib/hecks/fuzzing/properties/lifecycle_and_replay.rb +31 -11
- data/lib/hecks/fuzzing/properties/outbox.rb +142 -0
- data/lib/hecks/fuzzing/properties/querying.rb +17 -17
- data/lib/hecks/fuzzing/properties.rb +84 -39
- data/lib/hecks/fuzzing/qa_settings.rb +152 -0
- data/lib/hecks/fuzzing/replay.rb +224 -114
- data/lib/hecks/fuzzing/rotation_priority.rb +94 -0
- data/lib/hecks/fuzzing/rust_gap_manifest.rb +113 -0
- data/lib/hecks/fuzzing/self_consistency.rb +676 -0
- data/lib/hecks/fuzzing/sequence_generator/adversary.rb +526 -0
- data/lib/hecks/fuzzing/sequence_generator/catalog.rb +101 -30
- data/lib/hecks/fuzzing/sequence_generator/outcome_tracker.rb +55 -8
- data/lib/hecks/fuzzing/sequence_generator/picker.rb +31 -11
- data/lib/hecks/fuzzing/sequence_generator/step_builder.rb +123 -32
- data/lib/hecks/fuzzing/sequence_generator.rb +152 -31
- data/lib/hecks/fuzzing/shrinker.rb +197 -0
- data/lib/hecks/fuzzing/structural_skips.rb +39 -0
- data/lib/hecks/fuzzing/sweep_depth.rb +53 -0
- data/lib/hecks/fuzzing/target_capabilities.rb +180 -0
- data/lib/hecks/fuzzing/value_generator.rb +66 -14
- data/lib/hecks/fuzzing.rb +11 -0
- data/lib/hecks/grammar/evolve.rb +10 -10
- data/lib/hecks/grammar.rb +7 -7
- data/lib/hecks/ir.rb +13 -13
- data/lib/hecks/language/bluebook/bluebook.bluebook +41 -0
- data/lib/hecks/language/bluebook/policy.bluebook +11 -1
- data/lib/hecks/language/bluebook/vocabulary.bluebook +365 -15
- data/lib/hecks/language/oidc.json +5 -0
- data/lib/hecks/literal.rb +9 -9
- data/lib/hecks/naming.rb +89 -21
- data/lib/hecks/ports/access_control.rb +58 -2
- data/lib/hecks/ports/agent/answers.rb +83 -6
- data/lib/hecks/ports/agent.rb +119 -35
- data/lib/hecks/ports/authentication.rb +44 -4
- data/lib/hecks/ports/authorization.rb +53 -11
- data/lib/hecks/ports/clock.rb +42 -23
- data/lib/hecks/ports/extraction.rb +16 -0
- data/lib/hecks/ports/identity_assignment.rb +24 -2
- data/lib/hecks/ports/identity_generation.rb +17 -3
- data/lib/hecks/ports/identity_resolution.rb +18 -1
- data/lib/hecks/ports/loading.rb +4 -0
- data/lib/hecks/ports/persistence/append_only.rb +172 -8
- data/lib/hecks/ports/persistence/binding_policy.rb +34 -0
- data/lib/hecks/ports/persistence/codec_boundary.rb +178 -0
- data/lib/hecks/ports/persistence/execution.rb +4 -0
- data/lib/hecks/ports/persistence/null_saga_store.rb +12 -1
- data/lib/hecks/ports/persistence/plugin.rb +42 -4
- data/lib/hecks/ports/persistence/plugins/era/era_check.rb +218 -25
- data/lib/hecks/ports/persistence/plugins/era/era_guard/shape_diff.rb +77 -9
- data/lib/hecks/ports/persistence/plugins/era/era_guard.rb +81 -24
- data/lib/hecks/ports/persistence/plugins/era/era_tamper.rb +29 -18
- data/lib/hecks/ports/persistence/plugins/era/lineage.rb +144 -60
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/era_store.rb +103 -8
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/field_cache.rb +98 -23
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/head_compiler.rb +282 -109
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/mint_transaction.rb +63 -25
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/provisioning.rb +160 -58
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/resumable_backfill.rb +51 -28
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/tail_merge.rb +28 -5
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/transform_installer.rb +25 -12
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage.rb +129 -34
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/coverage_check.rb +51 -6
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/era_resolver.rb +44 -6
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/merge_coordinator.rb +16 -0
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/minter.rb +57 -4
- data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager.rb +25 -2
- data/lib/hecks/ports/persistence/plugins/era/postgres_era.rb +338 -83
- data/lib/hecks/ports/persistence/plugins/era/storage_shape.rb +68 -10
- data/lib/hecks/ports/persistence/plugins/era/translation/audit/approval_digest.rb +9 -3
- data/lib/hecks/ports/persistence/plugins/era/translation/audit/layer_one.rb +9 -2
- data/lib/hecks/ports/persistence/plugins/era/translation/audit/layer_two.rb +42 -8
- data/lib/hecks/ports/persistence/plugins/era/translation/audit/unfed_report.rb +16 -1
- data/lib/hecks/ports/persistence/plugins/era/translation/audit.rb +36 -5
- data/lib/hecks/ports/persistence/plugins/era/translation/reattest.rb +23 -3
- data/lib/hecks/ports/persistence/plugins/era/translation/rule_compiler.rb +18 -19
- data/lib/hecks/ports/persistence/plugins/era/translation/scaffold/differ.rb +5 -5
- data/lib/hecks/ports/persistence/plugins/era/translation/scaffold/writer.rb +1 -1
- data/lib/hecks/ports/persistence/plugins/era/translation/scaffold.rb +2 -2
- data/lib/hecks/ports/persistence/plugins/era.rb +12 -2
- data/lib/hecks/ports/persistence/remote_runtime.rb +9 -2
- data/lib/hecks/ports/persistence/repository_factory.rb +29 -6
- data/lib/hecks/ports/persistence/state_codec.rb +319 -0
- data/lib/hecks/ports/persistence.rb +36 -1
- data/lib/hecks/ports/projection.rb +61 -7
- data/lib/hecks/ports/query/in_memory.rb +3 -3
- data/lib/hecks/ports/query/ordering.rb +6 -6
- data/lib/hecks/ports/query.rb +35 -0
- data/lib/hecks/projections/bootstrap_table.rb +112 -0
- data/lib/hecks/projections/diagrams.rb +75 -75
- data/lib/hecks/projections/glossary/html.rb +250 -0
- data/lib/hecks/projections/glossary/markdown.rb +105 -0
- data/lib/hecks/projections/glossary/mermaid.rb +110 -0
- data/lib/hecks/projections/glossary/page.css +271 -0
- data/lib/hecks/projections/glossary/page.js +72 -0
- data/lib/hecks/projections/glossary/sections.rb +17 -0
- data/lib/hecks/projections/glossary/sentences.rb +205 -0
- data/lib/hecks/projections/glossary.rb +214 -286
- data/lib/hecks/projections/ir.rb +1 -1
- data/lib/hecks/projections/model/deviations.rb +18 -17
- data/lib/hecks/projections/model.rb +25 -21
- data/lib/hecks/projections/oidc.rb +7 -7
- data/lib/hecks/projections/parser_table.rb +5 -5
- data/lib/hecks/projections/reference.rb +3 -3
- data/lib/hecks/projections/rust_vocabulary.rb +443 -0
- data/lib/hecks/projections/shape.rb +2 -2
- data/lib/hecks/projections/statements.rb +11 -11
- data/lib/hecks/projections/vocabulary.rb +9 -9
- data/lib/hecks/projections.rb +5 -3
- data/lib/hecks/projector/cli_projector.rb +29 -29
- data/lib/hecks/projector/docs_projector.rb +13 -13
- data/lib/hecks/projector/exporter.rb +42 -21
- data/lib/hecks/projector/ir_projector.rb +1 -1
- data/lib/hecks/projector/narrate_projector.rb +15 -22
- data/lib/hecks/projector/target.rb +13 -13
- data/lib/hecks/projector.rb +15 -15
- data/lib/hecks/query_ir.rb +47 -47
- data/lib/hecks/query_specification/common/comparators.rb +19 -3
- data/lib/hecks/query_specification/common/comparison.rb +132 -24
- data/lib/hecks/query_specification/common/dsl.rb +65 -9
- data/lib/hecks/query_specification/common/null_policy.rb +57 -13
- data/lib/hecks/query_specification/common/null_semantics.rb +4 -0
- data/lib/hecks/query_specification/common/options.rb +25 -0
- data/lib/hecks/query_specification/field_path.rb +69 -15
- data/lib/hecks/query_specification/hop_path.rb +57 -20
- data/lib/hecks/query_specification/read_model/specification.rb +4 -0
- data/lib/hecks/rendering.rb +3 -3
- data/lib/hecks/router/namespace_installer.rb +3 -3
- data/lib/hecks/router.rb +1 -1
- data/lib/hecks/runtime/aggregate_lock.rb +11 -11
- data/lib/hecks/runtime/boot_gates.rb +3 -3
- data/lib/hecks/runtime/caller.rb +8 -8
- data/lib/hecks/runtime/capability_graph.rb +2 -2
- data/lib/hecks/runtime/command_interpreter/argument_gate.rb +22 -25
- data/lib/hecks/runtime/command_interpreter/mutation_applier.rb +64 -67
- data/lib/hecks/runtime/command_interpreter.rb +159 -102
- data/lib/hecks/runtime/command_rules/admissibility.rb +69 -69
- data/lib/hecks/runtime/command_rules/arithmetic.rb +137 -91
- data/lib/hecks/runtime/command_rules/authorization.rb +38 -17
- data/lib/hecks/runtime/command_rules/emission.rb +18 -1
- data/lib/hecks/runtime/command_rules/references.rb +94 -19
- data/lib/hecks/runtime/command_rules.rb +3 -0
- data/lib/hecks/runtime/dependency_planning.rb +11 -11
- data/lib/hecks/runtime/dispatcher.rb +283 -90
- data/lib/hecks/runtime/entity_element.rb +282 -46
- data/lib/hecks/runtime/entity_interpreter.rb +160 -69
- data/lib/hecks/runtime/errors.rb +19 -19
- data/lib/hecks/runtime/event.rb +6 -6
- data/lib/hecks/runtime/identity.rb +22 -22
- data/lib/hecks/runtime/instance.rb +39 -14
- data/lib/hecks/runtime/interpreting.rb +12 -12
- data/lib/hecks/runtime/invocation.rb +276 -0
- data/lib/hecks/runtime/loader.rb +14 -14
- data/lib/hecks/runtime/outbox.rb +23 -23
- data/lib/hecks/runtime/policy_interpreter.rb +54 -54
- data/lib/hecks/runtime/port_operation_interpreter.rb +22 -19
- data/lib/hecks/runtime/query_interpreter.rb +111 -56
- data/lib/hecks/runtime/reaction_invocation.rb +76 -9
- data/lib/hecks/runtime/read_model_interpreter.rb +40 -40
- data/lib/hecks/runtime/rebuild_sweep.rb +4 -4
- data/lib/hecks/runtime/reference_hop.rb +6 -6
- data/lib/hecks/runtime/refusal_wording.rb +92 -112
- data/lib/hecks/runtime/registry/saga_persistence.rb +21 -21
- data/lib/hecks/runtime/registry/verification.rb +36 -26
- data/lib/hecks/runtime/registry.rb +56 -27
- data/lib/hecks/runtime/remote_dispatcher.rb +38 -23
- data/lib/hecks/runtime/routing.rb +10 -88
- data/lib/hecks/runtime/saga_interpreter/correlation.rb +17 -17
- data/lib/hecks/runtime/saga_interpreter.rb +93 -56
- data/lib/hecks/runtime/saga_pending_dispatch.rb +12 -12
- data/lib/hecks/runtime/tenant_check.rb +9 -9
- data/lib/hecks/runtime/tenant_scope.rb +5 -5
- data/lib/hecks/runtime/value/admission.rb +75 -30
- data/lib/hecks/runtime/value/coercion.rb +379 -226
- data/lib/hecks/runtime/value/entity_list_coercion.rb +248 -0
- data/lib/hecks/runtime/value.rb +28 -23
- data/lib/hecks/runtime.rb +7 -7
- data/lib/hecks/storehouse.rb +64 -64
- data/lib/hecks/version.rb +3 -3
- data/lib/hecks/vocabulary.rb +207 -5
- data/lib/hecks.rb +13 -11
- data/lib/rubocop/cop/hecks/fallback_hash_lookup.rb +11 -11
- data/lib/rubocop/cop/hecks/sequential_hash_rename_in_loop.rb +14 -12
- data/lib/rubocop/cop/hecks/thread_shared_ivar_mutation.rb +11 -11
- metadata +43 -2
|
@@ -7,7 +7,7 @@ module Hecks
|
|
|
7
7
|
# builder collecting every `aggregate`/`read_model`/`policy`/
|
|
8
8
|
# `process_manager` a chapter declares, plus the chapter-wide named-
|
|
9
9
|
# given pools those thread down into (see `#aggregate_impl`'s own
|
|
10
|
-
# comment). `.build` reuses the
|
|
10
|
+
# comment). `.build` reuses the same open builder instance across
|
|
11
11
|
# several files sharing one chapter name (`self.build`'s own comment),
|
|
12
12
|
# so a chapter split across files accumulates rather than each file
|
|
13
13
|
# silently replacing the last.
|
|
@@ -26,19 +26,19 @@ module Hecks
|
|
|
26
26
|
@read_models = []
|
|
27
27
|
@policies = []
|
|
28
28
|
@process_managers = []
|
|
29
|
-
#
|
|
29
|
+
# The root of the chapter-wide given pool — one level wider
|
|
30
30
|
# than `AggregateBuilder`'s own `@entity_named_givens` (S10
|
|
31
31
|
# extended across an aggregate's whole entity tree, earlier
|
|
32
32
|
# this arc). See `#given`'s own comment for what this closes.
|
|
33
33
|
@chapter_named_givens = {}
|
|
34
|
-
#
|
|
35
|
-
#
|
|
34
|
+
# Every bare chapter-given reference this chapter's own files
|
|
35
|
+
# left unresolved so far — threaded into every aggregate the
|
|
36
36
|
# same way `@chapter_named_givens` is. See
|
|
37
37
|
# `AggregateBuilder#pending_chapter_given`'s own comment for
|
|
38
38
|
# what queues here and `#resolve_pending_chapter_givens!`,
|
|
39
39
|
# below, for where it drains.
|
|
40
40
|
@chapter_pending_givens = []
|
|
41
|
-
#
|
|
41
|
+
# **One level wider still** — the chapter-wide, entity-scoped pool
|
|
42
42
|
# (the piece analogue of `@chapter_named_givens`, above). See
|
|
43
43
|
# `EntityBuilder#given_impl`'s own comment for what this
|
|
44
44
|
# closes; `docs/implemented/resolution-rules/
|
|
@@ -73,32 +73,49 @@ module Hecks
|
|
|
73
73
|
# old name instead of minting a brand-new lineage from nothing.
|
|
74
74
|
def formerly_known_as(value) = @formerly_known_as = value.to_s
|
|
75
75
|
|
|
76
|
-
# A
|
|
76
|
+
# **A sub-language names where it lands**. ADR 0026's own seam: the core
|
|
77
77
|
# grammar does not name its extension points, so this chapter names
|
|
78
|
-
#
|
|
78
|
+
# itself onto them instead — the core contexts (e.g. "Query",
|
|
79
79
|
# "ReadModel") whose own admitted words this chapter's `Syntax`
|
|
80
80
|
# aggregate contributes rows for. Variadic, and accumulating across
|
|
81
81
|
# calls the same reason `identified_by`/`group_by` are: nothing here
|
|
82
82
|
# requires one call to name every context at once.
|
|
83
|
-
#
|
|
83
|
+
# Renamed from `attaches_to` — item #13's full metaprogrammed
|
|
84
84
|
# dispatch (slice 4c). Not bootstrap-reachable (only sub-language
|
|
85
|
-
# chapters like Paging use it; the
|
|
85
|
+
# chapters like Paging use it; the core chapters never describe
|
|
86
86
|
# themselves with it).
|
|
87
87
|
def attaches_to_impl(*contexts) = (@attaches_to ||= []).concat(contexts.map(&:to_s))
|
|
88
88
|
|
|
89
|
+
# A capability this chapter answers for other domains, declared so
|
|
90
|
+
# nothing has to recognise the chapter by name — Governance's
|
|
91
|
+
# `provides "authorization", assignments: ..., grant: ...,
|
|
92
|
+
# transitions: ...`. One row per key, in the order written; what
|
|
93
|
+
# each capability requires is checked once the chapter is whole
|
|
94
|
+
# (`Validation#validate_provisions!`), since the verbs it names may
|
|
95
|
+
# be declared further down the file.
|
|
96
|
+
def provides_impl(capability, **verbs)
|
|
97
|
+
if verbs.empty?
|
|
98
|
+
raise Malformed, "#{@name}'s provides #{capability.inspect} names no verb — say which of this " \
|
|
99
|
+
"chapter's commands and queries answer it"
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
rows = verbs.map { |key, verb| Chapter::Provision.new(capability: capability.to_s, key: key.to_s, verb: verb.to_s) }
|
|
103
|
+
(@provides ||= []).concat(rows)
|
|
104
|
+
end
|
|
105
|
+
|
|
89
106
|
def core = @classification = :core
|
|
90
107
|
def supporting = @classification = :supporting
|
|
91
108
|
def generic = @classification = :generic
|
|
92
109
|
|
|
93
110
|
# `@chapter_named_givens` is threaded into every aggregate this
|
|
94
111
|
# chapter builds — see `AggregateBuilder#given`'s own comment
|
|
95
|
-
# for the sharing this enables;
|
|
96
|
-
# itself (an aggregate's own
|
|
112
|
+
# for the sharing this enables; not a new top-level DSL word
|
|
113
|
+
# itself (an aggregate's own existing `given` already both
|
|
97
114
|
# declares locally and write-throughs here as a side effect,
|
|
98
115
|
# the identical shape `EntityBuilder#given`'s own write-through
|
|
99
116
|
# to its owner aggregate's pool already takes — no new spelling
|
|
100
117
|
# for "declare a precondition," one level wider, same word).
|
|
101
|
-
#
|
|
118
|
+
# Renamed from `aggregate` — item #13's full metaprogrammed
|
|
102
119
|
# dispatch (slice 4c). Bootstrap-reachable (every core/attached
|
|
103
120
|
# chapter's own top-level shape is written with it), so also
|
|
104
121
|
# named in GenericDispatch::BOOTSTRAP_CALLS_FALLBACK.
|
|
@@ -118,7 +135,7 @@ module Hecks
|
|
|
118
135
|
# that used it must keep booting; live source refuses it, naming
|
|
119
136
|
# the replacement.
|
|
120
137
|
def read_model(name, &)
|
|
121
|
-
# A read model gathers heads from
|
|
138
|
+
# A read model gathers heads from several aggregates, so no single head
|
|
122
139
|
# declares it — the chapter does. Its owner is stamped in `build`, where
|
|
123
140
|
# the chapter namespace exists.
|
|
124
141
|
@read_models << ReadModelBuilder.build(name, &)
|
|
@@ -140,7 +157,7 @@ module Hecks
|
|
|
140
157
|
|
|
141
158
|
def build
|
|
142
159
|
# The chapter is the top of the construct chain — `Bluebook` is a
|
|
143
|
-
#
|
|
160
|
+
# root, and its constructor stamps every aggregate and read model with
|
|
144
161
|
# itself as owner, so every `hecks_fqn` below resolves by walking up
|
|
145
162
|
# to it. No constants are installed at load time : the public door is
|
|
146
163
|
# a per-boot projection, installed by `Loader.bind_runtime` once a
|
|
@@ -152,25 +169,26 @@ module Hecks
|
|
|
152
169
|
process_managers: @process_managers,
|
|
153
170
|
classification: @classification,
|
|
154
171
|
formerly_known_as: @formerly_known_as,
|
|
155
|
-
attaches_to: @attaches_to || []
|
|
172
|
+
attaches_to: @attaches_to || [],
|
|
173
|
+
provides: @provides || [])
|
|
156
174
|
|
|
157
|
-
#
|
|
175
|
+
# **Same reason, same gate** — a bare chapter-given may still be
|
|
158
176
|
# pending (see `AggregateBuilder#pending_chapter_given`) if a
|
|
159
177
|
# file that would resolve it hasn't loaded yet; resolving now
|
|
160
178
|
# would see the same incomplete `@chapter_named_givens`
|
|
161
179
|
# `validate_assembled!` below would. Deferred to
|
|
162
|
-
# `MetaValidator.judge_deferred!` the same way, and
|
|
180
|
+
# `MetaValidator.judge_deferred!` the same way, and before
|
|
163
181
|
# `validate_assembled!` there — nothing downstream should ever
|
|
164
182
|
# read an unresolved placeholder's fields.
|
|
165
183
|
resolve_pending_chapter_givens! unless MetaValidator.deferring?
|
|
166
184
|
resolve_pending_chapter_entity_givens! unless MetaValidator.deferring?
|
|
167
185
|
|
|
168
|
-
# A
|
|
169
|
-
# comment). Every check below needs the
|
|
186
|
+
# A chapter may be split across files (see `self.build`'s own
|
|
187
|
+
# comment). Every check below needs the whole chapter present —
|
|
170
188
|
# a hop, a projection, a correlation key or an event shape can
|
|
171
189
|
# equally name a construct declared in a file that has not
|
|
172
190
|
# loaded yet, and `@aggregates`/`@process_managers` here are
|
|
173
|
-
# only ever as complete as whatever has loaded
|
|
191
|
+
# only ever as complete as whatever has loaded so far. So,
|
|
174
192
|
# exactly like `MetaValidator.call` below, this is skipped
|
|
175
193
|
# while `MetaValidator.defer` is loading the chapter's files
|
|
176
194
|
# and run once instead — by `MetaValidator.judge_deferred!`,
|
|
@@ -187,17 +205,17 @@ module Hecks
|
|
|
187
205
|
MetaValidator.call(bluebook)
|
|
188
206
|
end
|
|
189
207
|
|
|
190
|
-
#
|
|
208
|
+
# The other half of a chapter-wide `given` reference —
|
|
191
209
|
# `AggregateBuilder#pending_chapter_given` recognised an
|
|
192
210
|
# unresolved bare reference and deferred it here, unable to
|
|
193
|
-
# check further: a later file in this
|
|
211
|
+
# check further: a later file in this same chapter might still
|
|
194
212
|
# declare the real thing. Runs once every file has loaded,
|
|
195
213
|
# against the now-complete `@chapter_named_givens` pool — the
|
|
196
|
-
#
|
|
214
|
+
# identical lookup `reference_named_chapter_given` already does,
|
|
197
215
|
# just late enough to see every aggregate's own declarations,
|
|
198
216
|
# not only the ones loaded before the referencing one.
|
|
199
217
|
#
|
|
200
|
-
#
|
|
218
|
+
# Mutates each placeholder `Given` in place rather than
|
|
201
219
|
# replacing it — it is already embedded, by Ruby object
|
|
202
220
|
# reference, in the referencing aggregate's own `preconditions`
|
|
203
221
|
# and in any command (same aggregate) that separately
|
|
@@ -247,7 +265,7 @@ module Hecks
|
|
|
247
265
|
end
|
|
248
266
|
private :resolve_pending_chapter_given
|
|
249
267
|
|
|
250
|
-
#
|
|
268
|
+
# The entity-scoped analogue, one level down — see
|
|
251
269
|
# `#resolve_pending_chapter_givens!`'s own comment; identical
|
|
252
270
|
# shape, resolved against `@chapter_entity_named_givens` instead.
|
|
253
271
|
def resolve_pending_chapter_entity_givens!
|
|
@@ -289,18 +307,18 @@ module Hecks
|
|
|
289
307
|
end
|
|
290
308
|
private :resolve_pending_chapter_entity_given
|
|
291
309
|
|
|
292
|
-
# A
|
|
310
|
+
# A chapter may be declared in several files, meant to merge into one
|
|
293
311
|
# domain — `lib/hecks/language/bluebook/*.bluebook` all open
|
|
294
312
|
# `Hecks.bluebook "Bluebook" do ... end`. Each `Hecks.bluebook` call used to
|
|
295
313
|
# mint a fresh builder, so a second file with the same chapter name
|
|
296
314
|
# silently replaced the first's aggregates instead of adding to them.
|
|
297
315
|
#
|
|
298
|
-
# The registry now holds the builder
|
|
316
|
+
# The registry now holds the builder open across calls : the first file
|
|
299
317
|
# for a name creates it, every later file for the same name reuses the
|
|
300
318
|
# same instance, so `@aggregates`/`@read_models` accumulate. `#build` is
|
|
301
319
|
# safe to call once per file on the same builder — it constructs a fresh
|
|
302
320
|
# `Bluebook` from whatever is currently held and re-`Namespace.install`s
|
|
303
|
-
# over the previous one, so the
|
|
321
|
+
# over the previous one, so the last file's call leaves every aggregate
|
|
304
322
|
# seen so far reachable, and each call's IR is a strict superset of the
|
|
305
323
|
# one before. `Registry#add_bluebook` still simply stores by name — with
|
|
306
324
|
# this in place, "last write wins" is the cumulative, correct write.
|
|
@@ -308,7 +326,7 @@ module Hecks
|
|
|
308
326
|
registry = Hecks.current_registry
|
|
309
327
|
builder = registry ? registry.bluebook_builder(name) { new(name, version: version) } : new(name, version: version)
|
|
310
328
|
builder.__send__(:adopt_version, version)
|
|
311
|
-
# A bare constant in a bluebook — `attribute :name, PizzaName` — is a
|
|
329
|
+
# A bare constant in a bluebook — `attribute :name, PizzaName` — is a name,
|
|
312
330
|
# not a reference to something Ruby has heard of. `const_missing` hands
|
|
313
331
|
# over a `ConstShim::ScopedConstant` (S0b, const_shim.rb's own comment),
|
|
314
332
|
# and that is still the whole answer for a bare name: `Attribute` spells
|
|
@@ -316,7 +334,7 @@ module Hecks
|
|
|
316
334
|
# only long enough to be stringified. The concept still has a home — the
|
|
317
335
|
# language declares `value_object "TypeName"` — it just needed no Ruby
|
|
318
336
|
# class of its own. A Module rather than a Symbol is what also lets
|
|
319
|
-
# `Account::Debit`/`admits: Account::LedgerDirection` answer their
|
|
337
|
+
# `Account::Debit`/`admits: Account::LedgerDirection` answer their own
|
|
320
338
|
# `::` — a plain Symbol cannot.
|
|
321
339
|
resolver = ->(const) { ConstShim::ScopedConstant.for(const) }
|
|
322
340
|
ConstShim.with(resolver) { builder.instance_eval(&block) } if block
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Generated — projected from the language's own Keyword rows (the
|
|
2
|
+
# `calls:`, `resolves_via:` and `disambiguator:` columns of every
|
|
3
|
+
# KeywordSeed under lib/hecks/language/).
|
|
4
|
+
#
|
|
5
|
+
# Do not edit. spec/bootstrap_table_spec.rb re-projects this in memory
|
|
6
|
+
# and refuses a diff — run bin/project_bootstrap_table instead.
|
|
7
|
+
#
|
|
8
|
+
# Plain data, no requires: this is read while the grammar table it was
|
|
9
|
+
# projected from is still being built (`MetaValidator.bootstrapping?`).
|
|
10
|
+
|
|
11
|
+
module Hecks
|
|
12
|
+
module Bluebook
|
|
13
|
+
module DSL
|
|
14
|
+
module BootstrapTable
|
|
15
|
+
# [context, word] => the method a word's whole call forwards to.
|
|
16
|
+
CALLS = {
|
|
17
|
+
["Aggregate", "provenance"] => :provenance_impl,
|
|
18
|
+
["Aggregate", "identified_by"] => :identified_by_impl,
|
|
19
|
+
["Aggregate", "reference_to"] => :reference_to_impl,
|
|
20
|
+
["Aggregate", "has_many"] => :has_many_impl,
|
|
21
|
+
["Aggregate", "has_one"] => :has_one_impl,
|
|
22
|
+
["Aggregate", "belongs_to"] => :belongs_to_impl,
|
|
23
|
+
["Aggregate", "lifecycle"] => :lifecycle_impl,
|
|
24
|
+
["Aggregate", "entity"] => :entity_impl,
|
|
25
|
+
["Aggregate", "query"] => :query_impl,
|
|
26
|
+
["Aggregate", "policy"] => :policy_impl,
|
|
27
|
+
["Aggregate", "command"] => :command_impl,
|
|
28
|
+
["Aggregate", "attribute"] => :attribute_impl,
|
|
29
|
+
["Aggregate", "invariant"] => :invariant_impl,
|
|
30
|
+
["Aggregate", "given"] => :given_impl,
|
|
31
|
+
["Aggregate", "projects"] => :projects_impl,
|
|
32
|
+
["Lifecycle", "transition"] => :transition_impl,
|
|
33
|
+
["Bluebook", "attaches_to"] => :attaches_to_impl,
|
|
34
|
+
["Bluebook", "provides"] => :provides_impl,
|
|
35
|
+
["Bluebook", "aggregate"] => :aggregate_impl,
|
|
36
|
+
["Command", "role"] => :role_impl,
|
|
37
|
+
["Command", "provenance"] => :provenance_impl,
|
|
38
|
+
["Command", "reference_to"] => :reference_to_impl,
|
|
39
|
+
["Command", "given"] => :given_impl,
|
|
40
|
+
["Command", "sets"] => :sets_impl,
|
|
41
|
+
["Command", "then_set"] => :then_set_impl,
|
|
42
|
+
["Command", "delegates_to"] => :delegates_to_impl,
|
|
43
|
+
["Command", "attribute"] => :attribute_impl,
|
|
44
|
+
["Command", "corrects"] => :corrects_impl,
|
|
45
|
+
["Entity", "identified_by"] => :identified_by_impl,
|
|
46
|
+
["Entity", "given"] => :given_impl,
|
|
47
|
+
["Entity", "invariant"] => :invariant_impl,
|
|
48
|
+
["Entity", "command"] => :command_impl,
|
|
49
|
+
["Entity", "query"] => :query_impl,
|
|
50
|
+
["Entity", "lifecycle"] => :lifecycle_impl,
|
|
51
|
+
["Entity", "attribute"] => :attribute_impl,
|
|
52
|
+
["Entity", "reference_to"] => :reference_to_impl,
|
|
53
|
+
["Entity", "has_many"] => :has_many_impl,
|
|
54
|
+
["Entity", "has_one"] => :has_one_impl,
|
|
55
|
+
["Entity", "belongs_to"] => :belongs_to_impl,
|
|
56
|
+
["Entity", "entity"] => :entity_impl,
|
|
57
|
+
["Policy", "on"] => :on_impl,
|
|
58
|
+
["Policy", "trigger"] => :trigger_impl,
|
|
59
|
+
["Policy", "across"] => :across_impl,
|
|
60
|
+
["ProcessManager", "starts_on"] => :starts_on_impl,
|
|
61
|
+
["ProcessManager", "ends_on"] => :ends_on_impl,
|
|
62
|
+
["ProcessManager", "transition"] => :transition_impl,
|
|
63
|
+
["Handler", "dispatch"] => :dispatch_impl,
|
|
64
|
+
["Dispatch", "compensates"] => :compensates_impl,
|
|
65
|
+
["ReadModel", "reference_to"] => :reference_to_impl,
|
|
66
|
+
["ReadModel", "include"] => :include_impl,
|
|
67
|
+
["ReadModel", "group_by"] => :group_by_impl,
|
|
68
|
+
["ReadModel", "where"] => :where_impl,
|
|
69
|
+
["ReadModel", "order_by"] => :order_by_impl,
|
|
70
|
+
["ReadModel", "authorize"] => :authorize_impl,
|
|
71
|
+
["Query", "attribute"] => :attribute_impl,
|
|
72
|
+
["Query", "reference_to"] => :reference_to_impl,
|
|
73
|
+
["Query", "where"] => :where_impl,
|
|
74
|
+
["Query", "order_by"] => :order_by_impl,
|
|
75
|
+
["Query", "authorize"] => :authorize_impl,
|
|
76
|
+
["ValueObject", "attribute"] => :attribute_impl,
|
|
77
|
+
["ValueObject", "one_of"] => :one_of_impl,
|
|
78
|
+
["ValueObject", "invariant"] => :invariant_impl,
|
|
79
|
+
["ValueObject", "member"] => :member_impl,
|
|
80
|
+
["OneOf", "member"] => :member_impl,
|
|
81
|
+
["Type", "list_of"] => :list_of_impl,
|
|
82
|
+
["Type", "one_of"] => :one_of_impl,
|
|
83
|
+
["World", "realm"] => :realm_impl,
|
|
84
|
+
["World", "latest"] => :latest_impl,
|
|
85
|
+
["DomainPort", "operation"] => :tells_impl,
|
|
86
|
+
["DomainPort", "tells"] => :tells_impl,
|
|
87
|
+
["DomainPort", "asks"] => :asks_impl,
|
|
88
|
+
["Hecksagon", "port"] => :port_impl,
|
|
89
|
+
["PortOperation", "reference_to"] => :reference_to_impl,
|
|
90
|
+
["PortOperation", "attribute"] => :attribute_impl,
|
|
91
|
+
["Translation", "aggregate"] => :aggregate_impl,
|
|
92
|
+
["TranslationAggregate", "rename"] => :rename_impl,
|
|
93
|
+
["TranslationAggregate", "move"] => :move_impl,
|
|
94
|
+
["TranslationAggregate", "convert"] => :convert_impl,
|
|
95
|
+
["TranslationAggregate", "retype"] => :retype_impl,
|
|
96
|
+
["TranslationAggregate", "compute"] => :compute_impl,
|
|
97
|
+
["TranslationAggregate", "rekey"] => :rekey_impl,
|
|
98
|
+
["TranslationAggregate", "backfill"] => :backfill_impl,
|
|
99
|
+
["TranslationAggregate", "unresolved"] => :unresolved_impl,
|
|
100
|
+
["Query", "limit"] => :limit_impl,
|
|
101
|
+
["Query", "offset"] => :offset_impl,
|
|
102
|
+
["ReadModel", "limit"] => :limit_impl,
|
|
103
|
+
["ReadModel", "offset"] => :offset_impl
|
|
104
|
+
}.freeze
|
|
105
|
+
|
|
106
|
+
# [word, context] => the RuleReference primitive a bare reference resolves through.
|
|
107
|
+
RESOLVES = {
|
|
108
|
+
["given", "Aggregate"] => { resolves_via: "owner_keyed", disambiguator: "declared_by" }.freeze,
|
|
109
|
+
["given", "Command"] => { resolves_via: "hash_chain" }.freeze,
|
|
110
|
+
["given", "Entity"] => { resolves_via: "owner_keyed", disambiguator: "declared_by" }.freeze,
|
|
111
|
+
["invariant", "ValueObject"] => { resolves_via: "sibling_scan" }.freeze
|
|
112
|
+
}.freeze
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|