hecks 4.0.0 → 6.0.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/examples/pizzas/bluebook/pizzas.bluebook +1 -0
- data/exe/hecks +15 -3
- data/lib/hecks/adapters/driven/claude_code.rb +1 -1
- data/lib/hecks/adapters/driven/d1.rb +2 -1
- data/lib/hecks/adapters/driven/folder.rb +35 -28
- data/lib/hecks/adapters/driven/folder_overlay.rb +51 -0
- data/lib/hecks/adapters/driven/google_authentication.adapter +3 -0
- data/lib/hecks/adapters/driven/google_authentication.rb +99 -0
- data/lib/hecks/adapters/driven/governance_authorization.rb +32 -36
- data/lib/hecks/adapters/driven/heki/journal.rb +45 -0
- data/lib/hecks/adapters/driven/identity_registry.rb +1 -1
- data/lib/hecks/adapters/driven/in_memory_ordering.rb +3 -2
- data/lib/hecks/adapters/driven/key_keeper.rb +42 -0
- data/lib/hecks/adapters/driven/lambda/client.rb +8 -2
- data/lib/hecks/adapters/driven/lambda/remote_dispatcher.rb +185 -0
- data/lib/hecks/adapters/driven/lambda.rb +14 -2
- data/lib/hecks/adapters/driven/memory/dispatch_claims.rb +25 -0
- data/lib/hecks/adapters/driven/memory.rb +15 -4
- data/lib/hecks/adapters/driven/postgres/codec.rb +1 -1
- data/lib/hecks/adapters/driven/postgres/journal.rb +46 -0
- data/lib/hecks/adapters/driven/postgres/outbox.rb +31 -5
- data/lib/hecks/adapters/driven/postgres/projection.rb +43 -0
- data/lib/hecks/adapters/driven/postgres/repository.rb +1 -1
- data/lib/hecks/adapters/driven/postgres/schema_builder.rb +2 -1
- data/lib/hecks/adapters/driven/postgres/set_dialect.rb +44 -0
- data/lib/hecks/adapters/driven/postgres.adapter +8 -0
- data/lib/hecks/adapters/driven/postgres.rb +8 -3
- data/lib/hecks/adapters/driven/postgres_dump/connection.rb +57 -0
- data/lib/hecks/adapters/driven/postgres_dump.rb +117 -0
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/boot.rb +6 -3
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/class_methods.rb +1 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/dialect.rb +1 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/chain_sql.rb +8 -4
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/domain_rename.rb +2 -2
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/era_integrity.rb +2 -2
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/era_store.rb +3 -3
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/mint_transaction.rb +2 -2
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/sql_templates.rb +6 -2
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/tail_merge.rb +1 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage.rb +1 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/context.rb +15 -5
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/coverage_check.rb +13 -11
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/era_resolver.rb +23 -6
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/merge_coordinator.rb +2 -2
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/minter.rb +12 -9
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager/refusals.rb +13 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage_manager.rb +6 -6
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/query_phases.rb +8 -2
- data/lib/hecks/adapters/driven/postgres_era.adapter +7 -1
- data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era.rb +14 -13
- data/lib/hecks/adapters/driven/prism.rb +4 -3
- data/lib/hecks/adapters/driven/projection/read_model_walk.rb +126 -0
- data/lib/hecks/adapters/driven/projection/row_decoding.rb +57 -0
- data/lib/hecks/adapters/driven/set_transform/assignments.rb +101 -0
- data/lib/hecks/adapters/driven/set_transform/expressions.rb +138 -0
- data/lib/hecks/adapters/driven/set_transform.rb +81 -0
- data/lib/hecks/adapters/driven/sql_keyset.rb +61 -0
- data/lib/hecks/adapters/driven/sql_query_builder.rb +28 -9
- data/lib/hecks/adapters/driven/sqlite/codec.rb +1 -1
- data/lib/hecks/adapters/driven/sqlite/ddl.rb +7 -0
- data/lib/hecks/adapters/driven/sqlite/dialect.rb +2 -1
- data/lib/hecks/adapters/driven/sqlite/dispatch_claims.rb +28 -0
- data/lib/hecks/adapters/driven/sqlite/journal.rb +46 -0
- data/lib/hecks/adapters/driven/sqlite/outbox.rb +3 -2
- data/lib/hecks/adapters/driven/sqlite/projection.rb +9 -135
- data/lib/hecks/adapters/driven/sqlite/repository.rb +1 -1
- data/lib/hecks/adapters/driven/sqlite/schema_builder.rb +16 -4
- data/lib/hecks/adapters/driven/sqlite/set_dialect.rb +39 -0
- data/lib/hecks/adapters/driven/sqlite.adapter +2 -0
- data/lib/hecks/adapters/driven/sqlite.rb +11 -2
- data/lib/hecks/adapters/driven.rb +8 -3
- data/lib/hecks/adapters/driving/cli.rb +1 -1
- data/lib/hecks/adapters/driving/cli_runner/answers.rb +23 -16
- data/lib/hecks/adapters/driving/cli_runner/resolution.rb +25 -24
- data/lib/hecks/adapters/driving/cli_runner/settling.rb +9 -5
- data/lib/hecks/adapters/driving/cli_runner/streaming.rb +1 -1
- data/lib/hecks/adapters/driving/cli_runner/suggestions.rb +15 -7
- data/lib/hecks/adapters/driving/cli_runner/verb_names.rb +49 -0
- data/lib/hecks/adapters/driving/cli_runner.rb +4 -2
- data/lib/hecks/adapters/driving/github_webhook.rb +2 -1
- data/lib/hecks/adapters/driving/handle/verb_methods.rb +46 -0
- data/lib/hecks/adapters/driving/handle.rb +9 -17
- data/lib/hecks/adapters/driving/json.rb +19 -17
- data/lib/hecks/adapters/driving/launcher_options.rb +37 -32
- data/lib/hecks/adapters/driving/mcp_scope/env_problems.rb +3 -1
- data/lib/hecks/adapters/driving/mcp_scope.rb +8 -7
- data/lib/hecks/adapters/driving/newcomer.rb +6 -5
- data/lib/hecks/adapters/driving/ruby/aggregate_module.rb +13 -12
- data/lib/hecks/adapters/driving/ruby/bulk_verbs.rb +127 -0
- data/lib/hecks/adapters/driving/ruby/{chapter.rb → declaration.rb} +27 -27
- data/lib/hecks/adapters/driving/ruby/query_rows.rb +27 -0
- data/lib/hecks/adapters/driving/ruby.rb +25 -24
- data/lib/hecks/adapters/driving/usage_cache.rb +14 -3
- data/lib/hecks/assembly.rb +101 -0
- data/lib/hecks/behaviors/dsl.rb +13 -3
- data/lib/hecks/behaviors/expectations/boot.rb +7 -6
- data/lib/hecks/behaviors/expectations/checks.rb +1 -1
- data/lib/hecks/behaviors/expectations/dispatching.rb +10 -9
- data/lib/hecks/behaviors/expectations/qualify.rb +9 -9
- data/lib/hecks/behaviors/expectations.rb +24 -10
- data/lib/hecks/behaviors/ir.rb +4 -2
- data/lib/hecks/behaviors/rspec.rb +1 -1
- data/lib/hecks/behaviors/runner.rb +31 -4
- data/lib/hecks/bench/environment.rb +6 -2
- data/lib/hecks/bench/postgres_probe.rb +3 -1
- data/lib/hecks/bench/report.rb +4 -1
- data/lib/hecks/bench/suite.rb +9 -3
- data/lib/hecks/bluebook/acknowledgements.rb +81 -0
- data/lib/hecks/bluebook/aggregate.rb +13 -4
- data/lib/hecks/bluebook/ask_resolution.rb +17 -17
- data/lib/hecks/bluebook/assembly/aggregate_assembly.rb +8 -5
- data/lib/hecks/bluebook/assembly/contracts/structure.rb +11 -7
- data/lib/hecks/bluebook/assembly/marks.rb +10 -1
- data/lib/hecks/bluebook/assembly/scalars.rb +8 -2
- data/lib/hecks/bluebook/assembly/specializer.rb +2 -2
- data/lib/hecks/bluebook/assembly.rb +10 -10
- data/lib/hecks/bluebook/behaviour/aggregate.rb +2 -1
- data/lib/hecks/bluebook/behaviour/attribute.rb +12 -0
- data/lib/hecks/bluebook/behaviour/command.rb +1 -1
- data/lib/hecks/bluebook/behaviour/{chapter.rb → declaration.rb} +17 -17
- data/lib/hecks/bluebook/behaviour/domain_port.rb +1 -1
- data/lib/hecks/bluebook/behaviour/entity.rb +1 -0
- data/lib/hecks/bluebook/behaviour/hecksagon.rb +8 -1
- data/lib/hecks/bluebook/behaviour/process_manager.rb +4 -1
- data/lib/hecks/bluebook/behaviour/query.rb +5 -0
- data/lib/hecks/bluebook/behaviour/read_model.rb +4 -1
- data/lib/hecks/bluebook/behaviour/traits.rb +13 -0
- data/lib/hecks/bluebook/capabilities/attribute_values.rb +17 -16
- data/lib/hecks/bluebook/capabilities/package_declared.rb +65 -0
- data/lib/hecks/bluebook/capabilities.rb +32 -132
- data/lib/hecks/bluebook/command.rb +22 -7
- data/lib/hecks/bluebook/context_map.rb +104 -0
- data/lib/hecks/bluebook/{chapter.rb → declaration.rb} +13 -13
- data/lib/hecks/bluebook/dsl/adapter_builder.rb +28 -4
- data/lib/hecks/bluebook/dsl/aggregate_builder/draining.rb +2 -2
- data/lib/hecks/bluebook/dsl/aggregate_builder/one_of_reference.rb +54 -0
- data/lib/hecks/bluebook/dsl/aggregate_builder/query_field_sealing.rb +11 -2
- data/lib/hecks/bluebook/dsl/aggregate_builder/query_sealing.rb +15 -5
- data/lib/hecks/bluebook/dsl/aggregate_builder/relationships.rb +21 -3
- data/lib/hecks/bluebook/dsl/aggregate_builder/rules.rb +22 -22
- data/lib/hecks/bluebook/dsl/aggregate_builder/sealing.rb +2 -2
- data/lib/hecks/bluebook/dsl/aggregate_builder.rb +27 -22
- data/lib/hecks/bluebook/dsl/bluebook_builder/pending_givens.rb +22 -22
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/computed_sources.rb +27 -21
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/correlation_keys.rb +3 -5
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/event_shapes.rb +5 -4
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/fan_out_rows.rb +3 -3
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/hop_tails.rb +13 -5
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/projected_fields.rb +4 -4
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/provisions.rb +38 -84
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/query_hops.rb +5 -5
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/references.rb +6 -6
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation/with_projections.rb +6 -6
- data/lib/hecks/bluebook/dsl/bluebook_builder/validation.rb +3 -3
- data/lib/hecks/bluebook/dsl/bluebook_builder.rb +67 -67
- data/lib/hecks/bluebook/dsl/bootstrap_table.rb +2 -0
- data/lib/hecks/bluebook/dsl/command_builder/folded_sets.rb +48 -0
- data/lib/hecks/bluebook/dsl/command_builder.rb +28 -15
- data/lib/hecks/bluebook/dsl/context_map_builder.rb +73 -0
- data/lib/hecks/bluebook/dsl/entity_builder/rules.rb +17 -17
- data/lib/hecks/bluebook/dsl/entity_builder/scope.rb +3 -3
- data/lib/hecks/bluebook/dsl/entity_builder/sealing.rb +2 -2
- data/lib/hecks/bluebook/dsl/entity_builder.rb +3 -3
- data/lib/hecks/bluebook/dsl/hecksagon_builder/{chapter_scope.rb → bluebook_scope.rb} +14 -14
- data/lib/hecks/bluebook/dsl/hecksagon_builder.rb +33 -27
- data/lib/hecks/bluebook/dsl/identity_declaration.rb +6 -2
- data/lib/hecks/bluebook/dsl/lifecycle_builder.rb +4 -1
- data/lib/hecks/bluebook/dsl/query_builder.rb +14 -8
- data/lib/hecks/bluebook/dsl/read_model_builder/sealing.rb +6 -11
- data/lib/hecks/bluebook/dsl/read_model_builder.rb +1 -2
- data/lib/hecks/bluebook/dsl/word_gate.rb +2 -1
- data/lib/hecks/bluebook/dsl/world_builder.rb +2 -2
- data/lib/hecks/bluebook/dsl.rb +3 -2
- data/lib/hecks/bluebook/expression/ast_json/emitters.rb +4 -0
- data/lib/hecks/bluebook/expression/ast_json.rb +5 -3
- data/lib/hecks/bluebook/expression/ast_reader/blocks.rb +41 -0
- data/lib/hecks/bluebook/expression/ast_reader.rb +2 -10
- data/lib/hecks/bluebook/expression/canonical_form.rb +9 -4
- data/lib/hecks/bluebook/expression/evaluator/parser.rb +4 -1
- data/lib/hecks/bluebook/expression/evaluator.rb +13 -9
- data/lib/hecks/bluebook/expression/projection.json +6 -0
- data/lib/hecks/bluebook/expression/resolver/block_predicates.rb +50 -2
- data/lib/hecks/bluebook/expression/resolver/lookups.rb +2 -1
- data/lib/hecks/bluebook/expression/resolver/operations.rb +1 -0
- data/lib/hecks/bluebook/expression/resolver/parsing.rb +21 -15
- data/lib/hecks/bluebook/expression/resolver/scanning.rb +4 -1
- data/lib/hecks/bluebook/expression.rb +1 -1
- data/lib/hecks/bluebook/hecksagon.rb +48 -23
- data/lib/hecks/bluebook/meta_validator/adapter_judge.rb +4 -1
- data/lib/hecks/bluebook/meta_validator/judge/cells.rb +1 -1
- data/lib/hecks/bluebook/meta_validator/judge/identity.rb +2 -1
- data/lib/hecks/bluebook/meta_validator/modes.rb +27 -27
- data/lib/hecks/bluebook/meta_validator/plan.rb +5 -5
- data/lib/hecks/bluebook/meta_validator/readings/fields.rb +3 -3
- data/lib/hecks/bluebook/meta_validator/reconstruction/heads.rb +11 -3
- data/lib/hecks/bluebook/meta_validator/reconstruction/reading.rb +1 -1
- data/lib/hecks/bluebook/meta_validator/reconstruction.rb +19 -19
- data/lib/hecks/bluebook/meta_validator/shapes.rb +6 -1
- data/lib/hecks/bluebook/meta_validator/syntax_boot/disk_cache.rb +18 -15
- data/lib/hecks/bluebook/meta_validator/syntax_boot.rb +21 -15
- data/lib/hecks/bluebook/meta_validator/verdict_cache/prebuilt.rb +4 -1
- data/lib/hecks/bluebook/meta_validator/verdict_cache.rb +11 -10
- data/lib/hecks/bluebook/meta_validator.rb +25 -22
- data/lib/hecks/bluebook/model_check/aggregate_checks.rb +68 -0
- data/lib/hecks/bluebook/model_check/ask_checks.rb +6 -5
- data/lib/hecks/bluebook/model_check/client_profile.rb +8 -42
- data/lib/hecks/bluebook/model_check/context_checks.rb +97 -0
- data/lib/hecks/bluebook/model_check/context_map_checks.rb +158 -0
- data/lib/hecks/bluebook/model_check/lifecycle_checks.rb +27 -5
- data/lib/hecks/bluebook/model_check/one_of_checks.rb +106 -0
- data/lib/hecks/bluebook/model_check/orphan_checks.rb +129 -0
- data/lib/hecks/bluebook/model_check/redundant_relationships.rb +38 -0
- data/lib/hecks/bluebook/model_check/reference_checks.rb +11 -1
- data/lib/hecks/bluebook/model_check/saga_checks.rb +8 -3
- data/lib/hecks/bluebook/model_check/verbs.rb +4 -4
- data/lib/hecks/bluebook/model_check.rb +32 -12
- data/lib/hecks/bluebook/named_pattern.rb +12 -1
- data/lib/hecks/bluebook/one_of_union.rb +35 -0
- data/lib/hecks/bluebook/pattern_subset.rb +12 -3
- data/lib/hecks/bluebook/project_loader.rb +3 -2
- data/lib/hecks/bluebook/project_register.rb +21 -5
- data/lib/hecks/bluebook/query.rb +4 -1
- data/lib/hecks/bluebook/read_model.rb +5 -5
- data/lib/hecks/bluebook/reference.rb +3 -3
- data/lib/hecks/bluebook/smoke_test.rb +15 -13
- data/lib/hecks/bluebook/synthesizer.rb +48 -13
- data/lib/hecks/bluebook/translation_expression/parser.rb +14 -5
- data/lib/hecks/bluebook.rb +6 -3
- data/lib/hecks/bulk/bluebook/adapters/row_sweeper.adapter +7 -0
- data/lib/hecks/bulk/bluebook/bulk.behaviors +18 -0
- data/lib/hecks/bulk/bluebook/bulk.bluebook +126 -0
- data/lib/hecks/bulk/bluebook/bulk.hecksagon +11 -0
- data/lib/hecks/bulk/bluebook/bulk.ports.hecksagon +13 -0
- data/lib/hecks/bulk/plan.rb +60 -0
- data/lib/hecks/bulk/row_sweeper.rb +34 -0
- data/lib/hecks/bulk/set_arguments.rb +68 -0
- data/lib/hecks/bulk/set_eligibility.rb +50 -0
- data/lib/hecks/bulk/set_planner.rb +100 -0
- data/lib/hecks/bulk/set_sweep.rb +78 -0
- data/lib/hecks/bulk/sweep.rb +67 -0
- data/lib/hecks/cli/check_era.rb +6 -6
- data/lib/hecks/cli/command_table.rb +2 -2
- data/lib/hecks/cli/console.rb +11 -6
- data/lib/hecks/cli/document.rb +14 -9
- data/lib/hecks/cli/domain_writer.rb +4 -1
- data/lib/hecks/cli/expected_era.rb +139 -0
- data/lib/hecks/cli/expression_projection.rb +2 -2
- data/lib/hecks/cli/follow.rb +3 -3
- data/lib/hecks/cli/history.rb +4 -1
- data/lib/hecks/cli/interview_draft.rb +8 -1
- data/lib/hecks/cli/interview_record.rb +7 -3
- data/lib/hecks/cli/interview_run.rb +7 -5
- data/lib/hecks/cli/interview_session/proposals.rb +5 -2
- data/lib/hecks/cli/interview_session.rb +3 -2
- data/lib/hecks/cli/interview_shape/lifecycle.rb +92 -0
- data/lib/hecks/cli/interview_shape.rb +19 -73
- data/lib/hecks/cli/model_check/examination.rb +63 -14
- data/lib/hecks/cli/model_check/sources.rb +4 -2
- data/lib/hecks/cli/model_check.rb +1 -1
- data/lib/hecks/cli/persistence_notice.rb +45 -0
- data/lib/hecks/cli/present.rb +1 -1
- data/lib/hecks/cli/project_cli/launcher_source.rb +12 -10
- data/lib/hecks/cli/project_cli/templates.rb +24 -3
- data/lib/hecks/cli/project_cli.rb +11 -13
- data/lib/hecks/cli/project_diagrams.rb +20 -20
- data/lib/hecks/cli/project_glossary.rb +14 -14
- data/lib/hecks/cli/reference.rb +1 -1
- data/lib/hecks/cli/refresh_projections.rb +16 -11
- data/lib/hecks/cli/run.rb +27 -5
- data/lib/hecks/cli/seed_semantics_corpus.rb +14 -4
- data/lib/hecks/cli/shape.rb +3 -4
- data/lib/hecks/cli/smoke_http/transport.rb +3 -2
- data/lib/hecks/cli/statements.rb +7 -7
- data/lib/hecks/cli/stores.rb +70 -2
- data/lib/hecks/cli/stress_concurrency_specs/reporting.rb +4 -1
- data/lib/hecks/codemod.rb +3 -3
- data/lib/hecks/composer/adapters/claude_composer.rb +3 -2
- data/lib/hecks/composer/agent.rb +1 -1
- data/lib/hecks/composer/assistant.rb +2 -2
- data/lib/hecks/composer/behavior_run.rb +7 -1
- data/lib/hecks/composer/bluebook/composer.bluebook +18 -25
- data/lib/hecks/composer/bluebook/composer.hecksagon +1 -1
- data/lib/hecks/composer/board.rb +6 -6
- data/lib/hecks/composer/board_edit/command_text.rb +4 -1
- data/lib/hecks/composer/board_edit/source.rb +18 -9
- data/lib/hecks/composer/board_edit.rb +2 -2
- data/lib/hecks/composer/check.rb +22 -22
- data/lib/hecks/composer/domains.rb +1 -1
- data/lib/hecks/composer/live.rb +19 -13
- data/lib/hecks/composer/outline.rb +4 -1
- data/lib/hecks/composer/page.html +1 -1
- data/lib/hecks/composer/panels.rb +6 -3
- data/lib/hecks/composer/parse.rb +53 -36
- data/lib/hecks/composer/session.rb +22 -16
- data/lib/hecks/composer/toolbox.rb +9 -6
- data/lib/hecks/composer/web.rb +3 -2
- data/lib/hecks/composer/workbench.rb +12 -9
- data/lib/hecks/composer.rb +1 -1
- data/lib/hecks/construct.rb +7 -7
- data/lib/hecks/corpus/adapters.rb +2 -1
- data/lib/hecks/corpus/routes.rb +25 -5
- data/lib/hecks/corpus/rust.rb +59 -24
- data/lib/hecks/corpus/sources.rb +12 -11
- data/lib/hecks/corpus/worlds.rb +2 -1
- data/lib/hecks/corpus.rb +30 -22
- data/lib/hecks/deploy/bluebook/deploy.bluebook +304 -518
- data/lib/hecks/doc/reference/harvester.rb +4 -1
- data/lib/hecks/doc/reference/readme.rb +11 -6
- data/lib/hecks/doc/reference/rendering.rb +11 -5
- data/lib/hecks/doc/reference.rb +7 -5
- data/lib/hecks/embryonaut_bluebook/lock.rb +5 -1
- data/lib/hecks/embryonaut_bluebook/manifest.rb +7 -1
- data/lib/hecks/embryonaut_bluebook/registry/changelog.rb +4 -1
- data/lib/hecks/embryonaut_bluebook/registry/versions.rb +13 -2
- data/lib/hecks/embryonaut_bluebook/registry.rb +5 -2
- data/lib/hecks/embryonaut_bluebook/shape.rb +1 -1
- data/lib/hecks/embryonaut_bluebook/vendor.rb +5 -2
- data/lib/hecks/embryonaut_bluebook/vendor_cli.rb +15 -1
- data/lib/hecks/embryonaut_bluebook.rb +26 -12
- data/lib/hecks/engine_agreement.rb +4 -1
- data/lib/hecks/forms/app/commands.rb +35 -2
- data/lib/hecks/forms/app/records.rb +12 -12
- data/lib/hecks/forms/app/responses.rb +4 -2
- data/lib/hecks/forms/app.rb +22 -19
- data/lib/hecks/forms/command_form_renderer.rb +2 -2
- data/lib/hecks/forms/field_controls.rb +6 -1
- data/lib/hecks/forms/field_shape.rb +14 -6
- data/lib/hecks/forms/html.rb +8 -7
- data/lib/hecks/forms/html_pattern.rb +80 -0
- data/lib/hecks/forms/index_renderer.rb +11 -11
- data/lib/hecks/forms/params.rb +2 -1
- data/lib/hecks/forms/port_argument.rb +4 -1
- data/lib/hecks/forms/query_form_renderer.rb +1 -1
- data/lib/hecks/forms/record_renderer.rb +2 -2
- data/lib/hecks/forms/record_table.rb +1 -1
- data/lib/hecks/forms/reference_options.rb +2 -1
- data/lib/hecks/forms/text_shape.rb +4 -1
- data/lib/hecks/forms/value_object_shape.rb +1 -1
- data/lib/hecks/forms.rb +7 -7
- data/lib/hecks/fqn.rb +8 -2
- data/lib/hecks/framework/bluebook/change.bluebook +10 -15
- data/lib/hecks/framework/bluebook/change.hecksagon +1 -1
- data/lib/hecks/framework/bluebook/compliance.bluebook +27 -126
- data/lib/hecks/framework/bluebook/console_settings.bluebook +199 -114
- data/lib/hecks/framework/bluebook/framework.hecksagon +7 -0
- data/lib/hecks/framework/bluebook/governance.bluebook +36 -14
- data/lib/hecks/framework/bluebook/identity.bluebook +1 -1
- data/lib/hecks/framework/bluebook/privacy.bluebook +123 -19
- data/lib/hecks/framework/bluebook/privacy.key_keeper.adapter +7 -0
- data/lib/hecks/framework/bluebook/privacy.ports.hecksagon +19 -0
- data/lib/hecks/framework/compliance.oidc.json +6 -36
- data/lib/hecks/framework/console_settings.oidc.json +39 -24
- data/lib/hecks/framework/privacy.oidc.json +25 -0
- data/lib/hecks/framework.rb +24 -8
- data/lib/hecks/framework_bluebooks.rb +156 -0
- data/lib/hecks/freezer.rb +7 -1
- data/lib/hecks/fuzzing/combination_miner.rb +9 -6
- data/lib/hecks/fuzzing/concurrent_dispatch/world_copy.rb +3 -1
- data/lib/hecks/fuzzing/concurrent_dispatch.rb +2 -2
- data/lib/hecks/fuzzing/domain_generator.rb +8 -3
- data/lib/hecks/fuzzing/era_boundary.rb +1 -1
- data/lib/hecks/fuzzing/failure_triage.rb +13 -6
- data/lib/hecks/fuzzing/form_census/{chapter_forms.rb → bluebook_forms.rb} +12 -12
- data/lib/hecks/fuzzing/form_census.rb +14 -12
- data/lib/hecks/fuzzing/generated_domain_check.rb +2 -1
- data/lib/hecks/fuzzing/isolated_boot/postgres_scratch.rb +5 -5
- data/lib/hecks/fuzzing/isolated_boot/scratch_schema.rb +19 -9
- data/lib/hecks/fuzzing/isolated_boot/worlds.rb +13 -8
- data/lib/hecks/fuzzing/isolated_boot.rb +4 -5
- data/lib/hecks/fuzzing/mutation/checks.rb +2 -1
- data/lib/hecks/fuzzing/mutation/finders.rb +25 -8
- data/lib/hecks/fuzzing/mutation/observation.rb +3 -1
- data/lib/hecks/fuzzing/mutation/source_map.rb +3 -1
- data/lib/hecks/fuzzing/nondeterministic.rb +10 -4
- data/lib/hecks/fuzzing/outside_world.rb +1 -1
- data/lib/hecks/fuzzing/projection_agreement/binding.rb +63 -0
- data/lib/hecks/fuzzing/projection_agreement/comparison.rb +104 -0
- data/lib/hecks/fuzzing/projection_agreement.rb +68 -0
- data/lib/hecks/fuzzing/properties/aggregation_recompute.rb +1 -1
- data/lib/hecks/fuzzing/properties/bulk_parity.rb +118 -0
- data/lib/hecks/fuzzing/properties/catalog.rb +7 -0
- data/lib/hecks/fuzzing/properties/cursor_walks.rb +56 -0
- data/lib/hecks/fuzzing/properties/dispatch_and_mutations.rb +39 -1
- data/lib/hecks/fuzzing/properties/group_by_recompute.rb +6 -2
- data/lib/hecks/fuzzing/properties/grouped_reduction_recompute.rb +88 -0
- data/lib/hecks/fuzzing/properties/guards.rb +4 -1
- data/lib/hecks/fuzzing/properties/invariants_and_aggregation.rb +12 -2
- data/lib/hecks/fuzzing/properties/lifecycle_and_replay.rb +2 -1
- data/lib/hecks/fuzzing/properties/mutation_recompute.rb +3 -2
- data/lib/hecks/fuzzing/properties/piece_invariants.rb +3 -2
- data/lib/hecks/fuzzing/properties/query_rows.rb +5 -3
- data/lib/hecks/fuzzing/properties/querying.rb +6 -3
- data/lib/hecks/fuzzing/properties/read_model_names.rb +8 -2
- data/lib/hecks/fuzzing/properties/read_models.rb +2 -1
- data/lib/hecks/fuzzing/properties/refusals.rb +35 -0
- data/lib/hecks/fuzzing/properties/role_checks.rb +3 -2
- data/lib/hecks/fuzzing/properties/set_transform_parity.rb +73 -0
- data/lib/hecks/fuzzing/properties/tenant_scope.rb +3 -2
- data/lib/hecks/fuzzing/properties.rb +6 -0
- data/lib/hecks/fuzzing/qa_settings.rb +4 -4
- data/lib/hecks/fuzzing/replay/fan_out.rb +4 -3
- data/lib/hecks/fuzzing/replay/filters.rb +2 -2
- data/lib/hecks/fuzzing/replay/guard_check.rb +2 -2
- data/lib/hecks/fuzzing/replay/mutation_trace.rb +23 -10
- data/lib/hecks/fuzzing/replay/observation.rb +11 -7
- data/lib/hecks/fuzzing/replay/read_only_steps.rb +40 -3
- data/lib/hecks/fuzzing/replay/refusal_trace.rb +44 -0
- data/lib/hecks/fuzzing/replay/role_check.rb +2 -2
- data/lib/hecks/fuzzing/replay/session.rb +38 -18
- data/lib/hecks/fuzzing/replay/validation_reports.rb +61 -0
- data/lib/hecks/fuzzing/replay.rb +2 -2
- data/lib/hecks/fuzzing/rust_gap_manifest.rb +3 -3
- data/lib/hecks/fuzzing/self_consistency/saga_redelivery.rb +18 -8
- data/lib/hecks/fuzzing/self_consistency/sagas.rb +2 -2
- data/lib/hecks/fuzzing/self_consistency/value_objects.rb +9 -2
- data/lib/hecks/fuzzing/self_consistency.rb +4 -8
- data/lib/hecks/fuzzing/sequence_generator/adversary/argument_mutations.rb +15 -5
- data/lib/hecks/fuzzing/sequence_generator/adversary/caller_draw.rb +14 -10
- data/lib/hecks/fuzzing/sequence_generator/adversary/precedence_mutations.rb +1 -1
- data/lib/hecks/fuzzing/sequence_generator/argument_drawing.rb +2 -1
- data/lib/hecks/fuzzing/sequence_generator/catalog.rb +21 -13
- data/lib/hecks/fuzzing/sequence_generator/picker.rb +1 -1
- data/lib/hecks/fuzzing/sequence_generator/query_binding.rb +3 -3
- data/lib/hecks/fuzzing/sequence_generator/step_builder.rb +2 -2
- data/lib/hecks/fuzzing/sequence_generator.rb +1 -2
- data/lib/hecks/fuzzing/shrinker.rb +4 -1
- data/lib/hecks/fuzzing/value_generator.rb +14 -8
- data/lib/hecks/fuzzing.rb +1 -0
- data/lib/hecks/grammar/dialects.rb +56 -0
- data/lib/hecks/grammar/evolve/arguments.rb +1 -1
- data/lib/hecks/grammar/evolve/keywords.rb +1 -1
- data/lib/hecks/grammar/evolve/seeds.rb +34 -8
- data/lib/hecks/grammar/expression.bluebook +3 -0
- data/lib/hecks/grammar/expression_operators.json +1071 -1
- data/lib/hecks/grammar/operators.rb +45 -22
- data/lib/hecks/grammar/translation.bluebook +2 -0
- data/lib/hecks/grammar/translation_ledger.rb +45 -0
- data/lib/hecks/grammar/translation_rules.json +646 -0
- data/lib/hecks/grammar.rb +27 -23
- data/lib/hecks/hecks/adapters/claude_agents.adapter +7 -0
- data/lib/hecks/hecks/adapters/claude_agents.rb +119 -0
- data/lib/hecks/hecks/adapters/claude_transcript.rb +71 -0
- data/lib/hecks/hecks/adapters/codebase/cache_clearing.rb +32 -0
- data/lib/hecks/hecks/adapters/codebase/cargo_tests.rb +50 -0
- data/lib/hecks/hecks/adapters/codebase/composing.rb +3 -2
- data/lib/hecks/hecks/adapters/codebase/conformance.rb +17 -1
- data/lib/hecks/hecks/adapters/codebase/corpus_tasks.rb +1 -1
- data/lib/hecks/hecks/adapters/codebase/declarations.rb +144 -0
- data/lib/hecks/hecks/adapters/codebase/inspection.rb +5 -4
- data/lib/hecks/hecks/adapters/codebase/language.rb +1 -0
- data/lib/hecks/hecks/adapters/codebase/npm_registry.rb +7 -1
- data/lib/hecks/hecks/adapters/codebase/previewing.rb +62 -0
- data/lib/hecks/hecks/adapters/codebase/promotion/gate.rb +1 -1
- data/lib/hecks/hecks/adapters/codebase/reading.rb +94 -0
- data/lib/hecks/hecks/adapters/codebase/regeneration.rb +6 -2
- data/lib/hecks/hecks/adapters/codebase/release_facts.rb +1 -1
- data/lib/hecks/hecks/adapters/codebase/ruby_child.rb +5 -2
- data/lib/hecks/hecks/adapters/codebase/search.rb +91 -0
- data/lib/hecks/hecks/adapters/codebase/source_tree.rb +37 -2
- data/lib/hecks/hecks/adapters/codebase/static_directory.rb +59 -0
- data/lib/hecks/hecks/adapters/codebase/style.rb +2 -2
- data/lib/hecks/hecks/adapters/codebase/test_runner.rb +30 -11
- data/lib/hecks/hecks/adapters/codebase/test_suite.rb +41 -3
- data/lib/hecks/hecks/adapters/console_capture.rb +27 -0
- data/lib/hecks/hecks/adapters/deploy_plans.rb +12 -3
- data/lib/hecks/hecks/adapters/deploy_toolchain/answers.rb +14 -5
- data/lib/hecks/hecks/adapters/deploy_toolchain/scripts.rb +6 -3
- data/lib/hecks/hecks/adapters/deploy_toolchain.rb +3 -3
- data/lib/hecks/hecks/adapters/desktop_alert/alert.rb +50 -0
- data/lib/hecks/hecks/adapters/desktop_alert.adapter +7 -0
- data/lib/hecks/hecks/adapters/desktop_alert.rb +99 -0
- data/lib/hecks/hecks/adapters/finding_github.rb +4 -1
- data/lib/hecks/hecks/adapters/first_admin.rb +19 -12
- data/lib/hecks/hecks/adapters/git.rb +5 -5
- data/lib/hecks/hecks/adapters/git_checkout.adapter +7 -0
- data/lib/hecks/hecks/adapters/git_checkout.rb +99 -0
- data/lib/hecks/hecks/adapters/git_landing/merger.rb +85 -0
- data/lib/hecks/hecks/adapters/git_landing.adapter +7 -0
- data/lib/hecks/hecks/adapters/git_landing.rb +103 -0
- data/lib/hecks/hecks/adapters/git_launcher.adapter +7 -0
- data/lib/hecks/hecks/adapters/git_launcher.rb +82 -0
- data/lib/hecks/hecks/adapters/git_refs.rb +8 -4
- data/lib/hecks/hecks/adapters/git_train/bench.rb +76 -0
- data/lib/hecks/hecks/adapters/git_train/carriage.rb +116 -0
- data/lib/hecks/hecks/adapters/git_train/local_branch.rb +69 -0
- data/lib/hecks/hecks/adapters/git_train/reading.rb +26 -0
- data/lib/hecks/hecks/adapters/git_train/survey.rb +60 -0
- data/lib/hecks/hecks/adapters/git_train.adapter +7 -0
- data/lib/hecks/hecks/adapters/git_train.rb +88 -0
- data/lib/hecks/hecks/adapters/git_worktrees.rb +81 -0
- data/lib/hecks/hecks/adapters/host_http.rb +5 -4
- data/lib/hecks/hecks/adapters/in_process_access.rb +3 -2
- data/lib/hecks/hecks/adapters/in_process_boot.rb +62 -35
- data/lib/hecks/hecks/adapters/in_process_operations.rb +30 -4
- data/lib/hecks/hecks/adapters/journal_store/changes.rb +7 -7
- data/lib/hecks/hecks/adapters/journal_store/compaction.rb +14 -7
- data/lib/hecks/hecks/adapters/journal_store/edge_audit.rb +9 -7
- data/lib/hecks/hecks/adapters/journal_store/examination.rb +3 -3
- data/lib/hecks/hecks/adapters/journal_store/held_domain.rb +17 -5
- data/lib/hecks/hecks/adapters/journal_store/readings/attestation.rb +3 -3
- data/lib/hecks/hecks/adapters/journal_store/readings/scaffolding.rb +7 -4
- data/lib/hecks/hecks/adapters/journal_store/readings.rb +2 -2
- data/lib/hecks/hecks/adapters/journal_store.rb +2 -2
- data/lib/hecks/hecks/adapters/ledger/chain.rb +63 -0
- data/lib/hecks/hecks/adapters/ledger/journal.rb +105 -0
- data/lib/hecks/hecks/adapters/ledger.adapter +7 -0
- data/lib/hecks/hecks/adapters/ledger.rb +89 -0
- data/lib/hecks/hecks/adapters/local_files.rb +15 -1
- data/lib/hecks/hecks/adapters/pg_admin.rb +7 -1
- data/lib/hecks/hecks/adapters/rails_app_files.rb +64 -0
- data/lib/hecks/hecks/adapters/rehearsal/audit_report.rb +4 -1
- data/lib/hecks/hecks/adapters/rehearsal/inquiry.rb +9 -9
- data/lib/hecks/hecks/adapters/rehearsal/memory_store.rb +2 -2
- data/lib/hecks/hecks/adapters/rehearsal/postgres_census.rb +4 -4
- data/lib/hecks/hecks/adapters/rehearsal/postgres_reading.rb +3 -3
- data/lib/hecks/hecks/adapters/rehearsal/postgres_store.rb +4 -1
- data/lib/hecks/hecks/adapters/rehearsal/rust_audit.rb +1 -1
- data/lib/hecks/hecks/adapters/rehearsal/subject.rb +34 -5
- data/lib/hecks/hecks/adapters/rust_toolchain.rb +5 -3
- data/lib/hecks/hecks/adapters/settings_reading.adapter +7 -0
- data/lib/hecks/hecks/adapters/settings_reading.rb +142 -0
- data/lib/hecks/hecks/adapters/shell.rb +3 -0
- data/lib/hecks/hecks/adapters/site_toolchain.rb +8 -8
- data/lib/hecks/hecks/adapters/world_clearing.rb +2 -1
- data/lib/hecks/hecks/agents.bluebook +246 -0
- data/lib/hecks/hecks/codebase.behaviors +13 -1
- data/lib/hecks/hecks/codebase.bluebook +554 -586
- data/lib/hecks/hecks/composer.behaviors +10 -10
- data/lib/hecks/hecks/context_map.hecksagon +7 -6
- data/lib/hecks/hecks/custodian.behaviors +96 -1
- data/lib/hecks/hecks/custodian.bluebook +553 -157
- data/lib/hecks/hecks/deploy.behaviors +1 -1
- data/lib/hecks/hecks/deploy.world +3 -4
- data/lib/hecks/hecks/hecks.behaviors +2 -2
- data/lib/hecks/hecks/hecks.bluebook +9 -14
- data/lib/hecks/hecks/hecks.contextmap +25 -0
- data/lib/hecks/hecks/hecks.hecksagon +139 -6
- data/lib/hecks/hecks/hecks.world +22 -21
- data/lib/hecks/hecks/ledger.bluebook +190 -0
- data/lib/hecks/hecks/rehearsal.bluebook +43 -77
- data/lib/hecks/hecks/shapes.json +17 -0
- data/lib/hecks/hecks/site.behaviors +1 -1
- data/lib/hecks/hecks/site.world +3 -3
- data/lib/hecks/hecks/tooling.bluebook +170 -174
- data/lib/hecks/hecks/translations/2-148748.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-15a2e4.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-1b447c.bluebook +5 -0
- data/lib/hecks/hecks/translations/2-240474.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-44446d.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-46ca26.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-473eab.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-75cc28.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-781c07.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-84c18b.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-aa5fff.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-bfdb48.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-cd96d8.bluebook +10 -0
- data/lib/hecks/hecks/translations/2-d43f71.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-eea577.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-f53248.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-fbb677.bluebook +2 -0
- data/lib/hecks/hecks/translations/2-ffdf12.bluebook +6 -0
- data/lib/hecks/ir.rb +8 -1
- data/lib/hecks/kernel_capabilities/templates.rb +4 -3
- data/lib/hecks/kernel_capabilities.rb +6 -6
- data/lib/hecks/language/adapter.bluebook +61 -0
- data/lib/hecks/language/bluebook/aggregate.bluebook +36 -6
- data/lib/hecks/language/bluebook/attaches/paging.bluebook +1 -1
- data/lib/hecks/language/bluebook/bluebook.behaviors +6 -6
- data/lib/hecks/language/bluebook/bluebook.bluebook +28 -51
- data/lib/hecks/language/bluebook/bluebook.hecksagon +1 -1
- data/lib/hecks/language/bluebook/command.bluebook +34 -2
- data/lib/hecks/language/bluebook/entity.bluebook +2 -2
- data/lib/hecks/language/bluebook/policy.behaviors +2 -2
- data/lib/hecks/language/bluebook/policy.bluebook +3 -3
- data/lib/hecks/language/bluebook/process_manager.bluebook +3 -3
- data/lib/hecks/language/bluebook/projection.bluebook +11 -10
- data/lib/hecks/language/bluebook/query.bluebook +1 -0
- data/lib/hecks/language/bluebook/shape.bluebook +1 -1
- data/lib/hecks/language/bluebook/syntax.bluebook +3 -1
- data/lib/hecks/language/bluebook/vocabulary.bluebook +287 -6
- data/lib/hecks/language/context_map/context_map.bluebook +90 -0
- data/lib/hecks/language/hecksagon/domain_port.bluebook +2 -2
- data/lib/hecks/language/hecksagon/hecksagon.bluebook +8 -8
- data/lib/hecks/language/oidc.json +10 -0
- data/lib/hecks/language/port.bluebook +1 -1
- data/lib/hecks/language/sentence/sentence.bluebook +210 -0
- data/lib/hecks/language/world/world.bluebook +6 -6
- data/lib/hecks/literal.rb +8 -2
- data/lib/hecks/naming.rb +44 -14
- data/lib/hecks/persistence_legacy_fixture/postgres_stores.rb +7 -6
- data/lib/hecks/persistence_legacy_fixture/regenerate.rb +6 -2
- data/lib/hecks/ports/access_control.rb +2 -2
- data/lib/hecks/ports/agent/answers.rb +2 -2
- data/lib/hecks/ports/agent.rb +2 -2
- data/lib/hecks/ports/authentication.port +6 -0
- data/lib/hecks/ports/authentication.rb +67 -0
- data/lib/hecks/ports/authorization.rb +3 -3
- data/lib/hecks/ports/dispatch.port +5 -0
- data/lib/hecks/ports/dispatch.rb +28 -0
- data/lib/hecks/ports/key_vault.rb +9 -6
- data/lib/hecks/ports/loading.rb +23 -7
- data/lib/hecks/ports/persistence/append_only.rb +18 -1
- data/lib/hecks/ports/persistence/binding_policy.rb +70 -11
- data/lib/hecks/ports/persistence/codec_boundary.rb +3 -2
- data/lib/hecks/ports/persistence/plugins/era/era_check.rb +10 -10
- data/lib/hecks/ports/persistence/plugins/era/era_guard/shape_diff.rb +4 -5
- data/lib/hecks/ports/persistence/plugins/era/era_guard.rb +11 -11
- data/lib/hecks/ports/persistence/plugins/era/era_tamper.rb +1 -1
- data/lib/hecks/ports/persistence/plugins/era/storage_shape.rb +6 -6
- data/lib/hecks/ports/persistence/plugins/era/translation/audit.rb +9 -3
- data/lib/hecks/ports/persistence/plugins/era/translation/reattest.rb +1 -1
- data/lib/hecks/ports/persistence/plugins/era/translation/rule_compiler.rb +32 -19
- data/lib/hecks/ports/persistence/plugins/era/translation/scaffold/differ.rb +2 -2
- data/lib/hecks/ports/persistence/plugins/era.rb +0 -1
- data/lib/hecks/ports/persistence/remote_runtime.rb +3 -2
- data/lib/hecks/ports/persistence/set_statement.rb +29 -0
- data/lib/hecks/ports/persistence/set_transforming.rb +30 -0
- data/lib/hecks/ports/persistence/state_codec.rb +3 -3
- data/lib/hecks/ports/persistence.rb +0 -4
- data/lib/hecks/ports/projection.rb +4 -1
- data/lib/hecks/ports/query/cursor.rb +131 -0
- data/lib/hecks/ports/query/in_memory.rb +17 -10
- data/lib/hecks/ports/query.rb +4 -2
- data/lib/hecks/ports.rb +1 -0
- data/lib/hecks/projection_files/expression_tables.rb +3 -3
- data/lib/hecks/projection_files/sentence_table.rb +17 -0
- data/lib/hecks/projection_files.rb +16 -13
- data/lib/hecks/projections/bootstrap_table.rb +3 -3
- data/lib/hecks/projections/command_schema/shape.rb +95 -0
- data/lib/hecks/projections/command_schema.rb +74 -0
- data/lib/hecks/projections/context_map_diagram.rb +135 -0
- data/lib/hecks/projections/context_relationships.rb +125 -0
- data/lib/hecks/projections/deploy/box/access.rb +7 -4
- data/lib/hecks/projections/deploy/box/caddy.rb +2 -1
- data/lib/hecks/projections/deploy/box/compose.rb +4 -8
- data/lib/hecks/projections/deploy/box/edge.rb +2 -1
- data/lib/hecks/projections/deploy/box/hosting.rb +4 -2
- data/lib/hecks/projections/deploy/box/hosting_parts.rb +27 -12
- data/lib/hecks/projections/deploy/box/logging.rb +2 -3
- data/lib/hecks/projections/deploy/box/roll_recipe.rb +1 -3
- data/lib/hecks/projections/deploy/box/roll_scripts.rb +1 -16
- data/lib/hecks/projections/deploy/box/settings/containers.rb +29 -15
- data/lib/hecks/projections/deploy/box/settings/patterns.rb +5 -6
- data/lib/hecks/projections/deploy/box/settings/types.rb +5 -10
- data/lib/hecks/projections/deploy/box/settings.rb +9 -8
- data/lib/hecks/projections/deploy/box/stack_yaml.rb +10 -14
- data/lib/hecks/projections/deploy/box/templates/box.yaml.tmpl +0 -1
- data/lib/hecks/projections/deploy/box/templates/deploy-service.sh.tmpl +16 -3
- data/lib/hecks/projections/deploy/box/templates/hosting.mk.tmpl +7 -6
- data/lib/hecks/projections/deploy/box/templates/render-compose-taskdef.sh.tmpl +2 -6
- data/lib/hecks/projections/deploy/box/templates/render-compose.sh.tmpl +2 -6
- data/lib/hecks/projections/deploy/box.rb +16 -9
- data/lib/hecks/projections/deploy/fargate/assembly.rb +7 -2
- data/lib/hecks/projections/deploy/fargate/cdn/options.rb +4 -1
- data/lib/hecks/projections/deploy/fargate/check.rb +3 -1
- data/lib/hecks/projections/deploy/fargate/containers/rendering.rb +8 -5
- data/lib/hecks/projections/deploy/fargate/containers/routing.rb +2 -1
- data/lib/hecks/projections/deploy/fargate/monitoring/reading.rb +4 -1
- data/lib/hecks/projections/deploy/fargate/sections.rb +7 -4
- data/lib/hecks/projections/deploy/fargate/settings/ids.rb +4 -1
- data/lib/hecks/projections/deploy/fargate/settings/tuning.rb +13 -4
- data/lib/hecks/projections/deploy/fargate/stack/blocks.rb +6 -1
- data/lib/hecks/projections/deploy/fargate/stack/readers.rb +2 -1
- data/lib/hecks/projections/deploy/fargate/stack.rb +11 -6
- data/lib/hecks/projections/deploy/fargate/yaml.rb +10 -3
- data/lib/hecks/projections/deploy/fargate.rb +8 -3
- data/lib/hecks/projections/deploy/lambda/stack/blocks.rb +4 -2
- data/lib/hecks/projections/deploy/lambda/stack/deploy_chain.rb +2 -1
- data/lib/hecks/projections/deploy/lambda/stack/reading.rb +12 -9
- data/lib/hecks/projections/deploy/lambda/stack/reading_web.rb +7 -2
- data/lib/hecks/projections/deploy/lambda/stack/web.rb +2 -1
- data/lib/hecks/projections/deploy/lambda.rb +8 -3
- data/lib/hecks/projections/deploy/preview/containers.rb +14 -1
- data/lib/hecks/projections/deploy/preview/preview.sh.erb +2 -2
- data/lib/hecks/projections/deploy/preview/routing_yaml.rb +8 -6
- data/lib/hecks/projections/deploy/preview/settings.rb +23 -5
- data/lib/hecks/projections/deploy/preview/task_yaml.rb +1 -1
- data/lib/hecks/projections/deploy/preview/yaml_text.rb +2 -1
- data/lib/hecks/projections/deploy/scripts/settings.rb +5 -2
- data/lib/hecks/projections/deploy/shared.rb +12 -1
- data/lib/hecks/projections/deploy/shared_database_instance.rb +1 -1
- data/lib/hecks/projections/deploy/smoke.rb +3 -1
- data/lib/hecks/projections/deploy/template_diff/normalizer.rb +4 -1
- data/lib/hecks/projections/deploy/templates/lambda/mint_era_shared.tmpl +2 -2
- data/lib/hecks/projections/deploy/templates/lambda/nat_comment_oauth.tmpl +1 -1
- data/lib/hecks/projections/deploy/vercel.rb +1 -1
- data/lib/hecks/projections/diagrams/dispatch.rb +5 -3
- data/lib/hecks/projections/diagrams/statecharts.rb +8 -3
- data/lib/hecks/projections/diagrams/structure.rb +9 -6
- data/lib/hecks/projections/diagrams.rb +9 -7
- data/lib/hecks/projections/glossary/entries.rb +4 -4
- data/lib/hecks/projections/glossary/html/page.rb +4 -1
- data/lib/hecks/projections/glossary/html/parser.rb +13 -4
- data/lib/hecks/projections/glossary/html/sections.rb +4 -1
- data/lib/hecks/projections/glossary/html.rb +10 -3
- data/lib/hecks/projections/glossary/markdown.rb +4 -3
- data/lib/hecks/projections/glossary/mermaid.rb +8 -5
- data/lib/hecks/projections/glossary/sections.rb +1 -1
- data/lib/hecks/projections/glossary/sensitivity.rb +11 -4
- data/lib/hecks/projections/glossary/sentences/actions.rb +5 -2
- data/lib/hecks/projections/glossary/sentences/queries.rb +2 -1
- data/lib/hecks/projections/glossary/sentences/value_objects.rb +15 -6
- data/lib/hecks/projections/glossary/sentences.rb +6 -3
- data/lib/hecks/projections/glossary/slugs.rb +8 -1
- data/lib/hecks/projections/glossary.rb +3 -3
- data/lib/hecks/projections/model.rb +10 -6
- data/lib/hecks/projections/oidc.rb +19 -7
- data/lib/hecks/projections/parser_table.rb +10 -10
- data/lib/hecks/projections/phrase_table.rb +105 -0
- data/lib/hecks/projections/plain_english.rb +14 -4
- data/lib/hecks/projections/rails_app.rb +77 -0
- data/lib/hecks/projections/reference.rb +2 -2
- data/lib/hecks/projections/rust_vocabulary/arguments.rb +1 -1
- data/lib/hecks/projections/rust_vocabulary/tables.rb +20 -0
- data/lib/hecks/projections/rust_vocabulary.rb +14 -17
- data/lib/hecks/projections/site/admin.rb +7 -7
- data/lib/hecks/projections/site/admin_cms.rb +1 -1
- data/lib/hecks/projections/site/cms_editor/blocks.rb +5 -2
- data/lib/hecks/projections/site/cms_editor/checks.rb +9 -6
- data/lib/hecks/projections/site/cms_editor/color.rb +4 -1
- data/lib/hecks/projections/site/cms_editor/composition.rb +20 -18
- data/lib/hecks/projections/site/cms_editor/destructive.rb +4 -1
- data/lib/hecks/projections/site/cms_editor/drafts.rb +6 -2
- data/lib/hecks/projections/site/cms_editor/key_kinds.rb +4 -1
- data/lib/hecks/projections/site/cms_editor/limits.rb +1 -1
- data/lib/hecks/projections/site/cms_editor/media.rb +1 -1
- data/lib/hecks/projections/site/cms_editor/moment.rb +3 -1
- data/lib/hecks/projections/site/cms_editor/pickers.rb +1 -1
- data/lib/hecks/projections/site/cms_editor/preview.rb +10 -4
- data/lib/hecks/projections/site/cms_editor/relations.rb +3 -2
- data/lib/hecks/projections/site/cms_editor/scale_checks.rb +32 -25
- data/lib/hecks/projections/site/cms_editor/scheduling.rb +1 -1
- data/lib/hecks/projections/site/cms_editor/schema.rb +31 -29
- data/lib/hecks/projections/site/cms_editor/setting.rb +34 -27
- data/lib/hecks/projections/site/cms_editor/targets.rb +9 -6
- data/lib/hecks/projections/site/cms_editor/templates/src/app.ts.tmpl +3 -3
- data/lib/hecks/projections/site/cms_editor/templates/src/commands.ts.tmpl +2 -2
- data/lib/hecks/projections/site/cms_editor/templates/src/host.ts.tmpl +8 -3
- data/lib/hecks/projections/site/cms_editor/templates/src/media/handler.ts.tmpl +4 -4
- data/lib/hecks/projections/site/cms_editor/templates/src/names.ts.tmpl +14 -14
- data/lib/hecks/projections/site/cms_editor/templates/src/schema.ts.tmpl +12 -12
- data/lib/hecks/projections/site/cms_editor/templates/src/ui/pages.ts.tmpl +12 -12
- data/lib/hecks/projections/site/cms_editor/templates/src/ui/pickers.ts.tmpl +1 -1
- data/lib/hecks/projections/site/cms_editor/templates/src/ui/schedule.ts.tmpl +2 -2
- data/lib/hecks/projections/site/cms_editor/templates/src/ui/shell.ts.tmpl +11 -11
- data/lib/hecks/projections/site/cms_editor/templates/src/ui/world.ts.tmpl +3 -3
- data/lib/hecks/projections/site/cms_editor/theme_checks.rb +8 -2
- data/lib/hecks/projections/site/cms_editor.rb +19 -16
- data/lib/hecks/projections/site/edge/checks.rb +1 -1
- data/lib/hecks/projections/site/edge/function_checks.rb +1 -1
- data/lib/hecks/projections/site/edge/function_code.rb +4 -1
- data/lib/hecks/projections/site/edge/pattern.rb +4 -1
- data/lib/hecks/projections/site/edge/route_checks.rb +2 -2
- data/lib/hecks/projections/site/edge/rules.rb +1 -1
- data/lib/hecks/projections/site/edge.rb +14 -8
- data/lib/hecks/projections/site/live_edge.rb +2 -2
- data/lib/hecks/projections/site/payload/fields/definitions.rb +1 -1
- data/lib/hecks/projections/site/payload/lifecycle/text.rb +1 -1
- data/lib/hecks/projections/site/payload/model.rb +16 -12
- data/lib/hecks/projections/site/payload/specs.rb +4 -2
- data/lib/hecks/projections/site/payload_driver.rb +9 -8
- data/lib/hecks/projections/site/probe.rb +12 -3
- data/lib/hecks/projections/site/regions.rb +9 -1
- data/lib/hecks/projections/site/role_probe.rb +7 -7
- data/lib/hecks/projections/site/root_rows.rb +4 -4
- data/lib/hecks/projections/site/routes_ts/listings.rb +13 -6
- data/lib/hecks/projections/site/routes_ts.rb +6 -3
- data/lib/hecks/projections/site/site_admin.rb +1 -1
- data/lib/hecks/projections/site/site_cdn.rb +3 -2
- data/lib/hecks/projections/site/site_host.rb +1 -1
- data/lib/hecks/projections/site/site_root.rb +4 -4
- data/lib/hecks/projections/site/table/checks.rb +4 -1
- data/lib/hecks/projections/site/table/navigation_checks.rb +2 -2
- data/lib/hecks/projections/site/table/row_builder.rb +7 -7
- data/lib/hecks/projections/site/table/row_defaults.rb +1 -1
- data/lib/hecks/projections/site/table.rb +32 -26
- data/lib/hecks/projections/statements/actions.rb +4 -1
- data/lib/hecks/projections/statements/relationships.rb +15 -2
- data/lib/hecks/projections/statements.rb +2 -2
- data/lib/hecks/projections/vocabulary.rb +6 -6
- data/lib/hecks/projections/world_skeleton.rb +68 -0
- data/lib/hecks/projections.rb +5 -0
- data/lib/hecks/projector/cli_audience.rb +12 -9
- data/lib/hecks/projector/cli_projector/claims.rb +8 -8
- data/lib/hecks/projector/cli_projector/command_specs.rb +9 -5
- data/lib/hecks/projector/cli_projector/listing.rb +20 -8
- data/lib/hecks/projector/cli_projector/option_specs.rb +1 -1
- data/lib/hecks/projector/cli_projector/query_specs.rb +1 -1
- data/lib/hecks/projector/cli_projector/usage.rb +12 -8
- data/lib/hecks/projector/cli_projector.rb +2 -2
- data/lib/hecks/projector/docs_projector/behaviour.rb +5 -4
- data/lib/hecks/projector/docs_projector/closing.rb +3 -3
- data/lib/hecks/projector/docs_projector.rb +12 -7
- data/lib/hecks/projector/exporter/adapters.rb +15 -2
- data/lib/hecks/projector/exporter/bindings.rb +39 -134
- data/lib/hecks/projector/exporter/plugins.rb +55 -0
- data/lib/hecks/projector/exporter.rb +2 -0
- data/lib/hecks/projector/narrate_projector/commands.rb +4 -3
- data/lib/hecks/projector/narrate_projector/reactions.rb +2 -2
- data/lib/hecks/projector/narrate_projector.rb +9 -8
- data/lib/hecks/projector/target.rb +8 -8
- data/lib/hecks/projector.rb +9 -9
- data/lib/hecks/quality_control/adapters/agent.rb +2 -1
- data/lib/hecks/quality_control/adapters/github_checks.adapter +1 -1
- data/lib/hecks/quality_control/adapters/github_issues.adapter +1 -1
- data/lib/hecks/quality_control/adapters/github_issues.rb +6 -2
- data/lib/hecks/quality_control/adapters/target_tools.rb +9 -3
- data/lib/hecks/quality_control/cli/child.rb +1 -0
- data/lib/hecks/quality_control/cli/qa_domain_novelty/verdict.rb +1 -1
- data/lib/hecks/quality_control/cli/qa_generated_domains/evaluation.rb +12 -2
- data/lib/hecks/quality_control/cli/qa_generated_domains/promotion.rb +4 -1
- data/lib/hecks/quality_control/cli/qa_generated_domains.rb +4 -1
- data/lib/hecks/quality_control/cli/qa_log_bug/proof.rb +16 -3
- data/lib/hecks/quality_control/cli/qa_mine_combinations/booting.rb +4 -2
- data/lib/hecks/quality_control/cli/qa_mutate.rb +161 -0
- data/lib/hecks/quality_control/cli/qa_sweep/all_mode/report.rb +4 -1
- data/lib/hecks/quality_control/cli/qa_sweep/parsing.rb +2 -1
- data/lib/hecks/quality_control/cli/qa_sweep.rb +4 -1
- data/lib/hecks/quality_control/cli/qa_tick/output.rb +28 -26
- data/lib/hecks/quality_control/cli/qa_tick/preflight.rb +12 -3
- data/lib/hecks/quality_control/cli/qa_tick.rb +24 -8
- data/lib/hecks/quality_control/quality_control.bluebook +93 -92
- data/lib/hecks/quality_control/quality_control.hecksagon +3 -3
- data/lib/hecks/quality_control/quality_control.ports.hecksagon +3 -2
- data/lib/hecks/query_ir/rules.rb +9 -9
- data/lib/hecks/query_ir/touchpoints.rb +5 -2
- data/lib/hecks/query_ir.rb +3 -3
- data/lib/hecks/query_specification/common/comparison.rb +1 -1
- data/lib/hecks/query_specification/common/dsl.rb +3 -4
- data/lib/hecks/query_specification/hop_path.rb +7 -4
- data/lib/hecks/rails_app/bluebook/rails_app.bluebook +60 -0
- data/lib/hecks/rails_app/bluebook/rails_app.hecksagon +4 -0
- data/lib/hecks/refused.rb +104 -0
- data/lib/hecks/release/approval.rb +9 -2
- data/lib/hecks/release/gem_pin.rb +7 -3
- data/lib/hecks/release/lane.rb +1 -1
- data/lib/hecks/release/runner/clean_tree.rb +4 -1
- data/lib/hecks/release/runner/console.rb +2 -1
- data/lib/hecks/router/aggregate_reader.rb +3 -4
- data/lib/hecks/router/namespace_installer.rb +31 -17
- data/lib/hecks/router.rb +2 -10
- data/lib/hecks/runtime/adapter_lookup.rb +30 -7
- data/lib/hecks/runtime/adapter_namespace.rb +21 -0
- data/lib/hecks/runtime/asking.rb +30 -0
- data/lib/hecks/runtime/caller.rb +22 -0
- data/lib/hecks/runtime/capability_graph.rb +2 -1
- data/lib/hecks/runtime/collecting.rb +86 -0
- data/lib/hecks/runtime/command_interpreter/argument_gate.rb +13 -8
- data/lib/hecks/runtime/command_interpreter/delegation.rb +46 -17
- data/lib/hecks/runtime/command_interpreter/hydration.rb +17 -21
- data/lib/hecks/runtime/command_interpreter/list_mutations.rb +2 -1
- data/lib/hecks/runtime/command_interpreter/persisting.rb +13 -12
- data/lib/hecks/runtime/command_interpreter.rb +17 -10
- data/lib/hecks/runtime/command_rules/admissibility.rb +17 -10
- data/lib/hecks/runtime/command_rules/authorization.rb +8 -6
- data/lib/hecks/runtime/command_rules/guard_state.rb +10 -10
- data/lib/hecks/runtime/command_rules/invariants.rb +3 -1
- data/lib/hecks/runtime/command_rules/missing_reference.rb +25 -0
- data/lib/hecks/runtime/command_rules/one_of_references.rb +44 -0
- data/lib/hecks/runtime/command_rules/references.rb +14 -14
- data/lib/hecks/runtime/command_rules.rb +2 -0
- data/lib/hecks/runtime/declarations.rb +66 -0
- data/lib/hecks/runtime/dependency_planning/analyzer.rb +2 -1
- data/lib/hecks/runtime/dependency_planning/expression_reads.rb +3 -2
- data/lib/hecks/runtime/dependency_planning/mutation_analysis.rb +2 -1
- data/lib/hecks/runtime/dispatch_claim.rb +72 -0
- data/lib/hecks/runtime/dispatch_context.rb +41 -0
- data/lib/hecks/runtime/dispatcher/queries.rb +17 -0
- data/lib/hecks/runtime/dispatcher/routing.rb +34 -12
- data/lib/hecks/runtime/dispatcher/validating.rb +73 -0
- data/lib/hecks/runtime/dispatcher.rb +39 -23
- data/lib/hecks/runtime/entity_element/location.rb +15 -7
- data/lib/hecks/runtime/entity_element/mutations.rb +4 -1
- data/lib/hecks/runtime/entity_interpreter/enforcement.rb +1 -1
- data/lib/hecks/runtime/entity_interpreter/locating.rb +1 -1
- data/lib/hecks/runtime/entity_interpreter/saving.rb +5 -5
- data/lib/hecks/runtime/entity_interpreter.rb +11 -4
- data/lib/hecks/runtime/errors.rb +30 -17
- data/lib/hecks/runtime/identity.rb +9 -0
- data/lib/hecks/runtime/instance.rb +3 -2
- data/lib/hecks/runtime/interpreting.rb +63 -6
- data/lib/hecks/runtime/invocation_builder.rb +7 -4
- data/lib/hecks/runtime/invocation_facts.rb +13 -8
- data/lib/hecks/runtime/loader/boot_steps.rb +3 -2
- data/lib/hecks/runtime/loader/described.rb +4 -0
- data/lib/hecks/runtime/loader.rb +52 -62
- data/lib/hecks/runtime/outbox/redrive.rb +105 -0
- data/lib/hecks/runtime/outbox/relay.rb +11 -39
- data/lib/hecks/runtime/outbox/runnable.rb +60 -0
- data/lib/hecks/runtime/outbox.rb +15 -1
- data/lib/hecks/runtime/policy_interpreter/arguments.rb +7 -1
- data/lib/hecks/runtime/policy_interpreter/fan_out.rb +8 -35
- data/lib/hecks/runtime/policy_interpreter.rb +8 -0
- data/lib/hecks/runtime/port_operation_interpreter.rb +27 -13
- data/lib/hecks/runtime/query_interpreter/outside_answer.rb +1 -1
- data/lib/hecks/runtime/query_interpreter/paging.rb +42 -0
- data/lib/hecks/runtime/query_interpreter/plugin_answer.rb +54 -0
- data/lib/hecks/runtime/query_interpreter/store_specification.rb +32 -0
- data/lib/hecks/runtime/query_interpreter.rb +16 -9
- data/lib/hecks/runtime/reaction_invocation/target_resolution.rb +10 -4
- data/lib/hecks/runtime/reaction_invocation.rb +5 -2
- data/lib/hecks/runtime/read_model_interpreter/head_ordering.rb +1 -1
- data/lib/hecks/runtime/read_model_interpreter/reductions.rb +23 -15
- data/lib/hecks/runtime/read_model_interpreter/shaping.rb +18 -7
- data/lib/hecks/runtime/read_model_interpreter.rb +5 -2
- data/lib/hecks/runtime/reference_hop.rb +3 -2
- data/lib/hecks/runtime/refusal_wording.rb +15 -6
- data/lib/hecks/runtime/registry/adapter_capabilities.rb +43 -0
- data/lib/hecks/runtime/registry/ask_verification.rb +15 -4
- data/lib/hecks/runtime/registry/{chapter_verification.rb → bluebook_verification.rb} +23 -23
- data/lib/hecks/runtime/registry/context_maps.rb +30 -0
- data/lib/hecks/runtime/registry/declarations.rb +8 -6
- data/lib/hecks/runtime/registry/durability_warnings.rb +18 -2
- data/lib/hecks/runtime/registry/hecksagon_rules.rb +27 -24
- data/lib/hecks/runtime/registry/plugin_query_verification.rb +45 -0
- data/lib/hecks/runtime/registry/providers.rb +34 -99
- data/lib/hecks/runtime/registry/query_verification.rb +30 -21
- data/lib/hecks/runtime/registry/runtime_state.rb +4 -3
- data/lib/hecks/runtime/registry/saga_persistence.rb +7 -16
- data/lib/hecks/runtime/registry/verification.rb +9 -5
- data/lib/hecks/runtime/registry/world_defaults.rb +8 -5
- data/lib/hecks/runtime/registry.rb +52 -27
- data/lib/hecks/runtime/row_sweep.rb +104 -0
- data/lib/hecks/runtime/saga_interpreter/compensation.rb +5 -4
- data/lib/hecks/runtime/saga_interpreter/delivery.rb +13 -10
- data/lib/hecks/runtime/saga_interpreter/redrive.rb +141 -0
- data/lib/hecks/runtime/saga_interpreter/transitions.rb +35 -6
- data/lib/hecks/runtime/saga_interpreter.rb +36 -4
- data/lib/hecks/runtime/saga_pending_dispatch.rb +4 -2
- data/lib/hecks/runtime/scalar_field.rb +73 -0
- data/lib/hecks/runtime/tenant_scope.rb +2 -1
- data/lib/hecks/runtime/validation.rb +24 -0
- data/lib/hecks/runtime/value/admission.rb +11 -11
- data/lib/hecks/runtime/value/coercion.rb +7 -7
- data/lib/hecks/runtime/value/field_checks.rb +13 -13
- data/lib/hecks/runtime/value/invariant_violation.rb +4 -1
- data/lib/hecks/runtime/value/references.rb +7 -4
- data/lib/hecks/runtime/value/unwrapping.rb +60 -0
- data/lib/hecks/runtime/value/validation.rb +7 -4
- data/lib/hecks/runtime/value.rb +3 -27
- data/lib/hecks/runtime/wasm_plugin.rb +98 -0
- data/lib/hecks/runtime.rb +14 -14
- data/lib/hecks/rust_build/command_schemas.rb +27 -0
- data/lib/hecks/rust_build/conformance/surface.rb +50 -7
- data/lib/hecks/rust_build/conformance.rb +25 -3
- data/lib/hecks/rust_build/conformance_fuzz.rb +2 -2
- data/lib/hecks/rust_build/domain_name.rb +4 -1
- data/lib/hecks/rust_build/host.rb +15 -9
- data/lib/hecks/rust_build/native_build.rb +2 -1
- data/lib/hecks/rust_build/prebuilt_binary.rb +25 -5
- data/lib/hecks/rust_build/project_rust/codegen_run.rb +11 -10
- data/lib/hecks/rust_build/project_rust/domain_loader.rb +15 -2
- data/lib/hecks/rust_build/project_rust/root_mod/notes.rb +1 -1
- data/lib/hecks/rust_build/project_rust/target_ir.rb +12 -3
- data/lib/hecks/rust_build/project_rust.rb +39 -19
- data/lib/hecks/rust_build/target_dir.rb +40 -0
- data/lib/hecks/rust_build/wasm.rb +46 -17
- data/lib/hecks/rust_build/wasm_browser.rb +8 -2
- data/lib/hecks/rust_build.rb +29 -2
- data/lib/hecks/sentence_form.rb +212 -0
- data/lib/hecks/served_options.rb +2 -1
- data/lib/hecks/shape_ledger.rb +149 -0
- data/lib/hecks/site/bluebook/site.bluebook +39 -62
- data/lib/hecks/site/bluebook/site.ports.hecksagon +1 -1
- data/lib/hecks/sme/bluebook/sme.bluebook +7 -1
- data/lib/hecks/storehouse/audit.rb +4 -1
- data/lib/hecks/storehouse/bluebook_words.rb +35 -0
- data/lib/hecks/storehouse/dispatching.rb +6 -3
- data/lib/hecks/storehouse/introspection.rb +4 -4
- data/lib/hecks/storehouse/querying.rb +2 -2
- data/lib/hecks/storehouse.rb +14 -4
- data/lib/hecks/switches.rb +21 -0
- data/lib/hecks/tenancy/bluebook/tenancy.bluebook +5 -9
- data/lib/hecks/text.rb +57 -0
- data/lib/hecks/tickets/bluebook/tickets.bluebook +30 -51
- data/lib/hecks/tickets/bluebook/tickets.hecksagon +1 -1
- data/lib/hecks/tickets/bluebook/tickets.ports.hecksagon +1 -1
- data/lib/hecks/tools/argument_gate_matrix/dispatching.rb +1 -1
- data/lib/hecks/tools/argument_gate_matrix/rows.rb +7 -7
- data/lib/hecks/tools/argument_gate_matrix/violations.rb +1 -1
- data/lib/hecks/tools/argument_gate_matrix.rb +3 -3
- data/lib/hecks/tools/ci_gate_decision.rb +5 -2
- data/lib/hecks/tools/ci_gates.rb +1 -1
- data/lib/hecks/tools/comment_style/caps_words.rb +11 -8
- data/lib/hecks/tools/comment_style/dictionary.rb +7 -2
- data/lib/hecks/tools/comment_style/fixing.rb +10 -5
- data/lib/hecks/tools/comment_style/long_blocks.rb +1 -1
- data/lib/hecks/tools/comment_style/masking.rb +5 -5
- data/lib/hecks/tools/comment_style/run.rb +4 -1
- data/lib/hecks/tools/comment_style/source_file.rb +10 -3
- data/lib/hecks/tools/comment_style/structure_checks.rb +13 -4
- data/lib/hecks/tools/comment_style/text_checks.rb +1 -1
- data/lib/hecks/tools/comment_style.rb +25 -2
- data/lib/hecks/tools/deploy_recipe/generation.rb +1 -1
- data/lib/hecks/tools/deploy_recipe/targets.rb +1 -1
- data/lib/hecks/tools/deploy_recipe/worlds.rb +15 -9
- data/lib/hecks/tools/deploy_recipe.rb +17 -10
- data/lib/hecks/tools/deploy_recipe_lint/fixtures.rb +1 -1
- data/lib/hecks/tools/deploy_recipe_lint/makefile.rb +7 -1
- data/lib/hecks/tools/drop_implicit_append_fields.rb +4 -1
- data/lib/hecks/tools/era_projection_backfill.rb +11 -6
- data/lib/hecks/tools/era_reattest.rb +11 -6
- data/lib/hecks/tools/fuzz_sweep/findings.rb +18 -2
- data/lib/hecks/tools/fuzz_sweep/options.rb +5 -1
- data/lib/hecks/tools/fuzz_sweep.rb +17 -5
- data/lib/hecks/tools/gate.rb +27 -5
- data/lib/hecks/tools/hoist_local_givens/rewriting.rb +3 -2
- data/lib/hecks/tools/hoist_local_givens.rb +2 -4
- data/lib/hecks/tools/lanes/prebuilt_workflow.rb +1 -1
- data/lib/hecks/tools/lanes/rows.rb +9 -3
- data/lib/hecks/tools/lanes/ruleset.rb +1 -1
- data/lib/hecks/tools/lanes/watch_workflow.rb +1 -1
- data/lib/hecks/tools/lanes/workflow.rb +1 -1
- data/lib/hecks/tools/lanes.rb +1 -1
- data/lib/hecks/tools/oidc_manifests.rb +16 -19
- data/lib/hecks/tools/regeneration_run.rb +22 -17
- data/lib/hecks/tools/release_only.rb +5 -2
- data/lib/hecks/tools/rust_comment_style/caps_words.rb +5 -5
- data/lib/hecks/tools/rust_comment_style/fixing.rb +1 -1
- data/lib/hecks/tools/rust_comment_style/masking.rb +7 -4
- data/lib/hecks/tools/rust_comment_style/source_file.rb +7 -2
- data/lib/hecks/tools/rust_comment_style/text_checks.rb +1 -1
- data/lib/hecks/tools/rust_comment_style/tokenizer.rb +4 -1
- data/lib/hecks/tools/site_routes/editor_files.rb +16 -13
- data/lib/hecks/tools/site_routes/root_files.rb +14 -13
- data/lib/hecks/tools/site_routes/templates.rb +5 -4
- data/lib/hecks/tools/site_routes.rb +18 -15
- data/lib/hecks/tools/tail_merge.rb +3 -3
- data/lib/hecks/tools/tenant_provisioning.rb +6 -6
- data/lib/hecks/tools/tools_doc.rb +16 -16
- data/lib/hecks/tools/translation_audit/domain_loading.rb +3 -3
- data/lib/hecks/tools/translation_audit.rb +15 -4
- data/lib/hecks/tools/translation_scaffold/reporting.rb +4 -1
- data/lib/hecks/tools/translation_scaffold.rb +4 -14
- data/lib/hecks/vendoring/git_source.rb +7 -4
- data/lib/hecks/version.rb +1 -1
- data/lib/hecks/vocabulary.rb +110 -3
- data/lib/hecks.rb +37 -18
- data/lib/rubocop/cop/hecks/inline_regexp.rb +29 -0
- data/lib/rubocop/cop/hecks/no_transport_in_runtime.rb +78 -0
- data/lib/rubocop/cop/hecks/rails_model_rules.rb +46 -0
- data/lib/rubocop/cop/hecks/thread_shared_ivar_mutation.rb +1 -1
- data/lib/rubocop/cop/hecks/train_wreck.rb +69 -0
- data/lib/rubocop/cop/hecks/unnamed_pipeline.rb +51 -0
- data/prebuilt/31cf81e12f16236ad26249be590cfea3799c9db67432e6a4ef54b801c355b6ae.marshal +0 -0
- data/prebuilt/68ecb2bd3abb1a221007db4f2b0375834c13aaccac8f2b99778e8517f11aa113.marshal +0 -0
- data/prebuilt/verdicts-0328c2403383837d780ad5ed81d1da351c56436b894cf9015b5d56b8f1f1bf10.json +1 -0
- data/qa/settings.yml +9 -0
- data/rust/Cargo.lock +8 -1
- data/rust/Cargo.toml +6 -7
- data/rust/build/src/binding_pass.rs +13 -17
- data/rust/build/src/cargo_sync.rs +1 -1
- data/rust/build/src/lineage_pass.rs +4 -71
- data/rust/build/src/pipeline.rs +99 -70
- data/rust/build/src/resolve.rs +85 -29
- data/rust/build/src/seams_pass.rs +117 -99
- data/rust/build/src/world_pass.rs +21 -12
- data/rust/codegen/src/domain_generator.rs +30 -2
- data/rust/codegen/src/expr_emitter.rs +6 -0
- data/rust/codegen/src/json_codec.rs +48 -10
- data/rust/codegen/src/main.rs +41 -34
- data/rust/codegen/src/manifest.rs +1 -1
- data/rust/codegen/src/naming.rs +5 -5
- data/rust/codegen/src/one_of_references.rs +124 -0
- data/rust/codegen/src/presenters.rs +335 -0
- data/rust/codegen/src/queries.rs +56 -7
- data/rust/codegen/src/reactions.rs +19 -14
- data/rust/codegen/src/read_models.rs +20 -71
- data/rust/codegen/src/registry.rs +89 -15
- data/rust/codegen/src/sidecars.rs +1 -1
- data/rust/expr/Cargo.lock +54 -0
- data/rust/expr/Cargo.toml +52 -0
- data/rust/{src/kernel → expr/src}/attribute_shapes/composite.rs +45 -14
- data/rust/{src/kernel → expr/src}/attribute_shapes/list.rs +1 -1
- data/rust/{src/kernel → expr/src}/attribute_shapes/mod.rs +2 -2
- data/rust/{src/kernel → expr/src}/attribute_shapes/optional.rs +1 -1
- data/rust/{src/kernel → expr/src}/attribute_shapes/scalar.rs +3 -3
- data/rust/{src/kernel → expr/src}/expr.rs +30 -8
- data/rust/{src/kernel → expr/src}/expression_operators/arithmetic.rs +41 -18
- data/rust/{src/kernel → expr/src}/expression_operators/comparison.rs +54 -8
- data/rust/{src/kernel → expr/src}/expression_operators/enumeration.rs +73 -6
- data/rust/{src/kernel → expr/src}/expression_operators/logical.rs +2 -2
- data/rust/expr/src/expression_operators/membership.rs +33 -0
- data/rust/{src/kernel → expr/src}/expression_operators/mod.rs +2 -2
- data/rust/expr/src/expression_operators/pattern_match.rs +179 -0
- data/rust/{src/kernel → expr/src}/expression_operators/positional.rs +8 -6
- data/rust/{src/kernel → expr/src}/expression_operators/presence.rs +7 -6
- data/rust/{src/kernel → expr/src}/expression_operators/sign_test.rs +14 -4
- data/rust/{src/kernel → expr/src}/expression_operators/sized.rs +16 -9
- data/rust/{src/kernel → expr/src}/expression_operators/text.rs +30 -17
- data/rust/{src/kernel → expr/src}/expression_operators/to_string.rs +8 -6
- data/rust/expr/src/lib.rs +17 -0
- data/rust/expr/src/refusal.rs +62 -0
- data/rust/expr/src/rendering.rs +135 -0
- data/rust/{src/kernel → expr/src}/ruby_float.rs +7 -6
- data/rust/host/Cargo.lock +137 -123
- data/rust/host/Cargo.toml +7 -3
- data/rust/host/HECKS_RELEASE +1 -1
- data/rust/host/core/Cargo.toml +64 -0
- data/rust/host/core/clippy.toml +4 -0
- data/rust/host/core/src/arg_limits.rs +48 -0
- data/rust/host/core/src/clock.rs +146 -0
- data/rust/host/core/src/dispatch.rs +920 -0
- data/rust/host/core/src/expr_json.rs +1137 -0
- data/rust/host/{src → core/src}/host.rs +13 -14
- data/rust/host/{src → core/src}/ir.rs +227 -18
- data/rust/host/core/src/journal.rs +126 -0
- data/rust/host/{src → core/src}/lambda_client.rs +27 -96
- data/rust/host/core/src/lib.rs +37 -0
- data/rust/host/{src → core/src}/needs.rs +66 -20
- data/rust/host/core/src/plugins.rs +269 -0
- data/rust/host/core/src/presentation.rs +471 -0
- data/rust/host/{src → core/src}/presentation_write.rs +75 -43
- data/rust/host/{src → core/src}/query_step.rs +54 -16
- data/rust/host/{src → core/src}/reference_validate.rs +6 -6
- data/rust/host/{src → core/src}/storage_shape.rs +2 -2
- data/rust/host/core/src/store/memory.rs +635 -0
- data/rust/host/core/src/store.rs +418 -0
- data/rust/host/{src → core/src}/ui_schema.rs +8 -8
- data/rust/host/core/src/validation.rs +129 -0
- data/rust/host/core/src/wasm_runner.rs +410 -0
- data/rust/host/fuzz/.gitignore +4 -0
- data/rust/host/fuzz/Cargo.lock +4479 -0
- data/rust/host/fuzz/Cargo.toml +42 -0
- data/rust/host/fuzz/README.md +55 -0
- data/rust/host/fuzz/fuzz_targets/postgres_equivalence.rs +24 -0
- data/rust/host/fuzz/src/backend.rs +273 -0
- data/rust/host/fuzz/src/equivalence.rs +195 -0
- data/rust/host/fuzz/src/footprint.rs +182 -0
- data/rust/host/fuzz/src/lib.rs +17 -0
- data/rust/host/fuzz/src/ops.rs +345 -0
- data/rust/host/fuzz/tests/smoke.rs +50 -0
- data/rust/host/src/api.rs +316 -105
- data/rust/host/src/auth/google_signin.rs +183 -0
- data/rust/host/src/auth.rs +527 -370
- data/rust/host/src/aws_lambda_invoker.rs +61 -0
- data/rust/host/src/bin/expr_harness.rs +9 -4
- data/rust/host/src/bin/ledger.rs +84 -0
- data/rust/host/src/bin/lineage_harness.rs +17 -21
- data/rust/host/src/bin/mint_harness.rs +11 -36
- data/rust/host/src/bin/validate_harness.rs +1 -6
- data/rust/host/src/boot.rs +465 -174
- data/rust/host/src/boundary_fuzz/ir.rs +10 -5
- data/rust/host/src/boundary_fuzz/server.rs +6 -5
- data/rust/host/src/checkout.rs +4 -1
- data/rust/host/src/commerce_ir.rs +126 -105
- data/rust/host/src/{dispatch.rs → dispatch_tests.rs} +391 -824
- data/rust/host/src/extension.rs +3 -4
- data/rust/host/src/hecksagon_boundary_tests.rs +149 -0
- data/rust/host/src/ledger.rs +683 -0
- data/rust/host/src/lib.rs +21 -28
- data/rust/host/src/payments/tests.rs +136 -38
- data/rust/host/src/payments.rs +36 -32
- data/rust/host/src/platform_signin/extension.rs +1 -1
- data/rust/host/src/platform_signin/mapping_tests.rs +12 -9
- data/rust/host/src/platform_signin/session.rs +7 -14
- data/rust/host/src/platform_signin/verify.rs +0 -2
- data/rust/host/src/presentation_tests.rs +382 -0
- data/rust/host/src/rate_limit.rs +18 -2
- data/rust/host/src/server.rs +287 -36
- data/rust/host/src/{journal.rs → store/journal_sql.rs} +21 -127
- data/rust/host/src/{mint.rs → store/mint.rs} +12 -12
- data/rust/host/src/store/postgres.rs +493 -0
- data/rust/host/src/store.rs +97 -0
- data/rust/host/src/store_conformance.rs +1265 -0
- data/rust/host/src/web/commerce.rs +10 -18
- data/rust/host/src/web/newsletter/cooldown.rs +107 -22
- data/rust/host/src/web/newsletter/naming.rs +104 -0
- data/rust/host/src/web/newsletter/tests.rs +53 -0
- data/rust/host/src/web/newsletter.rs +73 -50
- data/rust/host/src/web/newsletter_send.rs +12 -13
- data/rust/host/src/web/registration_receipt.rs +2 -2
- data/rust/host/src/web/registrations.rs +754 -375
- data/rust/host/src/web/resend_webhook.rs +3 -3
- data/rust/host/src/web/signin_tests.rs +131 -0
- data/rust/host/src/web.rs +1479 -149
- data/rust/lsp/README.md +27 -27
- data/rust/lsp/src/diagnostics.rs +75 -15
- data/rust/lsp/src/main.rs +101 -5
- data/rust/parser/fuzz/Cargo.toml +2 -2
- data/rust/parser/fuzz/README.md +3 -3
- data/rust/parser/fuzz/fuzz_targets/{chapter.rs → bluebook.rs} +4 -4
- data/rust/parser/fuzz/fuzz_targets/resolve.rs +2 -2
- data/rust/parser/src/build/named_pattern.rs +22 -0
- data/rust/parser/src/build/references.rs +52 -0
- data/rust/parser/src/diag.rs +22 -1
- data/rust/parser/src/emit.rs +68 -4
- data/rust/parser/src/expr/ast_json.rs +10 -0
- data/rust/parser/src/expr/resolver.rs +49 -9
- data/rust/parser/src/ir.rs +34 -7
- data/rust/parser/src/keywords.rs +454 -457
- data/rust/parser/src/lex.rs +115 -87
- data/rust/parser/src/main.rs +180 -32
- data/rust/parser/src/parse/adapter.rs +28 -0
- data/rust/parser/src/parse/aggregate.rs +55 -35
- data/rust/parser/src/parse/command.rs +100 -15
- data/rust/parser/src/parse/{chapter.rs → declaration.rs} +85 -54
- data/rust/parser/src/parse/domain_port.rs +60 -9
- data/rust/parser/src/parse/entity.rs +35 -32
- data/rust/parser/src/parse/file.rs +1 -1
- data/rust/parser/src/parse/hecksagon.rs +15 -5
- data/rust/parser/src/parse/mod.rs +84 -2
- data/rust/parser/src/parse/process_manager.rs +1 -1
- data/rust/parser/src/parse/query.rs +13 -3
- data/rust/parser/src/parse/read_model.rs +2 -1
- data/rust/parser/src/phrases.rs +1258 -0
- data/rust/parser/src/render_ruby.rs +540 -0
- data/rust/parser/src/sentence/changes.rs +437 -0
- data/rust/parser/src/sentence/command_step.rs +206 -0
- data/rust/parser/src/sentence/complete.rs +276 -0
- data/rust/parser/src/sentence/entity.rs +41 -0
- data/rust/parser/src/sentence/examples.rs +1012 -0
- data/rust/parser/src/sentence/format.rs +882 -0
- data/rust/parser/src/sentence/lower.rs +1366 -0
- data/rust/parser/src/sentence/mod.rs +444 -0
- data/rust/parser/src/sentence/names.rs +69 -0
- data/rust/parser/src/sentence/options.rs +154 -0
- data/rust/parser/src/sentence/pattern.rs +433 -0
- data/rust/parser/src/sentence/process.rs +196 -0
- data/rust/parser/src/sentence/queries.rs +431 -0
- data/rust/parser/src/sentence/report.rs +283 -0
- data/rust/parser/src/sentence/token.rs +106 -0
- data/rust/parser/src/sentence/values.rs +498 -0
- data/rust/src/exemplar/queries.rs +1 -0
- data/rust/src/exemplar/reactions.rs +1 -1
- data/rust/src/exemplar/registry.rs +30 -0
- data/rust/src/kernel/cli.rs +233 -20
- data/rust/src/kernel/collecting.rs +174 -0
- data/rust/src/kernel/dispatch.rs +55 -27
- data/rust/src/kernel/json.rs +15 -1
- data/rust/src/kernel/mod.rs +8 -67
- data/rust/src/kernel/named_query.rs +225 -11
- data/rust/src/kernel/orchestrate.rs +213 -25
- data/rust/src/kernel/orchestrate_guard_tests.rs +3 -0
- data/rust/src/kernel/present.rs +261 -0
- data/rust/src/kernel/query_cursor.rs +251 -0
- data/rust/src/kernel/query_ordering.rs +6 -6
- data/rust/src/kernel/read_model.rs +162 -17
- data/rust/src/kernel/repository.rs +107 -17
- data/rust/src/kernel/vocab/mod.rs +4 -0
- data/rust/src/kernel/vocab/reducer.rs +109 -0
- data/rust/src/kernel/vocab/refusal_class.rs +124 -0
- data/rust/src/kernel/vocab/refusal_template.rs +2 -2
- data/rust/src/lib.rs +1 -1
- data/rust/web/Cargo.lock +47 -0
- metadata +331 -93
- data/lib/hecks/chapters.rb +0 -147
- data/lib/hecks/gate/stages.yml +0 -234
- data/lib/hecks/hecks/governance.world +0 -7
- data/lib/hecks/ports/persistence/plugins/era/expected_era.rb +0 -137
- data/lib/hecks/ports/persistence/postgres_dump/connection.rb +0 -59
- data/lib/hecks/ports/persistence/postgres_dump.rb +0 -100
- data/lib/hecks/projections/deploy/box/templates/tunnel-egress.yaml.tmpl +0 -11
- data/lib/hecks/projector/exporter/capability_values.rb +0 -55
- data/lib/hecks/runtime/remote_dispatcher.rb +0 -176
- data/prebuilt/02c09c73b272c1fb5a9ae6d87bb5e5e529208e00f6b4b597dc2c0fd70a9c0964.marshal +0 -0
- data/prebuilt/bb84a835cf6a15136bad5ca03aa5bf93a5b92f5f72444618d3ef2412b987fb32.marshal +0 -0
- data/prebuilt/verdicts-f1f10da14c8e8f01b4c9b7e3e2d74be8cd2bf4676364ed17fa16975d2a076d75.json +0 -1
- data/rust/host/src/clock.rs +0 -8
- data/rust/host/src/expr_json.rs +0 -1983
- data/rust/host/src/presentation.rs +0 -842
- data/rust/host/src/wasm_runner.rs +0 -206
- data/rust/src/kernel/expression_operators/membership.rs +0 -20
- data/rust/src/kernel/expression_operators/pattern_match.rs +0 -108
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/events.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/head_writes.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/journal.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/base_sql.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/field_cache.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/head_compiler.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/merge_writes.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/provisioning.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/resumable_backfill.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/transform_installer.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/lineage/transform_sql.rb +0 -0
- /data/lib/hecks/{ports/persistence/plugins/era → adapters/driven}/postgres_era/sagas.rb +0 -0
- /data/rust/host/{src → core/src}/field_hints.rs +0 -0
- /data/rust/host/{src → core/src}/log.rs +0 -0
- /data/rust/host/{src → core/src}/reference_transform.rs +0 -0
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
//! Ties the journal and the sandbox together: replays history, then the
|
|
2
|
+
//! new step, persisting it only if the module accepts it.
|
|
3
|
+
|
|
4
|
+
use crate::host::Host;
|
|
5
|
+
use crate::journal;
|
|
6
|
+
use crate::lambda_client::{self};
|
|
7
|
+
use crate::store::{Accepted, DeadLetter, LineageWrite, Store};
|
|
8
|
+
use crate::wasm_runner;
|
|
9
|
+
use std::path::Path;
|
|
10
|
+
|
|
11
|
+
pub struct Outcome {
|
|
12
|
+
pub result: serde_json::Value,
|
|
13
|
+
pub accepted: bool,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/// Who a command is dispatched for: the role they state and, when the host knows who they are, the
|
|
17
|
+
/// actor Governance holds assignments for. Both absent is an unidentified caller.
|
|
18
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
19
|
+
pub struct Caller<'a> {
|
|
20
|
+
pub role: Option<&'a str>,
|
|
21
|
+
pub actor_id: Option<&'a str>,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// The role an unidentified caller is dispatched under when roles are enforced: no command declares
|
|
25
|
+
/// it, so a command that declares any role refuses it.
|
|
26
|
+
pub const ANONYMOUS_ROLE: &str = "Anonymous";
|
|
27
|
+
|
|
28
|
+
/// What the host does about the role a command declares (`HECKS_ROLE_ENFORCEMENT`).
|
|
29
|
+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
30
|
+
pub enum Enforcement {
|
|
31
|
+
/// A caller with no role is unchecked, as before.
|
|
32
|
+
Off,
|
|
33
|
+
/// An unidentified or unassigned caller is let through and logged as `would_refuse_role`; a
|
|
34
|
+
/// caller that states a role is checked exactly as under `Enforce`, so shadow never accepts
|
|
35
|
+
/// what `Off` would not.
|
|
36
|
+
Shadow,
|
|
37
|
+
/// An unidentified or unassigned caller is refused.
|
|
38
|
+
Enforce,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static ENFORCEMENT: std::sync::OnceLock<Enforcement> = std::sync::OnceLock::new();
|
|
42
|
+
|
|
43
|
+
impl Enforcement {
|
|
44
|
+
/// Reads `off` (the default), `shadow` or `enforce`; anything else is `Off`.
|
|
45
|
+
pub fn parse(value: Option<&str>) -> Self {
|
|
46
|
+
match value.map(|v| v.trim().to_ascii_lowercase()).as_deref() {
|
|
47
|
+
Some("shadow") => Self::Shadow,
|
|
48
|
+
Some("enforce") => Self::Enforce,
|
|
49
|
+
_ => Self::Off,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/// Fixes the mode for the life of the process; boot calls it with the parsed
|
|
54
|
+
/// `HECKS_ROLE_ENFORCEMENT`. Only the first call has an effect.
|
|
55
|
+
pub fn install(mode: Self) {
|
|
56
|
+
let _ = ENFORCEMENT.set(mode);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// The mode boot installed, or `Off` when none was.
|
|
60
|
+
pub fn configured() -> Self {
|
|
61
|
+
ENFORCEMENT.get().copied().unwrap_or(Self::Off)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// The caller the kernel is asked to check: an unidentified caller becomes the anonymous role
|
|
65
|
+
/// unless enforcement is off.
|
|
66
|
+
pub fn effective(self, caller: Caller<'_>) -> Caller<'_> {
|
|
67
|
+
if self != Self::Off && caller.role.is_none() && caller.actor_id.is_none() {
|
|
68
|
+
return Caller {
|
|
69
|
+
role: Some(ANONYMOUS_ROLE),
|
|
70
|
+
actor_id: None,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
caller
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Where a dispatch comes from. A host-internal dispatch is the host acting on its own behalf (a
|
|
78
|
+
/// signup, a provisioning step, a presentation write); it names no caller and is never subject to
|
|
79
|
+
/// `HECKS_ROLE_ENFORCEMENT`, which guards what callers outside the host may do.
|
|
80
|
+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
81
|
+
pub enum Origin {
|
|
82
|
+
/// A caller the host's internal protocol names, from one of its own peers.
|
|
83
|
+
External,
|
|
84
|
+
/// A signed-in request to the console API or the web UI. Its caller is checked as an
|
|
85
|
+
/// `External` one is, and every fact its command needs is the host's answer, never the
|
|
86
|
+
/// request's.
|
|
87
|
+
Request,
|
|
88
|
+
HostInternal,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/// Whether a dispatch keeps what it does. A preview asks the kernel whether the command would be
|
|
92
|
+
/// accepted and keeps nothing: no journal row, snapshot or saga, no reaction delivered, no log line.
|
|
93
|
+
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
94
|
+
enum Effect {
|
|
95
|
+
Commit,
|
|
96
|
+
Preview,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// Whether the kernel refused the command for the caller's role.
|
|
100
|
+
pub fn refused_for_role(result: &serde_json::Value) -> bool {
|
|
101
|
+
result
|
|
102
|
+
.get("refusals")
|
|
103
|
+
.and_then(|r| r.as_array())
|
|
104
|
+
.is_some_and(|all| {
|
|
105
|
+
all.iter()
|
|
106
|
+
.any(|r| r.get("kind").and_then(|k| k.as_str()) == Some("Unauthorized"))
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Distinguishes a module refusal from a kernel failure to run at all.
|
|
111
|
+
#[derive(Debug, PartialEq, Eq)]
|
|
112
|
+
pub enum KernelAnswer {
|
|
113
|
+
Accepted,
|
|
114
|
+
Refused,
|
|
115
|
+
Failed(String),
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// A run that never started has no `refusals` array at all, so absence of
|
|
119
|
+
// refusals doesn't by itself mean the run succeeded.
|
|
120
|
+
pub fn classify(result: &serde_json::Value) -> KernelAnswer {
|
|
121
|
+
if let Some(error) = result.get("error") {
|
|
122
|
+
return KernelAnswer::Failed(
|
|
123
|
+
error
|
|
124
|
+
.as_str()
|
|
125
|
+
.map_or_else(|| error.to_string(), str::to_string),
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
let refused = result
|
|
129
|
+
.get("refusals")
|
|
130
|
+
.and_then(|r| r.as_array())
|
|
131
|
+
.is_some_and(|r| !r.is_empty());
|
|
132
|
+
if refused {
|
|
133
|
+
KernelAnswer::Refused
|
|
134
|
+
} else {
|
|
135
|
+
KernelAnswer::Accepted
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// A kernel failure becomes `Err`, not a result with no instances read as
|
|
140
|
+
// an empty world.
|
|
141
|
+
pub fn parse_kernel_output(output: &str) -> anyhow::Result<serde_json::Value> {
|
|
142
|
+
let result: serde_json::Value = serde_json::from_str(output)?;
|
|
143
|
+
match classify(&result) {
|
|
144
|
+
KernelAnswer::Failed(message) => {
|
|
145
|
+
anyhow::bail!("the kernel failed before it could run the command: {message}")
|
|
146
|
+
}
|
|
147
|
+
KernelAnswer::Accepted | KernelAnswer::Refused => Ok(result),
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Kept as one opaque object under the journal's `args` column; the kernel
|
|
152
|
+
// unwraps `to`/`with` itself, so this needs no journal schema migration.
|
|
153
|
+
pub fn routed_invocation(
|
|
154
|
+
to: serde_json::Value,
|
|
155
|
+
facts: serde_json::Value,
|
|
156
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
157
|
+
if !facts.is_object() {
|
|
158
|
+
anyhow::bail!("with must be an object of command facts");
|
|
159
|
+
}
|
|
160
|
+
let mut invocation = serde_json::Map::new();
|
|
161
|
+
invocation.insert("to".to_string(), to);
|
|
162
|
+
invocation.insert("with".to_string(), facts);
|
|
163
|
+
Ok(serde_json::Value::Object(invocation))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// No `to` route: used only when a command creates a new aggregate, so
|
|
167
|
+
// there is no receiver yet to route to.
|
|
168
|
+
pub fn facts_invocation(facts: serde_json::Value) -> anyhow::Result<serde_json::Value> {
|
|
169
|
+
if !facts.is_object() {
|
|
170
|
+
anyhow::bail!("with must be an object of command facts");
|
|
171
|
+
}
|
|
172
|
+
let mut invocation = serde_json::Map::new();
|
|
173
|
+
invocation.insert("with".to_string(), facts);
|
|
174
|
+
Ok(serde_json::Value::Object(invocation))
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Route-aware entry point; `handle` below stays the compatibility path
|
|
178
|
+
// for callers still sending the older mixed args shape.
|
|
179
|
+
pub async fn handle_routed(
|
|
180
|
+
host: Host<'_>,
|
|
181
|
+
verb: &str,
|
|
182
|
+
to: serde_json::Value,
|
|
183
|
+
facts: serde_json::Value,
|
|
184
|
+
role: Option<&str>,
|
|
185
|
+
) -> anyhow::Result<Outcome> {
|
|
186
|
+
handle(host, verb, routed_invocation(to, facts)?, role).await
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/// `handle_routed` for a caller the host can name.
|
|
190
|
+
pub async fn handle_routed_as(
|
|
191
|
+
host: Host<'_>,
|
|
192
|
+
verb: &str,
|
|
193
|
+
to: serde_json::Value,
|
|
194
|
+
facts: serde_json::Value,
|
|
195
|
+
caller: Caller<'_>,
|
|
196
|
+
) -> anyhow::Result<Outcome> {
|
|
197
|
+
handle_as(host, verb, routed_invocation(to, facts)?, caller).await
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Facts-only counterpart to `handle_routed`.
|
|
201
|
+
pub async fn handle_facts(
|
|
202
|
+
host: Host<'_>,
|
|
203
|
+
verb: &str,
|
|
204
|
+
facts: serde_json::Value,
|
|
205
|
+
role: Option<&str>,
|
|
206
|
+
) -> anyhow::Result<Outcome> {
|
|
207
|
+
handle(host, verb, facts_invocation(facts)?, role).await
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/// `handle_facts` for a caller the host can name.
|
|
211
|
+
pub async fn handle_facts_as(
|
|
212
|
+
host: Host<'_>,
|
|
213
|
+
verb: &str,
|
|
214
|
+
facts: serde_json::Value,
|
|
215
|
+
caller: Caller<'_>,
|
|
216
|
+
) -> anyhow::Result<Outcome> {
|
|
217
|
+
handle_as(host, verb, facts_invocation(facts)?, caller).await
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// The store's unit of work holds the domain lock from the first load to the commit, so concurrent
|
|
221
|
+
// callers on one store can't interleave their reads and writes.
|
|
222
|
+
//
|
|
223
|
+
// `config` is required, not optional: `main.rs` already refused to boot
|
|
224
|
+
// unless the configured domain/era is provisioned and current, so by the
|
|
225
|
+
// time `handle` runs that schema is guaranteed to exist.
|
|
226
|
+
//
|
|
227
|
+
// `role` is optional, matching `Adapters::Lambda::Client#dispatch`'s own
|
|
228
|
+
// `role: nil` default: a step with no role looks the same on the wire
|
|
229
|
+
// whether or not a caller is bound.
|
|
230
|
+
//
|
|
231
|
+
// This entry point and `handle_facts`/`handle_routed` are the host's own: a call with no role is a
|
|
232
|
+
// host-internal dispatch and is unchecked in every enforcement mode. A call that names a role is
|
|
233
|
+
// still checked against it. A peer naming its caller goes through the `_as` entry points, and a
|
|
234
|
+
// request to the console API or the web UI through the `_request` ones.
|
|
235
|
+
pub async fn handle(
|
|
236
|
+
host: Host<'_>,
|
|
237
|
+
verb: &str,
|
|
238
|
+
args: serde_json::Value,
|
|
239
|
+
role: Option<&str>,
|
|
240
|
+
) -> anyhow::Result<Outcome> {
|
|
241
|
+
let origin = if role.is_none() {
|
|
242
|
+
Origin::HostInternal
|
|
243
|
+
} else {
|
|
244
|
+
Origin::External
|
|
245
|
+
};
|
|
246
|
+
dispatch_in(
|
|
247
|
+
Enforcement::configured(),
|
|
248
|
+
origin,
|
|
249
|
+
host,
|
|
250
|
+
verb,
|
|
251
|
+
args,
|
|
252
|
+
Caller {
|
|
253
|
+
role,
|
|
254
|
+
actor_id: None,
|
|
255
|
+
},
|
|
256
|
+
)
|
|
257
|
+
.await
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/// `handle_as` for a request from outside the host: the console API and the web UI.
|
|
261
|
+
pub async fn handle_request(
|
|
262
|
+
host: Host<'_>,
|
|
263
|
+
verb: &str,
|
|
264
|
+
args: serde_json::Value,
|
|
265
|
+
caller: Caller<'_>,
|
|
266
|
+
) -> anyhow::Result<Outcome> {
|
|
267
|
+
dispatch_in(
|
|
268
|
+
Enforcement::configured(),
|
|
269
|
+
Origin::Request,
|
|
270
|
+
host,
|
|
271
|
+
verb,
|
|
272
|
+
args,
|
|
273
|
+
caller,
|
|
274
|
+
)
|
|
275
|
+
.await
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/// `handle_routed_as` for a request from outside the host.
|
|
279
|
+
pub async fn handle_routed_request(
|
|
280
|
+
host: Host<'_>,
|
|
281
|
+
verb: &str,
|
|
282
|
+
to: serde_json::Value,
|
|
283
|
+
facts: serde_json::Value,
|
|
284
|
+
caller: Caller<'_>,
|
|
285
|
+
) -> anyhow::Result<Outcome> {
|
|
286
|
+
handle_request(host, verb, routed_invocation(to, facts)?, caller).await
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/// `handle_facts_as` for a request from outside the host.
|
|
290
|
+
pub async fn handle_facts_request(
|
|
291
|
+
host: Host<'_>,
|
|
292
|
+
verb: &str,
|
|
293
|
+
facts: serde_json::Value,
|
|
294
|
+
caller: Caller<'_>,
|
|
295
|
+
) -> anyhow::Result<Outcome> {
|
|
296
|
+
handle_request(host, verb, facts_invocation(facts)?, caller).await
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/// Dispatches for a caller, applying `HECKS_ROLE_ENFORCEMENT`: unidentified callers are refused (or,
|
|
300
|
+
/// in shadow, logged as would-be refusals and let through).
|
|
301
|
+
pub async fn handle_as(
|
|
302
|
+
host: Host<'_>,
|
|
303
|
+
verb: &str,
|
|
304
|
+
args: serde_json::Value,
|
|
305
|
+
caller: Caller<'_>,
|
|
306
|
+
) -> anyhow::Result<Outcome> {
|
|
307
|
+
dispatch_in(
|
|
308
|
+
Enforcement::configured(),
|
|
309
|
+
Origin::External,
|
|
310
|
+
host,
|
|
311
|
+
verb,
|
|
312
|
+
args,
|
|
313
|
+
caller,
|
|
314
|
+
)
|
|
315
|
+
.await
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
pub async fn dispatch_in(
|
|
319
|
+
mode: Enforcement,
|
|
320
|
+
origin: Origin,
|
|
321
|
+
host: Host<'_>,
|
|
322
|
+
verb: &str,
|
|
323
|
+
args: serde_json::Value,
|
|
324
|
+
caller: Caller<'_>,
|
|
325
|
+
) -> anyhow::Result<Outcome> {
|
|
326
|
+
dispatch_with(mode, origin, Effect::Commit, host, verb, args, caller).await
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/// What a command would answer for a caller the host can name, without keeping any of it: the
|
|
330
|
+
/// kernel's own dry-run step, run on the journal's history and rolled back. The answer is in
|
|
331
|
+
/// `result["dry_runs"]`; see `validation::answer`.
|
|
332
|
+
pub async fn preview_as(
|
|
333
|
+
host: Host<'_>,
|
|
334
|
+
verb: &str,
|
|
335
|
+
args: serde_json::Value,
|
|
336
|
+
caller: Caller<'_>,
|
|
337
|
+
) -> anyhow::Result<Outcome> {
|
|
338
|
+
let mode = Enforcement::configured();
|
|
339
|
+
dispatch_with(
|
|
340
|
+
mode,
|
|
341
|
+
Origin::External,
|
|
342
|
+
Effect::Preview,
|
|
343
|
+
host,
|
|
344
|
+
verb,
|
|
345
|
+
args,
|
|
346
|
+
caller,
|
|
347
|
+
)
|
|
348
|
+
.await
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/// `preview_as` for a request from outside the host: the console API and the web UI.
|
|
352
|
+
pub async fn preview_request(
|
|
353
|
+
host: Host<'_>,
|
|
354
|
+
verb: &str,
|
|
355
|
+
args: serde_json::Value,
|
|
356
|
+
caller: Caller<'_>,
|
|
357
|
+
) -> anyhow::Result<Outcome> {
|
|
358
|
+
let mode = Enforcement::configured();
|
|
359
|
+
dispatch_with(
|
|
360
|
+
mode,
|
|
361
|
+
Origin::Request,
|
|
362
|
+
Effect::Preview,
|
|
363
|
+
host,
|
|
364
|
+
verb,
|
|
365
|
+
args,
|
|
366
|
+
caller,
|
|
367
|
+
)
|
|
368
|
+
.await
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
async fn dispatch_with(
|
|
372
|
+
mode: Enforcement,
|
|
373
|
+
origin: Origin,
|
|
374
|
+
effect: Effect,
|
|
375
|
+
host: Host<'_>,
|
|
376
|
+
verb: &str,
|
|
377
|
+
args: serde_json::Value,
|
|
378
|
+
caller: Caller<'_>,
|
|
379
|
+
) -> anyhow::Result<Outcome> {
|
|
380
|
+
let checked = if origin == Origin::HostInternal {
|
|
381
|
+
caller
|
|
382
|
+
} else {
|
|
383
|
+
mode.effective(caller)
|
|
384
|
+
};
|
|
385
|
+
let outcome = run(origin, effect, host, verb, args.clone(), checked).await?;
|
|
386
|
+
// Only a caller that stated no role (unidentified, or an actor Governance holds no grant for)
|
|
387
|
+
// is let through; a stated role that does not match stays refused, as it is under `Off`.
|
|
388
|
+
if mode == Enforcement::Shadow
|
|
389
|
+
&& caller.role.is_none()
|
|
390
|
+
&& !outcome.accepted
|
|
391
|
+
&& refused_for_role(&outcome.result)
|
|
392
|
+
{
|
|
393
|
+
crate::log::error(
|
|
394
|
+
"would_refuse_role",
|
|
395
|
+
serde_json::json!({
|
|
396
|
+
"verb": verb, "role": checked.role, "actor_id": checked.actor_id,
|
|
397
|
+
"refusals": outcome.result.get("refusals"),
|
|
398
|
+
}),
|
|
399
|
+
);
|
|
400
|
+
return run(origin, effect, host, verb, args, Caller::default()).await;
|
|
401
|
+
}
|
|
402
|
+
Ok(outcome)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
async fn run(
|
|
406
|
+
origin: Origin,
|
|
407
|
+
effect: Effect,
|
|
408
|
+
host: Host<'_>,
|
|
409
|
+
verb: &str,
|
|
410
|
+
args: serde_json::Value,
|
|
411
|
+
caller: Caller<'_>,
|
|
412
|
+
) -> anyhow::Result<Outcome> {
|
|
413
|
+
let Host {
|
|
414
|
+
store,
|
|
415
|
+
wasm_path,
|
|
416
|
+
config,
|
|
417
|
+
invoker,
|
|
418
|
+
..
|
|
419
|
+
} = host;
|
|
420
|
+
let role = caller.role;
|
|
421
|
+
// Locks the whole read-then-append sequence, not just the append: two concurrent
|
|
422
|
+
// invocations could otherwise both rehydrate against the same prior steps and both pass a
|
|
423
|
+
// uniqueness check the domain thinks it is enforcing.
|
|
424
|
+
let unit = store.begin(&config.domain).await?;
|
|
425
|
+
|
|
426
|
+
// The last snapshot plus only the journal rows after it, instead of the whole history every
|
|
427
|
+
// time. No snapshot covers a brand-new domain and one with pre-snapshot history alike; both
|
|
428
|
+
// fall back to one full replay, which then leaves a snapshot behind.
|
|
429
|
+
let state = unit.load().await?;
|
|
430
|
+
// Role goes only on this outermost step; replayed history already
|
|
431
|
+
// carries whatever role it was dispatched with. Built as a mutable
|
|
432
|
+
// step, not inlined into the `json!` literal, so a roleless call
|
|
433
|
+
// still omits the `"role"` key entirely rather than sending null.
|
|
434
|
+
// A fact the command `needs` is answered here, before the kernel's gates read the arguments and
|
|
435
|
+
// before the step is journaled, so a replay re-dispatches the recorded answer (ADR 0081).
|
|
436
|
+
let mut args = args;
|
|
437
|
+
if let Some(domain_ir) = crate::ir::ir() {
|
|
438
|
+
fill_arguments(
|
|
439
|
+
origin,
|
|
440
|
+
domain_ir,
|
|
441
|
+
verb,
|
|
442
|
+
&mut args,
|
|
443
|
+
&crate::needs::ProcessClock,
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
let mut step = match effect {
|
|
447
|
+
Effect::Commit => serde_json::json!({ "verb": verb, "args": args.clone() }),
|
|
448
|
+
Effect::Preview => preview_step(verb, &args),
|
|
449
|
+
};
|
|
450
|
+
if let Some(role) = role {
|
|
451
|
+
step["role"] = serde_json::Value::String(role.to_string());
|
|
452
|
+
}
|
|
453
|
+
if let Some(actor_id) = caller.actor_id {
|
|
454
|
+
step["actor_id"] = serde_json::Value::String(actor_id.to_string());
|
|
455
|
+
}
|
|
456
|
+
// Stamped only on this live step. The journal keeps a command's verb and arguments alone, so a
|
|
457
|
+
// replayed step carries no role, actor or timestamp of its own.
|
|
458
|
+
step["occurred_at"] = serde_json::Value::String(crate::clock::iso8601_now());
|
|
459
|
+
// The seed matches the steps: a full replay needs an empty seed, or the kernel replays into a
|
|
460
|
+
// world that already has every record being created again, refusing each as a false
|
|
461
|
+
// AlreadyExists.
|
|
462
|
+
let seed = state.seed();
|
|
463
|
+
let mut steps = state.steps;
|
|
464
|
+
steps.push(step);
|
|
465
|
+
|
|
466
|
+
// Read inside the same locked scope: the lock covers saga state too, not just the aggregate
|
|
467
|
+
// journal and snapshot.
|
|
468
|
+
let sagas_seed = serde_json::json!(state
|
|
469
|
+
.sagas
|
|
470
|
+
.iter()
|
|
471
|
+
.map(|r| serde_json::json!({
|
|
472
|
+
"process_manager": r.process_manager,
|
|
473
|
+
"correlation": r.correlation,
|
|
474
|
+
"state": r.state,
|
|
475
|
+
"memory": r.memory,
|
|
476
|
+
"completed_compensations": r.completed_compensations,
|
|
477
|
+
}))
|
|
478
|
+
.collect::<Vec<_>>());
|
|
479
|
+
|
|
480
|
+
let input = kernel_input(&seed, &steps, &sagas_seed).to_string();
|
|
481
|
+
// `wasm_runner::run` is sync, and wasmtime-wasi's sync bridge spins up
|
|
482
|
+
// its own tokio runtime internally — fatal on a thread already
|
|
483
|
+
// driving one. `spawn_blocking` moves it off this async runtime.
|
|
484
|
+
let owned_wasm_path = wasm_path.to_path_buf();
|
|
485
|
+
let output =
|
|
486
|
+
tokio::task::spawn_blocking(move || wasm_runner::run(&owned_wasm_path, &input)).await??;
|
|
487
|
+
// A kernel failure returns here, before anything is written: dropping the unit rolls it
|
|
488
|
+
// back, so no journal row, snapshot, saga or mutation is saved.
|
|
489
|
+
let mut result = parse_kernel_output(&output)?;
|
|
490
|
+
|
|
491
|
+
// A preview keeps nothing: the unit is rolled back and no reaction is delivered or logged.
|
|
492
|
+
if effect == Effect::Preview {
|
|
493
|
+
unit.rollback().await?;
|
|
494
|
+
let accepted = crate::validation::accepted(&result);
|
|
495
|
+
return Ok(Outcome { result, accepted });
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// See journal.rs's own header: every prior step in this replay
|
|
499
|
+
// already succeeded once, deterministically, so the only step that
|
|
500
|
+
// can legitimately show up in `refusals` is the new one just
|
|
501
|
+
// appended last.
|
|
502
|
+
let accepted = classify(&result) == KernelAnswer::Accepted;
|
|
503
|
+
|
|
504
|
+
if accepted {
|
|
505
|
+
let accepted_step = Accepted {
|
|
506
|
+
verb,
|
|
507
|
+
args: &args,
|
|
508
|
+
// The kernel's "instances" output is already the exact seed shape, so nothing here
|
|
509
|
+
// re-derives or filters it.
|
|
510
|
+
new_seed: result
|
|
511
|
+
.get("instances")
|
|
512
|
+
.cloned()
|
|
513
|
+
.unwrap_or_else(|| serde_json::json!({})),
|
|
514
|
+
saga_upserts: saga_upserts(&result)?,
|
|
515
|
+
saga_deletes: saga_deletes(&result, &state.sagas),
|
|
516
|
+
lineage: lineage_write(&result, config)?,
|
|
517
|
+
};
|
|
518
|
+
// Persisted in one scope, so a saga checkpoint can never commit independently of the
|
|
519
|
+
// command that produced it.
|
|
520
|
+
unit.commit(accepted_step).await?;
|
|
521
|
+
} else {
|
|
522
|
+
// Nothing to persist; ending the scope releases the domain lock for the next invocation.
|
|
523
|
+
unit.rollback().await?;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Only this step's own matches, same reason as the lineage mutations: replaying a prior
|
|
527
|
+
// step's reaction would re-invoke a sibling Lambda on every later replay. Captured before
|
|
528
|
+
// commit, delivered after.
|
|
529
|
+
let pending_cross_domain = result
|
|
530
|
+
.get("cross_domain_reactions")
|
|
531
|
+
.and_then(|r| r.as_array())
|
|
532
|
+
.and_then(|steps| steps.last())
|
|
533
|
+
.and_then(|last| last.as_array())
|
|
534
|
+
.cloned()
|
|
535
|
+
.unwrap_or_default();
|
|
536
|
+
|
|
537
|
+
// Delivered after commit, deliberately: the local command already
|
|
538
|
+
// succeeded and is durable, so a cross-Lambda notification is
|
|
539
|
+
// best-effort, not a precondition of it. A fault that survives every
|
|
540
|
+
// retry still fails this call via `?`, but never unwinds an
|
|
541
|
+
// already-committed transaction.
|
|
542
|
+
// Every reaction gets its own attempt even after an earlier fails:
|
|
543
|
+
// returning early would silently drop the rest, undelivered and
|
|
544
|
+
// never dead-lettered (`SafeDepositBox.Surrender` fires two from one
|
|
545
|
+
// command). `first_failure` remembers only the first error without
|
|
546
|
+
// cutting the loop short.
|
|
547
|
+
let mut cross_domain_deliveries = Vec::new();
|
|
548
|
+
let mut first_failure: Option<anyhow::Error> = None;
|
|
549
|
+
for reaction in &pending_cross_domain {
|
|
550
|
+
match lambda_client::deliver_with_retry(invoker, reaction).await {
|
|
551
|
+
Ok(record) => {
|
|
552
|
+
if let Some(response) = result.as_object_mut() {
|
|
553
|
+
if let Some(reactions) =
|
|
554
|
+
response.get_mut("reactions").and_then(|r| r.as_array_mut())
|
|
555
|
+
{
|
|
556
|
+
reactions.push(serde_json::json!({
|
|
557
|
+
"policy": record.policy, "on": reaction.get("on").and_then(|v| v.as_str()).unwrap_or_default(),
|
|
558
|
+
"trigger": record.target_verb, "delivered": record.delivered, "reason": record.reason,
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
cross_domain_deliveries.push(record.to_json());
|
|
563
|
+
}
|
|
564
|
+
Err(failure) => {
|
|
565
|
+
let error_text = format!("{:#}", failure.error);
|
|
566
|
+
crate::log::error(
|
|
567
|
+
"cross_domain_delivery_failed",
|
|
568
|
+
serde_json::json!({
|
|
569
|
+
"policy": failure.policy, "target_domain": failure.target_domain,
|
|
570
|
+
"target_verb": failure.target_verb, "attempts": failure.attempts, "error": error_text,
|
|
571
|
+
}),
|
|
572
|
+
);
|
|
573
|
+
store
|
|
574
|
+
.record_dead_letter(&DeadLetter {
|
|
575
|
+
policy: &failure.policy,
|
|
576
|
+
target_domain: &failure.target_domain,
|
|
577
|
+
target_verb: &failure.target_verb,
|
|
578
|
+
payload: &failure.payload,
|
|
579
|
+
error: &error_text,
|
|
580
|
+
attempts: failure.attempts as i32,
|
|
581
|
+
})
|
|
582
|
+
.await?;
|
|
583
|
+
if first_failure.is_none() {
|
|
584
|
+
first_failure = Some(failure.error);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if let Some(error) = first_failure {
|
|
590
|
+
return Err(error);
|
|
591
|
+
}
|
|
592
|
+
if let Some(response) = result.as_object_mut() {
|
|
593
|
+
response.insert(
|
|
594
|
+
"cross_domain_deliveries".to_string(),
|
|
595
|
+
serde_json::Value::Array(cross_domain_deliveries),
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
log_command(verb, role, accepted, &result);
|
|
600
|
+
Ok(Outcome { result, accepted })
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// A preview names the verb under `dry_run`, which the kernel answers on a copy of the world. A
|
|
604
|
+
// routed invocation keeps its `to` and `with` at the step's top level, where the kernel routes a
|
|
605
|
+
// dry run as it routes a real step; a flat one stays under `args`.
|
|
606
|
+
fn preview_step(verb: &str, args: &serde_json::Value) -> serde_json::Value {
|
|
607
|
+
let mut step = serde_json::json!({ "dry_run": verb });
|
|
608
|
+
if args.get("with").is_some() {
|
|
609
|
+
for key in ["to", "with"] {
|
|
610
|
+
if let Some(value) = args.get(key) {
|
|
611
|
+
step[key] = value.clone();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
} else if let Some(to) = args.get("to").filter(|_| args.is_object()) {
|
|
615
|
+
// The older mixed shape a form posts: the receiver beside the facts it names.
|
|
616
|
+
let mut facts = args.clone();
|
|
617
|
+
if let Some(map) = facts.as_object_mut() {
|
|
618
|
+
map.remove("to");
|
|
619
|
+
}
|
|
620
|
+
step["to"] = to.clone();
|
|
621
|
+
step["with"] = facts;
|
|
622
|
+
} else {
|
|
623
|
+
step["args"] = args.clone();
|
|
624
|
+
}
|
|
625
|
+
step
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// The kernel's whole input: the seed, every step to replay on it, the saga rows, and the tables
|
|
629
|
+
// that answer a command's `needs` and `defaults`, lest a reaction's command lack a fact (ADR 0081).
|
|
630
|
+
fn kernel_input(
|
|
631
|
+
seed: &serde_json::Value,
|
|
632
|
+
steps: &[serde_json::Value],
|
|
633
|
+
sagas_seed: &serde_json::Value,
|
|
634
|
+
) -> serde_json::Value {
|
|
635
|
+
let mut input = serde_json::json!({ "seed": seed, "steps": steps, "sagas": sagas_seed });
|
|
636
|
+
if let Some(domain_ir) = crate::ir::ir() {
|
|
637
|
+
let table = crate::needs::table(domain_ir);
|
|
638
|
+
if table.as_object().is_some_and(|t| !t.is_empty()) {
|
|
639
|
+
input["needs"] = table;
|
|
640
|
+
}
|
|
641
|
+
let defaults = crate::needs::defaults_table(domain_ir);
|
|
642
|
+
if defaults.as_object().is_some_and(|t| !t.is_empty()) {
|
|
643
|
+
input["defaults"] = defaults;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
input
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// A string field a saga entry must carry.
|
|
650
|
+
fn saga_field<'a>(entry: &'a serde_json::Value, key: &str) -> anyhow::Result<&'a str> {
|
|
651
|
+
entry
|
|
652
|
+
.get(key)
|
|
653
|
+
.and_then(|v| v.as_str())
|
|
654
|
+
.ok_or_else(|| anyhow::anyhow!("saga_snapshot entry missing \"{key}\": {entry}"))
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// Every saga instance the kernel says is live after this step, to be upserted. A result with no
|
|
658
|
+
// `saga_snapshot` says nothing about sagas, so nothing is upserted (or deleted).
|
|
659
|
+
fn saga_upserts(result: &serde_json::Value) -> anyhow::Result<Vec<journal::SagaRow>> {
|
|
660
|
+
let Some(saga_snapshot) = result.get("saga_snapshot").and_then(|v| v.as_array()) else {
|
|
661
|
+
return Ok(Vec::new());
|
|
662
|
+
};
|
|
663
|
+
saga_snapshot
|
|
664
|
+
.iter()
|
|
665
|
+
.map(|entry| {
|
|
666
|
+
Ok(journal::SagaRow {
|
|
667
|
+
process_manager: saga_field(entry, "process_manager")?.to_string(),
|
|
668
|
+
correlation: saga_field(entry, "correlation")?.to_string(),
|
|
669
|
+
state: saga_field(entry, "state")?.to_string(),
|
|
670
|
+
memory: entry
|
|
671
|
+
.get("memory")
|
|
672
|
+
.cloned()
|
|
673
|
+
.unwrap_or_else(|| serde_json::json!({})),
|
|
674
|
+
completed_compensations: entry
|
|
675
|
+
.get("completed_compensations")
|
|
676
|
+
.cloned()
|
|
677
|
+
.unwrap_or_else(|| serde_json::json!([])),
|
|
678
|
+
})
|
|
679
|
+
})
|
|
680
|
+
.collect()
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// The sagas present before this step (`before`) absent from the kernel's report now: they ended.
|
|
684
|
+
fn saga_deletes(result: &serde_json::Value, before: &[journal::SagaRow]) -> Vec<(String, String)> {
|
|
685
|
+
let Some(saga_snapshot) = result.get("saga_snapshot").and_then(|v| v.as_array()) else {
|
|
686
|
+
return Vec::new();
|
|
687
|
+
};
|
|
688
|
+
let still_present: std::collections::HashSet<(&str, &str)> = saga_snapshot
|
|
689
|
+
.iter()
|
|
690
|
+
.filter_map(|entry| {
|
|
691
|
+
Some((
|
|
692
|
+
entry.get("process_manager")?.as_str()?,
|
|
693
|
+
entry.get("correlation")?.as_str()?,
|
|
694
|
+
))
|
|
695
|
+
})
|
|
696
|
+
.collect();
|
|
697
|
+
before
|
|
698
|
+
.iter()
|
|
699
|
+
.filter(|row| {
|
|
700
|
+
!still_present.contains(&(row.process_manager.as_str(), row.correlation.as_str()))
|
|
701
|
+
})
|
|
702
|
+
.map(|row| (row.process_manager.clone(), row.correlation.clone()))
|
|
703
|
+
.collect()
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// One entry per step in `steps`, so the last entry is this call's own new step. None when
|
|
707
|
+
// `config.era` is `None`: a domain with nothing lineage-capable bound never provisions a
|
|
708
|
+
// head-snapshot table to write into (ADR 0034).
|
|
709
|
+
fn lineage_write<'a>(
|
|
710
|
+
result: &'a serde_json::Value,
|
|
711
|
+
config: &'a journal::LineageConfig,
|
|
712
|
+
) -> anyhow::Result<Option<LineageWrite<'a>>> {
|
|
713
|
+
if config.era.is_none() {
|
|
714
|
+
return Ok(None);
|
|
715
|
+
}
|
|
716
|
+
let step_mutations = result
|
|
717
|
+
.get("mutations")
|
|
718
|
+
.and_then(|m| m.as_array())
|
|
719
|
+
.and_then(|steps| steps.last())
|
|
720
|
+
.and_then(|last| last.as_array())
|
|
721
|
+
.map_or(&[][..], Vec::as_slice);
|
|
722
|
+
let mut mutations = Vec::new();
|
|
723
|
+
for mutation in step_mutations {
|
|
724
|
+
let aggregate = mutation_field(mutation, "aggregate")?;
|
|
725
|
+
// `era.is_some()` means the lineage subsystem exists, not that this aggregate has a
|
|
726
|
+
// mirror: `mint` only provisions head snapshots for the capable set, so mirroring
|
|
727
|
+
// anything else would upsert into a relation nobody created.
|
|
728
|
+
if !config.mirrors(aggregate) {
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
mutations.push(journal::Mutation {
|
|
732
|
+
aggregate,
|
|
733
|
+
id: mutation_field(mutation, "id")?,
|
|
734
|
+
operation: mutation_field(mutation, "operation")?,
|
|
735
|
+
state: mutation
|
|
736
|
+
.get("state")
|
|
737
|
+
.ok_or_else(|| anyhow::anyhow!("mutation record missing \"state\": {mutation}"))?,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
Ok(Some(LineageWrite { config, mutations }))
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// A string field a mutation record must carry.
|
|
744
|
+
fn mutation_field<'a>(mutation: &'a serde_json::Value, key: &str) -> anyhow::Result<&'a str> {
|
|
745
|
+
mutation
|
|
746
|
+
.get(key)
|
|
747
|
+
.and_then(|v| v.as_str())
|
|
748
|
+
.ok_or_else(|| anyhow::anyhow!("mutation record missing \"{key}\": {mutation}"))
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// Answers the facts the command needs and fills its declared defaults. A value the caller supplied
|
|
752
|
+
// for a needed fact is kept (ADR 0081) unless the dispatch is a request from outside the host,
|
|
753
|
+
// which may not set the clock a time-window guard reads.
|
|
754
|
+
pub fn fill_arguments(
|
|
755
|
+
origin: Origin,
|
|
756
|
+
domain_ir: &serde_json::Value,
|
|
757
|
+
verb: &str,
|
|
758
|
+
args: &mut serde_json::Value,
|
|
759
|
+
clock: &dyn crate::needs::Clock,
|
|
760
|
+
) {
|
|
761
|
+
if origin == Origin::Request {
|
|
762
|
+
crate::needs::answer_needs(domain_ir, verb, args, clock);
|
|
763
|
+
} else {
|
|
764
|
+
crate::needs::fill_needs(domain_ir, verb, args, clock);
|
|
765
|
+
}
|
|
766
|
+
// An argument with a declared default is filled the same way, so the journal holds it too.
|
|
767
|
+
crate::needs::fill_defaults(domain_ir, verb, args);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// One line per dispatched command: what was asked (verb, role — never
|
|
771
|
+
// the facts) and what the domain answered.
|
|
772
|
+
fn log_command(verb: &str, role: Option<&str>, accepted: bool, result: &serde_json::Value) {
|
|
773
|
+
let fields = command_fields(verb, role, accepted, result);
|
|
774
|
+
if accepted {
|
|
775
|
+
crate::log::info("command", fields);
|
|
776
|
+
} else {
|
|
777
|
+
crate::log::error("command", fields);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
pub fn command_fields(
|
|
782
|
+
verb: &str,
|
|
783
|
+
role: Option<&str>,
|
|
784
|
+
accepted: bool,
|
|
785
|
+
result: &serde_json::Value,
|
|
786
|
+
) -> serde_json::Value {
|
|
787
|
+
let events: Vec<serde_json::Value> = result
|
|
788
|
+
.get("events")
|
|
789
|
+
.and_then(|v| v.as_array())
|
|
790
|
+
.map(|items| {
|
|
791
|
+
items
|
|
792
|
+
.iter()
|
|
793
|
+
.filter_map(|item| item.get("name").cloned())
|
|
794
|
+
.collect()
|
|
795
|
+
})
|
|
796
|
+
.unwrap_or_default();
|
|
797
|
+
serde_json::json!({
|
|
798
|
+
"verb": verb, "role": role, "accepted": accepted, "events": events,
|
|
799
|
+
"refusals": result.get("refusals").cloned().unwrap_or_else(|| serde_json::json!([])),
|
|
800
|
+
})
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// Read-only: the same seed path `handle` uses, minus the new step and
|
|
804
|
+
// any write. No domain lock needed since nothing here writes.
|
|
805
|
+
// Returns the whole kernel result verbatim, not just `instances`, so a
|
|
806
|
+
// caller can tell an empty `refusals` from one that was never checked.
|
|
807
|
+
pub async fn read(store: &Store, wasm_path: &Path) -> anyhow::Result<serde_json::Value> {
|
|
808
|
+
let state = store.read_state().await?;
|
|
809
|
+
|
|
810
|
+
if let Some(s) = &state.snapshot {
|
|
811
|
+
if state.steps.is_empty() {
|
|
812
|
+
// No wasm invocation needed: the snapshot's seed already is
|
|
813
|
+
// this domain's current "instances" output. Empty
|
|
814
|
+
// events/refusals is correct too — a read reports current
|
|
815
|
+
// state, never event/refusal history.
|
|
816
|
+
return Ok(serde_json::json!({ "instances": s.seed, "events": [], "refusals": [] }));
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// Self-healing: if steps ever go unaccounted for after the last
|
|
820
|
+
// snapshot, seeding from it and replaying just the gap is
|
|
821
|
+
// still correct and cheap.
|
|
822
|
+
let input = serde_json::json!({ "seed": &s.seed, "steps": state.steps }).to_string();
|
|
823
|
+
return run_read(wasm_path, input).await;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// No snapshot: either a brand-new domain, or one with history from
|
|
827
|
+
// before this snapshot cache existed — either way, one full replay
|
|
828
|
+
// catches it up.
|
|
829
|
+
run_read(
|
|
830
|
+
wasm_path,
|
|
831
|
+
serde_json::json!({ "steps": state.steps }).to_string(),
|
|
832
|
+
)
|
|
833
|
+
.await
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
async fn run_read(wasm_path: &Path, input: String) -> anyhow::Result<serde_json::Value> {
|
|
837
|
+
let owned_wasm_path = wasm_path.to_path_buf();
|
|
838
|
+
let output =
|
|
839
|
+
tokio::task::spawn_blocking(move || wasm_runner::run(&owned_wasm_path, &input)).await??;
|
|
840
|
+
parse_kernel_output(&output)
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// A declared query, answered against current state. Seeds from `read`
|
|
844
|
+
// rather than replaying history itself, so it sees exactly the state a
|
|
845
|
+
// read would report and pays at most one wasm invocation.
|
|
846
|
+
pub async fn query(
|
|
847
|
+
store: &Store,
|
|
848
|
+
wasm_path: &Path,
|
|
849
|
+
question: &str,
|
|
850
|
+
args: serde_json::Value,
|
|
851
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
852
|
+
// A fact the query `needs` is answered before the kernel checks its arguments (ADR 0081).
|
|
853
|
+
let mut args = args;
|
|
854
|
+
if let Some(domain_ir) = crate::ir::ir() {
|
|
855
|
+
crate::needs::fill_query_needs(domain_ir, question, &mut args, &crate::needs::ProcessClock);
|
|
856
|
+
}
|
|
857
|
+
answer_query(store, wasm_path, question, args).await
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/// `query` for a request from outside the host: every fact the query needs is the host's answer,
|
|
861
|
+
/// never the request's.
|
|
862
|
+
pub async fn query_request(
|
|
863
|
+
store: &Store,
|
|
864
|
+
wasm_path: &Path,
|
|
865
|
+
question: &str,
|
|
866
|
+
args: serde_json::Value,
|
|
867
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
868
|
+
let mut args = args;
|
|
869
|
+
if let Some(domain_ir) = crate::ir::ir() {
|
|
870
|
+
crate::needs::answer_query_needs(
|
|
871
|
+
domain_ir,
|
|
872
|
+
question,
|
|
873
|
+
&mut args,
|
|
874
|
+
&crate::needs::ProcessClock,
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
answer_query(store, wasm_path, question, args).await
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
async fn answer_query(
|
|
881
|
+
store: &Store,
|
|
882
|
+
wasm_path: &Path,
|
|
883
|
+
question: &str,
|
|
884
|
+
args: serde_json::Value,
|
|
885
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
886
|
+
let state = read(store, wasm_path).await?;
|
|
887
|
+
let seed = state
|
|
888
|
+
.get("instances")
|
|
889
|
+
.cloned()
|
|
890
|
+
.unwrap_or_else(|| serde_json::json!({}));
|
|
891
|
+
let input = serde_json::json!({ "seed": seed, "steps": [{ "query": question, "args": args }] })
|
|
892
|
+
.to_string();
|
|
893
|
+
let owned_wasm_path = wasm_path.to_path_buf();
|
|
894
|
+
let output =
|
|
895
|
+
tokio::task::spawn_blocking(move || wasm_runner::run(&owned_wasm_path, &input)).await??;
|
|
896
|
+
parse_kernel_output(&output)
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/// Answers `answer` (a kernel answer already computed and persisted) in the bare shape a caller
|
|
900
|
+
/// reads, by one more wasm run of the kernel's `{"present": answer}` input: each single-field
|
|
901
|
+
/// value object as its sole field. Nothing is stored or replayed.
|
|
902
|
+
pub async fn present(
|
|
903
|
+
wasm_path: &Path,
|
|
904
|
+
answer: serde_json::Value,
|
|
905
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
906
|
+
let owned_wasm_path = wasm_path.to_path_buf();
|
|
907
|
+
tokio::task::spawn_blocking(move || {
|
|
908
|
+
present_with(&answer, |input| wasm_runner::run(&owned_wasm_path, input))
|
|
909
|
+
})
|
|
910
|
+
.await?
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/// Presents `answer` as `present` does, with `run` standing in for the kernel (text in, text out).
|
|
914
|
+
pub fn present_with(
|
|
915
|
+
answer: &serde_json::Value,
|
|
916
|
+
run: impl FnOnce(&str) -> anyhow::Result<String>,
|
|
917
|
+
) -> anyhow::Result<serde_json::Value> {
|
|
918
|
+
let input = serde_json::json!({ "present": answer }).to_string();
|
|
919
|
+
parse_kernel_output(&run(&input)?)
|
|
920
|
+
}
|