hecks 5.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 +14 -2
- 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 +11 -8
- 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 +11 -9
- 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 +1 -1
- 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 +16 -9
- 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 +1 -1
- 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/validation.rb +7 -4
- 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 +24 -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 +35 -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 +3 -3
- data/rust/codegen/src/queries.rs +56 -7
- data/rust/codegen/src/reactions.rs +19 -14
- data/rust/codegen/src/read_models.rs +19 -14
- 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} +367 -847
- 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 +222 -43
- 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 +219 -19
- data/rust/src/kernel/collecting.rs +174 -0
- data/rust/src/kernel/dispatch.rs +55 -27
- data/rust/src/kernel/mod.rs +7 -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/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 +328 -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/ad68f9e06c8068c2a4176b57abf3083d591d5d8980c2b3e897b97331f965b643.marshal +0 -0
- data/prebuilt/ee22ec8642c4006717ba2b80f46e5efb81de459eef9dfec043e838c0ad4fd720.marshal +0 -0
- data/prebuilt/verdicts-b69f5dcbba79c20daa0493476fa7c317004a30aa2bc3d3dc6a722ea70ae2b43b.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,1366 @@
|
|
|
1
|
+
//! What each phrase means: the blocks of a sentence file lowered into `ir` structs.
|
|
2
|
+
//!
|
|
3
|
+
//! An aggregate reads its blocks in any order and resolves names once it has them all, so
|
|
4
|
+
//! `It has:` may come before or after the value objects it names, and a command may name a field
|
|
5
|
+
//! declared further down. Every unresolved name is refused with the names that are in scope.
|
|
6
|
+
|
|
7
|
+
use super::changes::Change;
|
|
8
|
+
use super::names::{camel, scalar, snake, spoken, SCALARS};
|
|
9
|
+
use super::{column, Matched, Parser, Scope, Step};
|
|
10
|
+
use crate::build::identity;
|
|
11
|
+
use crate::diag::{Diagnostic, ParseResult};
|
|
12
|
+
use crate::ir;
|
|
13
|
+
use crate::ruby_value;
|
|
14
|
+
|
|
15
|
+
/// A type phrase written in the file, resolved once the aggregate's value objects are known.
|
|
16
|
+
pub(super) struct TypeUse {
|
|
17
|
+
line: usize,
|
|
18
|
+
col: usize,
|
|
19
|
+
words: String,
|
|
20
|
+
/// Names an aggregate (`reference to …`, `has many …`), not a scalar or a value object.
|
|
21
|
+
reference: bool,
|
|
22
|
+
/// For `one of a or b`: the aggregates, to mint the tagged reference from.
|
|
23
|
+
pub variants: Option<Vec<String>>,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
struct Identity {
|
|
27
|
+
line: usize,
|
|
28
|
+
col: usize,
|
|
29
|
+
fields: Vec<String>,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
struct Transition {
|
|
33
|
+
line: usize,
|
|
34
|
+
col: usize,
|
|
35
|
+
command: String,
|
|
36
|
+
from: String,
|
|
37
|
+
to: String,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
struct LifecycleSpec {
|
|
41
|
+
field: String,
|
|
42
|
+
default: String,
|
|
43
|
+
transitions: Vec<Transition>,
|
|
44
|
+
marks: Vec<(String, Vec<String>)>,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// A field a sentence names, with where it named it.
|
|
48
|
+
pub(super) struct FieldUse {
|
|
49
|
+
pub name: String,
|
|
50
|
+
pub line: usize,
|
|
51
|
+
pub col: usize,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
struct CommandSpec {
|
|
55
|
+
name: String,
|
|
56
|
+
role: Option<String>,
|
|
57
|
+
roles: Vec<String>,
|
|
58
|
+
goal: Option<String>,
|
|
59
|
+
references: Option<String>,
|
|
60
|
+
args: Vec<FieldUse>,
|
|
61
|
+
/// Arguments of its own, typed where they are written (`It takes:`).
|
|
62
|
+
takes: Vec<(ir::Attribute, TypeUse)>,
|
|
63
|
+
givens: Vec<ir::Given>,
|
|
64
|
+
ensures: Vec<ir::Given>,
|
|
65
|
+
from: Option<ir::CommandFrom>,
|
|
66
|
+
provenance: Option<crate::ruby_value::Value>,
|
|
67
|
+
idempotent: bool,
|
|
68
|
+
changes: Vec<Change>,
|
|
69
|
+
emits: Vec<String>,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// A condition read from a rule, a given or a where.
|
|
73
|
+
pub(super) struct Cond {
|
|
74
|
+
pub canonical: String,
|
|
75
|
+
/// The field the condition is about; none for a condition written as an expression.
|
|
76
|
+
pub field: Option<FieldUse>,
|
|
77
|
+
pub value: Option<String>,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// What a policy does when its event is announced.
|
|
81
|
+
enum Reaction {
|
|
82
|
+
/// Runs a command of the bluebook.
|
|
83
|
+
Run(String),
|
|
84
|
+
/// Asks the outside for something, by the need's name in the domain's words.
|
|
85
|
+
Ask(String),
|
|
86
|
+
/// Tells a named aggregate's command (`Aggregate.Command`), which may live in another domain.
|
|
87
|
+
Tell(String),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// A policy as written, before its event and command are looked up in the bluebook.
|
|
91
|
+
struct PolicySpec {
|
|
92
|
+
name: String,
|
|
93
|
+
line: usize,
|
|
94
|
+
col: usize,
|
|
95
|
+
/// The event announced, the aggregate it is said to come from, and where it was written.
|
|
96
|
+
event: Option<(String, Option<String>, usize, usize)>,
|
|
97
|
+
/// The outside announces the event, so no aggregate of the bluebook is its source.
|
|
98
|
+
outside: bool,
|
|
99
|
+
/// `Aggregate.Query` when the policy runs once for each row a query answers.
|
|
100
|
+
for_each: Option<String>,
|
|
101
|
+
/// The test that must hold for the policy to act, as the IR spells it.
|
|
102
|
+
only_when: Option<String>,
|
|
103
|
+
/// The policy is meant to find nobody to receive its command.
|
|
104
|
+
undelivered: bool,
|
|
105
|
+
/// The domain a policy's command lives in, when it is not this one.
|
|
106
|
+
across: Option<String>,
|
|
107
|
+
/// Fields passed on their own `With` lines rather than after `runs with`.
|
|
108
|
+
with_lines: Vec<PassedField>,
|
|
109
|
+
/// What it does, the fields it passes (the command's name for each, and where it takes it
|
|
110
|
+
/// from), and where it was written.
|
|
111
|
+
reaction: Option<(Reaction, Vec<PassedField>, usize, usize)>,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// A field a policy passes on: the command's name for it, and the value as the IR spells it.
|
|
115
|
+
type PassedField = (FieldUse, String);
|
|
116
|
+
|
|
117
|
+
/// Everything read of one aggregate before its names are resolved.
|
|
118
|
+
pub(super) struct AggState {
|
|
119
|
+
pub agg: ir::Aggregate,
|
|
120
|
+
attr_types: Vec<TypeUse>,
|
|
121
|
+
/// The arguments each query (by index in `agg.queries`) wrote, to be typed once all is read.
|
|
122
|
+
pub query_args: Vec<(usize, Vec<(ir::Attribute, TypeUse)>)>,
|
|
123
|
+
/// The type phrase of attribute `.1` of value object `.0`, resolved once all are read.
|
|
124
|
+
vo_types: Vec<(usize, usize, TypeUse)>,
|
|
125
|
+
identity: Option<Identity>,
|
|
126
|
+
lifecycle: Option<LifecycleSpec>,
|
|
127
|
+
commands: Vec<CommandSpec>,
|
|
128
|
+
pub checks: Vec<FieldUse>,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
impl Parser<'_> {
|
|
132
|
+
/// Reads the whole file: one `Domain:` and the aggregates under it.
|
|
133
|
+
pub(super) fn file(&mut self) -> ParseResult<ir::Bluebook> {
|
|
134
|
+
self.types = self.declared_types();
|
|
135
|
+
let mut scope = Scope::top();
|
|
136
|
+
let Some(Step::Phrase(header)) = self.step(&mut scope, "File", false)? else {
|
|
137
|
+
return Err(self.error(1, 1, "this file is empty; it starts with `Domain: <name>`"));
|
|
138
|
+
};
|
|
139
|
+
let mut declaration = ir::Bluebook {
|
|
140
|
+
name: camel(&header.text_of("name")),
|
|
141
|
+
..Default::default()
|
|
142
|
+
};
|
|
143
|
+
// An indented paragraph under the `Domain:` line says what the domain is for.
|
|
144
|
+
let mut vision = Scope::inside(header.indent);
|
|
145
|
+
while let Some(step) = self.step(&mut vision, "Vision", true)? {
|
|
146
|
+
match step {
|
|
147
|
+
Step::Prose { text } => declaration.vision = Some(text),
|
|
148
|
+
Step::Phrase(m) if m.id == "classification" => {
|
|
149
|
+
let kind = m.text_of("kind").to_lowercase();
|
|
150
|
+
if !matches!(kind.as_str(), "core" | "supporting" | "generic") {
|
|
151
|
+
return Err(self.error(
|
|
152
|
+
m.line,
|
|
153
|
+
m.col_of("kind"),
|
|
154
|
+
format!("'{kind}' is not a kind of domain; it is core, supporting or generic"),
|
|
155
|
+
));
|
|
156
|
+
}
|
|
157
|
+
declaration.classification = Some(kind);
|
|
158
|
+
}
|
|
159
|
+
Step::Phrase(m) if m.id == "namespace" => {
|
|
160
|
+
declaration.namespace = Some(m.text_of("name"));
|
|
161
|
+
}
|
|
162
|
+
Step::Phrase(m) if m.id == "version" => {
|
|
163
|
+
declaration.version = Some(m.text_of("version"));
|
|
164
|
+
}
|
|
165
|
+
Step::Phrase(m) if m.id == "attaches" => {
|
|
166
|
+
declaration.attaches_to = m
|
|
167
|
+
.capture("contexts")
|
|
168
|
+
.items
|
|
169
|
+
.iter()
|
|
170
|
+
.map(|item| camel(item))
|
|
171
|
+
.collect();
|
|
172
|
+
}
|
|
173
|
+
Step::Phrase(m) if m.id == "provides" => {
|
|
174
|
+
let capability = m.text_of("capability");
|
|
175
|
+
let mut rows = Scope::inside(m.indent);
|
|
176
|
+
while let Some(Step::Phrase(row)) = self.step(&mut rows, "Provides", false)? {
|
|
177
|
+
declaration.provisions_push(&capability, &row);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
Step::Phrase(m) => return Err(self.unmeant(&m)),
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// The aggregates follow at the top level, as flat as the `Domain:` line.
|
|
184
|
+
let mut aggregates = Scope::top();
|
|
185
|
+
aggregates.first = false;
|
|
186
|
+
let mut policies: Vec<PolicySpec> = Vec::new();
|
|
187
|
+
while let Some(step) = self.step(&mut aggregates, "Domain", false)? {
|
|
188
|
+
match step {
|
|
189
|
+
Step::Phrase(m) if m.id == "aggregate" => {
|
|
190
|
+
let aggregate = self.aggregate(&m)?;
|
|
191
|
+
declaration.aggregates.push(aggregate);
|
|
192
|
+
}
|
|
193
|
+
Step::Phrase(m) if m.id == "policy" => policies.push(self.policy(&m)?),
|
|
194
|
+
Step::Phrase(m) if m.id == "process" => {
|
|
195
|
+
let pm = self.process(&m)?;
|
|
196
|
+
declaration.process_managers.push(pm);
|
|
197
|
+
}
|
|
198
|
+
Step::Phrase(m) if m.id == "report" => {
|
|
199
|
+
let model = self.report(&m)?;
|
|
200
|
+
declaration.read_models.push(model);
|
|
201
|
+
}
|
|
202
|
+
Step::Phrase(m) => return Err(self.unmeant(&m)),
|
|
203
|
+
Step::Prose { .. } => {}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
declaration.policies = self.policies_of(&declaration, policies)?;
|
|
207
|
+
if let Some(line) = self.lines.get(self.pos) {
|
|
208
|
+
return Err(self.error(
|
|
209
|
+
line.number,
|
|
210
|
+
1,
|
|
211
|
+
"a file holds one domain; this line is outside it. Start another file for another domain",
|
|
212
|
+
));
|
|
213
|
+
}
|
|
214
|
+
Ok(declaration)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/// Reads one `Policy:` block: the event it waits for and what it does then.
|
|
218
|
+
fn policy(&mut self, header: &Matched) -> ParseResult<PolicySpec> {
|
|
219
|
+
let mut spec = PolicySpec {
|
|
220
|
+
name: camel(&header.text_of("name")),
|
|
221
|
+
line: header.line,
|
|
222
|
+
col: header.base_col,
|
|
223
|
+
event: None,
|
|
224
|
+
outside: false,
|
|
225
|
+
for_each: None,
|
|
226
|
+
only_when: None,
|
|
227
|
+
undelivered: false,
|
|
228
|
+
across: None,
|
|
229
|
+
with_lines: Vec::new(),
|
|
230
|
+
reaction: None,
|
|
231
|
+
};
|
|
232
|
+
let mut scope = Scope::inside(header.indent);
|
|
233
|
+
while let Some(step) = self.step(&mut scope, "Policy", false)? {
|
|
234
|
+
let Step::Phrase(m) = step else { continue };
|
|
235
|
+
match m.id {
|
|
236
|
+
"policy_undelivered" => spec.undelivered = true,
|
|
237
|
+
"policy_across" => spec.across = Some(camel(&m.text_of("domain"))),
|
|
238
|
+
"only_when" => {
|
|
239
|
+
let cond = self.condition(&m)?;
|
|
240
|
+
spec.only_when = Some(cond.canonical);
|
|
241
|
+
}
|
|
242
|
+
"with_same" | "with_from" | "with_as" => {
|
|
243
|
+
let key = FieldUse {
|
|
244
|
+
name: snake(&m.text_of("key")),
|
|
245
|
+
line: m.line,
|
|
246
|
+
col: m.col_of("key"),
|
|
247
|
+
};
|
|
248
|
+
let from = match m.id {
|
|
249
|
+
"with_same" => format!(":{}", key.name),
|
|
250
|
+
"with_from" => format!(":{}", snake(&m.text_of("from"))),
|
|
251
|
+
_ => ruby_value::render(&self.literal(&m, "value")?),
|
|
252
|
+
};
|
|
253
|
+
spec.with_lines.push((key, from));
|
|
254
|
+
}
|
|
255
|
+
"for_each" => {
|
|
256
|
+
spec.for_each = Some(format!(
|
|
257
|
+
"{}.{}",
|
|
258
|
+
camel(&m.text_of("owner")),
|
|
259
|
+
camel(&m.text_of("query"))
|
|
260
|
+
));
|
|
261
|
+
}
|
|
262
|
+
"whenever" | "whenever_by" | "whenever_outside" => {
|
|
263
|
+
if spec.event.is_some() {
|
|
264
|
+
return Err(self.error(
|
|
265
|
+
m.line,
|
|
266
|
+
m.base_col,
|
|
267
|
+
"a policy waits for one event; this is a second `Whenever`",
|
|
268
|
+
));
|
|
269
|
+
}
|
|
270
|
+
let owner = (m.id == "whenever_by").then(|| m.text_of("owner"));
|
|
271
|
+
spec.outside = m.id == "whenever_outside";
|
|
272
|
+
spec.event = Some((m.text_of("event"), owner, m.line, m.col_of("event")));
|
|
273
|
+
}
|
|
274
|
+
"runs" | "runs_with" | "asked" | "asked_with" | "policy_tell" => {
|
|
275
|
+
if spec.reaction.is_some() {
|
|
276
|
+
return Err(self.error(
|
|
277
|
+
m.line,
|
|
278
|
+
m.base_col,
|
|
279
|
+
"a policy does one thing; this is a second `Then`",
|
|
280
|
+
));
|
|
281
|
+
}
|
|
282
|
+
let fields = if m.id.ends_with("with") {
|
|
283
|
+
passed_fields(&m)
|
|
284
|
+
} else {
|
|
285
|
+
Vec::new()
|
|
286
|
+
};
|
|
287
|
+
let (reaction, slot) = if m.id == "policy_tell" {
|
|
288
|
+
let tell = format!(
|
|
289
|
+
"{}.{}",
|
|
290
|
+
camel(&m.text_of("owner")),
|
|
291
|
+
camel(&m.text_of("command"))
|
|
292
|
+
);
|
|
293
|
+
(Reaction::Tell(tell), "command")
|
|
294
|
+
} else if m.id.starts_with("runs") {
|
|
295
|
+
(Reaction::Run(camel(&m.text_of("command"))), "command")
|
|
296
|
+
} else {
|
|
297
|
+
(Reaction::Ask(snake(&m.text_of("need"))), "need")
|
|
298
|
+
};
|
|
299
|
+
spec.reaction = Some((reaction, fields, m.line, m.col_of(slot)));
|
|
300
|
+
}
|
|
301
|
+
_ => return Err(self.unmeant(&m)),
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
Ok(spec)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/// Looks up the events and commands the policies name, now that every aggregate is read.
|
|
308
|
+
fn policies_of(
|
|
309
|
+
&self,
|
|
310
|
+
declaration: &ir::Bluebook,
|
|
311
|
+
specs: Vec<PolicySpec>,
|
|
312
|
+
) -> ParseResult<Vec<ir::Policy>> {
|
|
313
|
+
let mut policies = Vec::new();
|
|
314
|
+
for spec in specs {
|
|
315
|
+
let Some((event, owner, event_line, event_col)) = spec.event else {
|
|
316
|
+
return Err(self.error(
|
|
317
|
+
spec.line,
|
|
318
|
+
spec.col,
|
|
319
|
+
"this policy has no `Whenever <event> is announced`",
|
|
320
|
+
));
|
|
321
|
+
};
|
|
322
|
+
let Some((reaction, mut fields, then_line, then_col)) = spec.reaction else {
|
|
323
|
+
return Err(self.error(
|
|
324
|
+
spec.line,
|
|
325
|
+
spec.col,
|
|
326
|
+
"this policy does nothing; add `Then <command> runs` or `Then <need> is asked`",
|
|
327
|
+
));
|
|
328
|
+
};
|
|
329
|
+
fields.extend(spec.with_lines);
|
|
330
|
+
let on_event = if spec.outside {
|
|
331
|
+
event
|
|
332
|
+
} else {
|
|
333
|
+
format!(
|
|
334
|
+
"{}.{event}",
|
|
335
|
+
self.event_source(
|
|
336
|
+
declaration,
|
|
337
|
+
&event,
|
|
338
|
+
owner.as_deref(),
|
|
339
|
+
event_line,
|
|
340
|
+
event_col
|
|
341
|
+
)?
|
|
342
|
+
)
|
|
343
|
+
};
|
|
344
|
+
let mut policy = ir::Policy {
|
|
345
|
+
name: spec.name,
|
|
346
|
+
on_event: Some(on_event),
|
|
347
|
+
with_spec: fields
|
|
348
|
+
.iter()
|
|
349
|
+
.map(|(key, spelled)| (key.name.clone(), spelled.clone()))
|
|
350
|
+
.collect(),
|
|
351
|
+
for_each_query: spec.for_each,
|
|
352
|
+
where_clause: spec.only_when,
|
|
353
|
+
expect_undelivered: spec.undelivered,
|
|
354
|
+
..Default::default()
|
|
355
|
+
};
|
|
356
|
+
match reaction {
|
|
357
|
+
Reaction::Ask(need) => policy.ask = Some(need),
|
|
358
|
+
Reaction::Tell(command) => {
|
|
359
|
+
let local = declaration.aggregates.iter().any(|a| {
|
|
360
|
+
command.split_once('.').is_some_and(|(owner, name)| {
|
|
361
|
+
a.name == owner && a.commands.iter().any(|c| c.name == name)
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
if !local && spec.across.is_none() {
|
|
365
|
+
return Err(self.error(
|
|
366
|
+
then_line,
|
|
367
|
+
then_col,
|
|
368
|
+
format!("'{command}' is not a command of this bluebook; if it lives in another domain, add `It crosses into the <domain> domain`"),
|
|
369
|
+
));
|
|
370
|
+
}
|
|
371
|
+
policy.trigger_command = Some(command);
|
|
372
|
+
policy.target_domain.clone_from(&spec.across);
|
|
373
|
+
}
|
|
374
|
+
Reaction::Run(command) => {
|
|
375
|
+
let found: Vec<(&ir::Aggregate, &ir::Command)> = declaration
|
|
376
|
+
.aggregates
|
|
377
|
+
.iter()
|
|
378
|
+
.flat_map(|a| a.commands.iter().map(move |c| (a, c)))
|
|
379
|
+
.filter(|(_, c)| c.name == command)
|
|
380
|
+
.collect();
|
|
381
|
+
let [(aggregate, target)] = found.as_slice() else {
|
|
382
|
+
let all: Vec<String> = declaration
|
|
383
|
+
.aggregates
|
|
384
|
+
.iter()
|
|
385
|
+
.flat_map(|a| a.commands.iter().map(|c| spoken(&c.name)))
|
|
386
|
+
.collect();
|
|
387
|
+
return Err(self.error(
|
|
388
|
+
then_line,
|
|
389
|
+
then_col,
|
|
390
|
+
format!(
|
|
391
|
+
"'{}' is not one command of this bluebook. The commands are: {}",
|
|
392
|
+
spoken(&command),
|
|
393
|
+
all.join(", ")
|
|
394
|
+
),
|
|
395
|
+
));
|
|
396
|
+
};
|
|
397
|
+
// Each row of a fan-out also supplies the key the command is addressed by.
|
|
398
|
+
for (field, _) in fields.iter().filter(|_| policy.for_each_query.is_none()) {
|
|
399
|
+
if !target.attributes.iter().any(|a| a.name == field.name) {
|
|
400
|
+
let takes: Vec<String> =
|
|
401
|
+
target.attributes.iter().map(|a| spoken(&a.name)).collect();
|
|
402
|
+
let takes = if takes.is_empty() {
|
|
403
|
+
"nothing".to_string()
|
|
404
|
+
} else {
|
|
405
|
+
takes.join(", ")
|
|
406
|
+
};
|
|
407
|
+
return Err(self.error(
|
|
408
|
+
field.line,
|
|
409
|
+
field.col,
|
|
410
|
+
format!(
|
|
411
|
+
"{} takes no '{}'. It takes: {takes}",
|
|
412
|
+
spoken(&target.name),
|
|
413
|
+
spoken(&field.name)
|
|
414
|
+
),
|
|
415
|
+
));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
policy.trigger_command = Some(format!("{}.{}", aggregate.name, target.name));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
policies.push(policy);
|
|
422
|
+
}
|
|
423
|
+
Ok(policies)
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/// The aggregate an announced event comes from: the one whose command announces it, or the
|
|
427
|
+
/// one named outright for an event the outside announces.
|
|
428
|
+
fn event_source(
|
|
429
|
+
&self,
|
|
430
|
+
declaration: &ir::Bluebook,
|
|
431
|
+
event: &str,
|
|
432
|
+
owner: Option<&str>,
|
|
433
|
+
line: usize,
|
|
434
|
+
col: usize,
|
|
435
|
+
) -> ParseResult<String> {
|
|
436
|
+
if let Some(noun) = owner {
|
|
437
|
+
return declaration
|
|
438
|
+
.aggregates
|
|
439
|
+
.iter()
|
|
440
|
+
.find(|a| spoken(&a.name) == noun.to_lowercase())
|
|
441
|
+
.map(|a| a.name.clone())
|
|
442
|
+
.ok_or_else(|| {
|
|
443
|
+
let known: Vec<String> = declaration
|
|
444
|
+
.aggregates
|
|
445
|
+
.iter()
|
|
446
|
+
.map(|a| spoken(&a.name))
|
|
447
|
+
.collect();
|
|
448
|
+
self.error(
|
|
449
|
+
line,
|
|
450
|
+
col,
|
|
451
|
+
format!(
|
|
452
|
+
"there is no '{noun}' here. The aggregates are: {}",
|
|
453
|
+
known.join(", ")
|
|
454
|
+
),
|
|
455
|
+
)
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
let sources: Vec<&ir::Aggregate> = declaration
|
|
459
|
+
.aggregates
|
|
460
|
+
.iter()
|
|
461
|
+
.filter(|a| {
|
|
462
|
+
a.commands
|
|
463
|
+
.iter()
|
|
464
|
+
.any(|c| c.emits.iter().any(|e| e == event))
|
|
465
|
+
})
|
|
466
|
+
.collect();
|
|
467
|
+
match sources.as_slice() {
|
|
468
|
+
[one] => Ok(one.name.clone()),
|
|
469
|
+
[] => {
|
|
470
|
+
let announced: Vec<String> = declaration
|
|
471
|
+
.aggregates
|
|
472
|
+
.iter()
|
|
473
|
+
.flat_map(|a| a.commands.iter().flat_map(|c| c.emits.iter().cloned()))
|
|
474
|
+
.collect();
|
|
475
|
+
Err(self.error(
|
|
476
|
+
line,
|
|
477
|
+
col,
|
|
478
|
+
format!(
|
|
479
|
+
"no command announces {event}. The events announced are: {}. If the outside announces it, say `… is announced by an <aggregate>`",
|
|
480
|
+
announced.join(", ")
|
|
481
|
+
),
|
|
482
|
+
))
|
|
483
|
+
}
|
|
484
|
+
_ => Err(self.error(line, col, format!("more than one aggregate announces {event}; say which with `… is announced by an <aggregate>`"))),
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/// A phrase the table admits that this front end has no meaning for yet.
|
|
489
|
+
pub(super) fn unmeant(&self, m: &Matched) -> Diagnostic {
|
|
490
|
+
self.error(
|
|
491
|
+
m.line,
|
|
492
|
+
m.base_col,
|
|
493
|
+
format!(
|
|
494
|
+
"the phrase '{}' is admitted but the parser does not read it yet",
|
|
495
|
+
m.id
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
fn aggregate(&mut self, header: &Matched) -> ParseResult<ir::Aggregate> {
|
|
501
|
+
let mut st = AggState {
|
|
502
|
+
agg: ir::Aggregate {
|
|
503
|
+
name: camel(&header.text_of("name")),
|
|
504
|
+
..Default::default()
|
|
505
|
+
},
|
|
506
|
+
attr_types: Vec::new(),
|
|
507
|
+
vo_types: Vec::new(),
|
|
508
|
+
identity: None,
|
|
509
|
+
lifecycle: None,
|
|
510
|
+
commands: Vec::new(),
|
|
511
|
+
checks: Vec::new(),
|
|
512
|
+
query_args: Vec::new(),
|
|
513
|
+
};
|
|
514
|
+
let mut scope = Scope::inside(header.indent);
|
|
515
|
+
let mut entities: Vec<(Matched, usize)> = Vec::new();
|
|
516
|
+
while let Some(step) = self.step(&mut scope, "Aggregate", true)? {
|
|
517
|
+
match step {
|
|
518
|
+
Step::Prose { text } => st.agg.description = Some(text),
|
|
519
|
+
Step::Phrase(m) => match m.id {
|
|
520
|
+
"identity" => self.identity(&m, &mut st)?,
|
|
521
|
+
"has" => self.has(&m, &mut st)?,
|
|
522
|
+
"value_object" | "value_object_with" => self.value_object(&m, &mut st)?,
|
|
523
|
+
"closed_set" | "closed_set_named" => self.closed_set(&m, &mut st)?,
|
|
524
|
+
"value_fields" => self.value_fields(&m, &mut st)?,
|
|
525
|
+
"lifecycle" => self.lifecycle(&m, &mut st)?,
|
|
526
|
+
"command" => self.command(&m, &mut st)?,
|
|
527
|
+
"query" => self.query(&m, &mut st)?,
|
|
528
|
+
"aggregate_rule" | "precondition" => {
|
|
529
|
+
let cond = self.condition(&m)?;
|
|
530
|
+
st.checks.extend(cond.field);
|
|
531
|
+
let given = ir::Given {
|
|
532
|
+
description: Some(m.text_of("description")),
|
|
533
|
+
canonical: cond.canonical,
|
|
534
|
+
};
|
|
535
|
+
if m.id == "precondition" {
|
|
536
|
+
st.agg.preconditions.push(given);
|
|
537
|
+
} else {
|
|
538
|
+
st.agg.invariants.push(given);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
"aggregate_provenance" => st.agg.provenance = Some(self.literal(&m, "value")?),
|
|
542
|
+
"projected" => st.agg.projected_fields.push(ir::ProjectedField {
|
|
543
|
+
name: snake(&m.text_of("name")),
|
|
544
|
+
reference: snake(&m.text_of("reference")),
|
|
545
|
+
remote_field: snake(&m.text_of("remote")),
|
|
546
|
+
}),
|
|
547
|
+
"entity" => {
|
|
548
|
+
// Read after the aggregate's own blocks, so its identity can name their
|
|
549
|
+
// value objects.
|
|
550
|
+
let from = self.pos;
|
|
551
|
+
while self
|
|
552
|
+
.lines
|
|
553
|
+
.get(self.pos)
|
|
554
|
+
.is_some_and(|line| line.indent > m.indent)
|
|
555
|
+
{
|
|
556
|
+
self.pos += 1;
|
|
557
|
+
}
|
|
558
|
+
entities.push((m, from));
|
|
559
|
+
}
|
|
560
|
+
_ => return Err(self.unmeant(&m)),
|
|
561
|
+
},
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
self.entities_of(&mut st, entities)?;
|
|
565
|
+
self.finish(st, header)
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/// Reads the entity blocks an aggregate skipped over, with its value objects in reach.
|
|
569
|
+
fn entities_of(
|
|
570
|
+
&mut self,
|
|
571
|
+
st: &mut AggState,
|
|
572
|
+
entities: Vec<(Matched, usize)>,
|
|
573
|
+
) -> ParseResult<()> {
|
|
574
|
+
let resume = self.pos;
|
|
575
|
+
for (m, from) in entities {
|
|
576
|
+
self.pos = from;
|
|
577
|
+
let outer_before = self.outer.len();
|
|
578
|
+
self.outer.extend(st.agg.value_objects.iter().cloned());
|
|
579
|
+
let inner = self.aggregate(&m);
|
|
580
|
+
self.outer.truncate(outer_before);
|
|
581
|
+
let entity = super::entity::into_entity(inner?)
|
|
582
|
+
.map_err(|refused| self.error(m.line, m.base_col, refused))?;
|
|
583
|
+
st.agg.entities.push(entity);
|
|
584
|
+
}
|
|
585
|
+
self.pos = resume;
|
|
586
|
+
Ok(())
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/// Refuses a sentence about some other aggregate than the one it stands in.
|
|
590
|
+
fn same_owner(&self, m: &Matched, owner: &str, st: &AggState) -> ParseResult<()> {
|
|
591
|
+
if camel(&m.text_of(owner)) == st.agg.name {
|
|
592
|
+
return Ok(());
|
|
593
|
+
}
|
|
594
|
+
Err(self.error(
|
|
595
|
+
m.line,
|
|
596
|
+
m.col_of(owner),
|
|
597
|
+
format!(
|
|
598
|
+
"this is about '{}', but it stands in the aggregate '{}'",
|
|
599
|
+
m.text_of(owner),
|
|
600
|
+
spoken(&st.agg.name)
|
|
601
|
+
),
|
|
602
|
+
))
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
fn identity(&self, m: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
606
|
+
self.same_owner(m, "owner", st)?;
|
|
607
|
+
if st.identity.is_some() {
|
|
608
|
+
return Err(self.error(
|
|
609
|
+
m.line,
|
|
610
|
+
m.base_col,
|
|
611
|
+
"an aggregate is identified by one thing; this says it twice",
|
|
612
|
+
));
|
|
613
|
+
}
|
|
614
|
+
st.identity = Some(Identity {
|
|
615
|
+
line: m.line,
|
|
616
|
+
col: m.col_of("fields"),
|
|
617
|
+
fields: m
|
|
618
|
+
.capture("fields")
|
|
619
|
+
.items
|
|
620
|
+
.iter()
|
|
621
|
+
.map(|item| snake(item))
|
|
622
|
+
.collect(),
|
|
623
|
+
});
|
|
624
|
+
Ok(())
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
fn has(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
628
|
+
for (attribute, used) in self.attribute_lines(header)? {
|
|
629
|
+
st.agg.attributes.push(attribute);
|
|
630
|
+
st.attr_types.push(used);
|
|
631
|
+
}
|
|
632
|
+
Ok(())
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/// The attributes an `It has:` or `It takes:` block lists, each with the type phrase it wrote.
|
|
636
|
+
pub(super) fn attribute_lines(
|
|
637
|
+
&mut self,
|
|
638
|
+
header: &Matched,
|
|
639
|
+
) -> ParseResult<Vec<(ir::Attribute, TypeUse)>> {
|
|
640
|
+
let mut lines = Vec::new();
|
|
641
|
+
let mut scope = Scope::inside(header.indent);
|
|
642
|
+
while let Some(step) = self.step(&mut scope, "Has", false)? {
|
|
643
|
+
let Step::Phrase(m) = step else { continue };
|
|
644
|
+
if !matches!(m.id, "attribute" | "attribute_with") {
|
|
645
|
+
return Err(self.unmeant(&m));
|
|
646
|
+
}
|
|
647
|
+
let mut attribute = ir::Attribute {
|
|
648
|
+
name: snake(&m.text_of("name")),
|
|
649
|
+
..Default::default()
|
|
650
|
+
};
|
|
651
|
+
if m.id == "attribute_with" {
|
|
652
|
+
self.attribute_options(&m)?.onto(&mut attribute);
|
|
653
|
+
}
|
|
654
|
+
let shape = shape_of(&m.text_of("type"));
|
|
655
|
+
shape.apply(&mut attribute);
|
|
656
|
+
let used = TypeUse {
|
|
657
|
+
line: m.line,
|
|
658
|
+
col: m.col_of("type"),
|
|
659
|
+
words: shape.words,
|
|
660
|
+
reference: shape.reference,
|
|
661
|
+
variants: shape.variants,
|
|
662
|
+
};
|
|
663
|
+
lines.push((attribute, used));
|
|
664
|
+
}
|
|
665
|
+
Ok(lines)
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
fn value_object(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
669
|
+
let index = st.agg.value_objects.len();
|
|
670
|
+
st.agg.value_objects.push(ir::ValueObject {
|
|
671
|
+
name: camel(&header.text_of("name")),
|
|
672
|
+
attributes: vec![ir::Attribute {
|
|
673
|
+
name: "value".to_string(),
|
|
674
|
+
..Default::default()
|
|
675
|
+
}],
|
|
676
|
+
..Default::default()
|
|
677
|
+
});
|
|
678
|
+
if header.id == "value_object_with" {
|
|
679
|
+
let options = self.attribute_options(header)?;
|
|
680
|
+
if let Some(attribute) = st
|
|
681
|
+
.agg
|
|
682
|
+
.value_objects
|
|
683
|
+
.get_mut(index)
|
|
684
|
+
.and_then(|vo| vo.attributes.first_mut())
|
|
685
|
+
{
|
|
686
|
+
options.onto(attribute);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
let shape = shape_of(&header.text_of("type"));
|
|
690
|
+
if let Some(attribute) = st
|
|
691
|
+
.agg
|
|
692
|
+
.value_objects
|
|
693
|
+
.get_mut(index)
|
|
694
|
+
.and_then(|vo| vo.attributes.first_mut())
|
|
695
|
+
{
|
|
696
|
+
shape.apply(attribute);
|
|
697
|
+
}
|
|
698
|
+
st.vo_types.push((
|
|
699
|
+
index,
|
|
700
|
+
0,
|
|
701
|
+
TypeUse {
|
|
702
|
+
line: header.line,
|
|
703
|
+
col: header.col_of("type"),
|
|
704
|
+
reference: shape.reference,
|
|
705
|
+
words: shape.words,
|
|
706
|
+
variants: None,
|
|
707
|
+
},
|
|
708
|
+
));
|
|
709
|
+
self.value_rules(header, st, index)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/// `A band is one of: small, medium and large.`, with any rules under it.
|
|
713
|
+
fn closed_set(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
714
|
+
let index = st.agg.value_objects.len();
|
|
715
|
+
let values = header.capture("values").items;
|
|
716
|
+
let mut set = crate::build::closed_sets::synthesize("value", &values);
|
|
717
|
+
set.name = camel(&header.text_of("name"));
|
|
718
|
+
if header.id == "closed_set_named" {
|
|
719
|
+
let column = snake(&header.text_of("attr"));
|
|
720
|
+
if let Some(attribute) = set.attributes.first_mut() {
|
|
721
|
+
attribute.name.clone_from(&column);
|
|
722
|
+
}
|
|
723
|
+
for member in &mut set.members {
|
|
724
|
+
for cell in member.iter_mut() {
|
|
725
|
+
cell.0.clone_from(&column);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
st.agg.value_objects.push(set);
|
|
730
|
+
self.value_rules(header, st, index)
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/// The rules under a one-value block, each about `value`.
|
|
734
|
+
fn value_rules(
|
|
735
|
+
&mut self,
|
|
736
|
+
header: &Matched,
|
|
737
|
+
st: &mut AggState,
|
|
738
|
+
index: usize,
|
|
739
|
+
) -> ParseResult<()> {
|
|
740
|
+
let mut scope = Scope::inside(header.indent);
|
|
741
|
+
while let Some(step) = self.step(&mut scope, "ValueObject", false)? {
|
|
742
|
+
let Step::Phrase(m) = step else { continue };
|
|
743
|
+
if m.id != "rule" {
|
|
744
|
+
return Err(self.unmeant(&m));
|
|
745
|
+
}
|
|
746
|
+
let cond = self.condition(&m)?;
|
|
747
|
+
if let Some(field) = cond.field.as_ref().filter(|field| field.name != "value") {
|
|
748
|
+
return Err(self.unknown_field(field, &["value".to_string()]));
|
|
749
|
+
}
|
|
750
|
+
if let Some(vo) = st.agg.value_objects.get_mut(index) {
|
|
751
|
+
vo.invariants.push(ir::Given {
|
|
752
|
+
description: Some(m.text_of("description")),
|
|
753
|
+
canonical: cond.canonical,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
Ok(())
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/// `A money has:` with one attribute per line and the rules about them.
|
|
761
|
+
fn value_fields(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
762
|
+
let index = st.agg.value_objects.len();
|
|
763
|
+
st.agg.value_objects.push(ir::ValueObject {
|
|
764
|
+
name: camel(&header.text_of("name")),
|
|
765
|
+
..Default::default()
|
|
766
|
+
});
|
|
767
|
+
let mut checks: Vec<FieldUse> = Vec::new();
|
|
768
|
+
let mut scope = Scope::inside(header.indent);
|
|
769
|
+
while let Some(step) = self.step(&mut scope, "Fields", false)? {
|
|
770
|
+
let Step::Phrase(m) = step else { continue };
|
|
771
|
+
match m.id {
|
|
772
|
+
"field" | "field_with" => {
|
|
773
|
+
let mut attribute = ir::Attribute {
|
|
774
|
+
name: snake(&m.text_of("name")),
|
|
775
|
+
..Default::default()
|
|
776
|
+
};
|
|
777
|
+
if m.id == "field_with" {
|
|
778
|
+
self.attribute_options(&m)?.onto(&mut attribute);
|
|
779
|
+
}
|
|
780
|
+
let shape = shape_of(&m.text_of("type"));
|
|
781
|
+
shape.apply(&mut attribute);
|
|
782
|
+
let Some(vo) = st.agg.value_objects.get_mut(index) else {
|
|
783
|
+
continue;
|
|
784
|
+
};
|
|
785
|
+
st.vo_types.push((
|
|
786
|
+
index,
|
|
787
|
+
vo.attributes.len(),
|
|
788
|
+
TypeUse {
|
|
789
|
+
line: m.line,
|
|
790
|
+
col: m.col_of("type"),
|
|
791
|
+
reference: shape.reference,
|
|
792
|
+
words: shape.words,
|
|
793
|
+
variants: None,
|
|
794
|
+
},
|
|
795
|
+
));
|
|
796
|
+
vo.attributes.push(attribute);
|
|
797
|
+
}
|
|
798
|
+
"field_member" => {
|
|
799
|
+
let member = self.member_cells(&m)?;
|
|
800
|
+
if let Some(vo) = st.agg.value_objects.get_mut(index) {
|
|
801
|
+
vo.members.push(member);
|
|
802
|
+
vo.closed_set = true;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
"field_rule" => {
|
|
806
|
+
let cond = self.condition(&m)?;
|
|
807
|
+
checks.extend(cond.field);
|
|
808
|
+
if let Some(vo) = st.agg.value_objects.get_mut(index) {
|
|
809
|
+
vo.invariants.push(ir::Given {
|
|
810
|
+
description: Some(m.text_of("description")),
|
|
811
|
+
canonical: cond.canonical,
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
_ => return Err(self.unmeant(&m)),
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
let names: Vec<String> = st
|
|
819
|
+
.agg
|
|
820
|
+
.value_objects
|
|
821
|
+
.get(index)
|
|
822
|
+
.map(|vo| vo.attributes.iter().map(|a| a.name.clone()).collect())
|
|
823
|
+
.unwrap_or_default();
|
|
824
|
+
checks
|
|
825
|
+
.iter()
|
|
826
|
+
.find(|check| !names.contains(&check.name))
|
|
827
|
+
.map_or(Ok(()), |unknown| Err(self.unknown_field(unknown, &names)))
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
fn lifecycle(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
831
|
+
if st.lifecycle.is_some() {
|
|
832
|
+
return Err(self.error(
|
|
833
|
+
header.line,
|
|
834
|
+
header.base_col,
|
|
835
|
+
"an aggregate has one lifecycle; this is a second",
|
|
836
|
+
));
|
|
837
|
+
}
|
|
838
|
+
let mut spec = LifecycleSpec {
|
|
839
|
+
field: snake(&header.text_of("field")),
|
|
840
|
+
default: header.text_of("state"),
|
|
841
|
+
transitions: Vec::new(),
|
|
842
|
+
marks: Vec::new(),
|
|
843
|
+
};
|
|
844
|
+
let mut scope = Scope::inside(header.indent);
|
|
845
|
+
while let Some(step) = self.step(&mut scope, "Lifecycle", false)? {
|
|
846
|
+
let Step::Phrase(m) = step else { continue };
|
|
847
|
+
if m.id == "marks" {
|
|
848
|
+
spec.marks
|
|
849
|
+
.push((m.text_of("mark"), m.capture("states").items));
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
if m.id != "transition" {
|
|
853
|
+
return Err(self.unmeant(&m));
|
|
854
|
+
}
|
|
855
|
+
self.same_owner(&m, "owner", st)?;
|
|
856
|
+
spec.transitions.push(Transition {
|
|
857
|
+
line: m.line,
|
|
858
|
+
col: m.col_of("command"),
|
|
859
|
+
command: camel(&m.text_of("command")),
|
|
860
|
+
from: m.text_of("from"),
|
|
861
|
+
to: m.text_of("to"),
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
st.lifecycle = Some(spec);
|
|
865
|
+
Ok(())
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
fn command(&mut self, header: &Matched, st: &mut AggState) -> ParseResult<()> {
|
|
869
|
+
let mut spec = CommandSpec {
|
|
870
|
+
name: camel(&header.text_of("name")),
|
|
871
|
+
role: None,
|
|
872
|
+
roles: Vec::new(),
|
|
873
|
+
goal: None,
|
|
874
|
+
references: None,
|
|
875
|
+
args: Vec::new(),
|
|
876
|
+
takes: Vec::new(),
|
|
877
|
+
givens: Vec::new(),
|
|
878
|
+
ensures: Vec::new(),
|
|
879
|
+
from: None,
|
|
880
|
+
provenance: None,
|
|
881
|
+
idempotent: false,
|
|
882
|
+
changes: Vec::new(),
|
|
883
|
+
emits: Vec::new(),
|
|
884
|
+
};
|
|
885
|
+
let mut scope = Scope::inside(header.indent);
|
|
886
|
+
while let Some(step) = self.step(&mut scope, "Command", false)? {
|
|
887
|
+
let Step::Phrase(m) = step else { continue };
|
|
888
|
+
match m.id {
|
|
889
|
+
"goal" => spec.goal = Some(m.text_of("goal")),
|
|
890
|
+
"role" => {
|
|
891
|
+
let roles = self.roles_of(&m)?;
|
|
892
|
+
spec.role = roles.first().cloned();
|
|
893
|
+
if roles.len() > 1 {
|
|
894
|
+
spec.roles = roles;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
"acts_on" => {
|
|
898
|
+
self.same_owner(&m, "owner", st)?;
|
|
899
|
+
spec.references = Some(st.agg.name.clone());
|
|
900
|
+
}
|
|
901
|
+
"arguments" => spec.args.extend(field_uses(&m, "names")),
|
|
902
|
+
"takes" => spec.takes.extend(self.attribute_lines(&m)?),
|
|
903
|
+
"from_states" => {
|
|
904
|
+
let mut states = m.capture("states").items;
|
|
905
|
+
spec.from = Some(if states.len() == 1 {
|
|
906
|
+
ir::CommandFrom::Single(states.remove(0))
|
|
907
|
+
} else {
|
|
908
|
+
ir::CommandFrom::Multiple(states)
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
"idempotent" => spec.idempotent = true,
|
|
912
|
+
"command_provenance" => spec.provenance = Some(self.literal(&m, "value")?),
|
|
913
|
+
"ensures" => {
|
|
914
|
+
let cond = self.condition(&m)?;
|
|
915
|
+
spec.ensures.push(ir::Given {
|
|
916
|
+
description: Some(m.text_of("description")),
|
|
917
|
+
canonical: cond.canonical,
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
"announces" => spec.emits.push(m.text_of("event")),
|
|
921
|
+
"given" => {
|
|
922
|
+
let cond = self.condition(&m)?;
|
|
923
|
+
st.checks.extend(cond.field);
|
|
924
|
+
spec.givens.push(ir::Given {
|
|
925
|
+
description: Some(m.text_of("description")),
|
|
926
|
+
canonical: cond.canonical,
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
_ => match self.changes_of(&m)? {
|
|
930
|
+
Some(changes) => spec.changes.extend(changes),
|
|
931
|
+
None => return Err(self.unmeant(&m)),
|
|
932
|
+
},
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
st.commands.push(spec);
|
|
936
|
+
Ok(())
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/// The roles a `Who:` line names: `Editor`, or `Customer or Sales Rep` for any one of several.
|
|
940
|
+
fn roles_of(&self, m: &Matched) -> ParseResult<Vec<String>> {
|
|
941
|
+
let col = m.col_of("role");
|
|
942
|
+
let mut roles: Vec<String> = Vec::new();
|
|
943
|
+
let mut current: Vec<String> = Vec::new();
|
|
944
|
+
for word in m.text_of("role").split_whitespace() {
|
|
945
|
+
if !word.eq_ignore_ascii_case("or") {
|
|
946
|
+
current.push(word.to_string());
|
|
947
|
+
} else if current.is_empty() {
|
|
948
|
+
return Err(self.error(m.line, col, "an 'or' needs a role before it"));
|
|
949
|
+
} else {
|
|
950
|
+
roles.push(current.join(" "));
|
|
951
|
+
current.clear();
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
if current.is_empty() {
|
|
955
|
+
return Err(self.error(m.line, col, "an 'or' needs a role after it"));
|
|
956
|
+
}
|
|
957
|
+
roles.push(current.join(" "));
|
|
958
|
+
let mut distinct = roles.clone();
|
|
959
|
+
distinct.sort();
|
|
960
|
+
distinct.dedup();
|
|
961
|
+
if distinct.len() != roles.len() {
|
|
962
|
+
return Err(self.error(m.line, col, "a role is named twice; name each once"));
|
|
963
|
+
}
|
|
964
|
+
Ok(roles)
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/// Reads the condition a rule, a given or a where carries in its `condition` slot.
|
|
968
|
+
pub(super) fn condition(&self, m: &Matched) -> ParseResult<Cond> {
|
|
969
|
+
let text = m.text_of("condition");
|
|
970
|
+
let base = m.col_of("condition");
|
|
971
|
+
match self.match_text("Condition", &text, base) {
|
|
972
|
+
Ok((phrase, found)) => {
|
|
973
|
+
let slot = |name: &str| found.get(name).cloned().unwrap_or_default();
|
|
974
|
+
if phrase.row.id == "expression" {
|
|
975
|
+
return Ok(Cond {
|
|
976
|
+
canonical: crate::canonical::apply(&slot("code").value),
|
|
977
|
+
field: None,
|
|
978
|
+
value: None,
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
let field = FieldUse {
|
|
982
|
+
name: snake(&slot("field").value),
|
|
983
|
+
line: m.line,
|
|
984
|
+
col: column(base, &text, slot("field").offset),
|
|
985
|
+
};
|
|
986
|
+
let (canonical, value) = match phrase.row.id {
|
|
987
|
+
"not_empty" => (format!("!{}.to_s.empty?", field.name), None),
|
|
988
|
+
"at_least" => (format!("{} >= {}", field.name, slot("n").value), None),
|
|
989
|
+
"equals" => {
|
|
990
|
+
let value = slot("value").value;
|
|
991
|
+
(format!("{} == \"{value}\"", field.name), Some(value))
|
|
992
|
+
}
|
|
993
|
+
other => {
|
|
994
|
+
return Err(self.error(
|
|
995
|
+
m.line,
|
|
996
|
+
base,
|
|
997
|
+
format!("the condition '{other}' is admitted but the parser does not read it yet"),
|
|
998
|
+
));
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
Ok(Cond {
|
|
1002
|
+
canonical: crate::canonical::apply(&canonical),
|
|
1003
|
+
field: Some(field),
|
|
1004
|
+
value,
|
|
1005
|
+
})
|
|
1006
|
+
}
|
|
1007
|
+
Err(unmatched) => Err(self
|
|
1008
|
+
.error(
|
|
1009
|
+
m.line,
|
|
1010
|
+
unmatched.column,
|
|
1011
|
+
format!("this is not a condition I know: \"{text}\""),
|
|
1012
|
+
)
|
|
1013
|
+
.with_expected(unmatched.suggestions)),
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
fn unknown_field(&self, field: &FieldUse, in_scope: &[String]) -> Diagnostic {
|
|
1018
|
+
let known: Vec<String> = in_scope.iter().map(|name| spoken(name)).collect();
|
|
1019
|
+
self.error(
|
|
1020
|
+
field.line,
|
|
1021
|
+
field.col,
|
|
1022
|
+
format!(
|
|
1023
|
+
"'{}' is not a field here. The fields in scope are: {}",
|
|
1024
|
+
spoken(&field.name),
|
|
1025
|
+
known.join(", ")
|
|
1026
|
+
),
|
|
1027
|
+
)
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/// Resolves the names the aggregate's blocks used, now that all of them are read.
|
|
1031
|
+
fn finish(&self, mut st: AggState, header: &Matched) -> ParseResult<ir::Aggregate> {
|
|
1032
|
+
if st.identity.is_none() {
|
|
1033
|
+
let noun = spoken(&st.agg.name);
|
|
1034
|
+
return Err(self.error(
|
|
1035
|
+
header.line,
|
|
1036
|
+
header.base_col,
|
|
1037
|
+
format!(
|
|
1038
|
+
"the {noun} does not say what identifies it. Add a sentence like `A {noun} is identified by its <field>.`"
|
|
1039
|
+
),
|
|
1040
|
+
));
|
|
1041
|
+
}
|
|
1042
|
+
for at in 0..st.attr_types.len() {
|
|
1043
|
+
let Some(variants) = st
|
|
1044
|
+
.attr_types
|
|
1045
|
+
.get_mut(at)
|
|
1046
|
+
.and_then(|used| used.variants.take())
|
|
1047
|
+
else {
|
|
1048
|
+
continue;
|
|
1049
|
+
};
|
|
1050
|
+
let Some(attribute) = st.agg.attributes.get(at) else {
|
|
1051
|
+
continue;
|
|
1052
|
+
};
|
|
1053
|
+
let minted = crate::build::references::one_of_reference(
|
|
1054
|
+
&st.agg.name,
|
|
1055
|
+
&variants,
|
|
1056
|
+
&attribute.name,
|
|
1057
|
+
attribute.optional,
|
|
1058
|
+
);
|
|
1059
|
+
if let Some(used) = st.attr_types.get_mut(at) {
|
|
1060
|
+
used.words.clone_from(&minted.attribute.type_name);
|
|
1061
|
+
used.reference = false;
|
|
1062
|
+
}
|
|
1063
|
+
st.agg.attributes[at] = minted.attribute;
|
|
1064
|
+
st.agg.value_objects.push(minted.type_set);
|
|
1065
|
+
st.agg.value_objects.push(minted.tagged);
|
|
1066
|
+
}
|
|
1067
|
+
let types: Vec<String> = st
|
|
1068
|
+
.attr_types
|
|
1069
|
+
.iter()
|
|
1070
|
+
.map(|used| self.type_named(used, &st.agg))
|
|
1071
|
+
.collect::<ParseResult<_>>()?;
|
|
1072
|
+
for (attribute, resolved) in st.agg.attributes.iter_mut().zip(types) {
|
|
1073
|
+
attribute.type_name = resolved;
|
|
1074
|
+
}
|
|
1075
|
+
for (index, at, used) in &st.vo_types {
|
|
1076
|
+
let resolved = self.type_named(used, &st.agg)?;
|
|
1077
|
+
if let Some(attribute) = st
|
|
1078
|
+
.agg
|
|
1079
|
+
.value_objects
|
|
1080
|
+
.get_mut(*index)
|
|
1081
|
+
.and_then(|vo| vo.attributes.get_mut(*at))
|
|
1082
|
+
{
|
|
1083
|
+
attribute.type_name = resolved;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
if let Some(found) = &st.identity {
|
|
1087
|
+
for field in &found.fields {
|
|
1088
|
+
let paths = identity::resolve_identity_field(
|
|
1089
|
+
self.file,
|
|
1090
|
+
found.line,
|
|
1091
|
+
&st.agg.name,
|
|
1092
|
+
field,
|
|
1093
|
+
&[self.outer.clone(), st.agg.value_objects.clone()].concat(),
|
|
1094
|
+
&st.agg.attributes,
|
|
1095
|
+
)
|
|
1096
|
+
.map_err(|refused| {
|
|
1097
|
+
Diagnostic::new(self.file, found.line, refused.message).with_column(found.col)
|
|
1098
|
+
})?;
|
|
1099
|
+
st.agg.identified_by.extend(paths);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
for (at, args) in std::mem::take(&mut st.query_args) {
|
|
1103
|
+
let mut typed = Vec::new();
|
|
1104
|
+
for (mut attribute, used) in args {
|
|
1105
|
+
if used.variants.is_some() {
|
|
1106
|
+
return Err(self.error(used.line, used.col, "a query's argument names one aggregate; `one of …` belongs in an aggregate's `It has:`"));
|
|
1107
|
+
}
|
|
1108
|
+
attribute.type_name = self.type_named(&used, &st.agg)?;
|
|
1109
|
+
typed.push(attribute);
|
|
1110
|
+
}
|
|
1111
|
+
if let Some(query) = st.agg.queries.get_mut(at) {
|
|
1112
|
+
query.attributes = typed;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
let commands = self.commands_of(&mut st)?;
|
|
1116
|
+
st.agg.commands = commands;
|
|
1117
|
+
self.lifecycle_of(&mut st)?;
|
|
1118
|
+
let mut in_scope: Vec<String> = st.agg.attributes.iter().map(|a| a.name.clone()).collect();
|
|
1119
|
+
in_scope.extend(
|
|
1120
|
+
st.agg
|
|
1121
|
+
.projected_fields
|
|
1122
|
+
.iter()
|
|
1123
|
+
.map(|field| field.name.clone()),
|
|
1124
|
+
);
|
|
1125
|
+
if let Some(lifecycle) = &st.agg.lifecycle {
|
|
1126
|
+
in_scope.push(lifecycle.field.clone());
|
|
1127
|
+
}
|
|
1128
|
+
for check in &st.checks {
|
|
1129
|
+
if !in_scope.contains(&check.name) {
|
|
1130
|
+
return Err(self.unknown_field(check, &in_scope));
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
Ok(st.agg)
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
fn type_named(&self, used: &TypeUse, agg: &ir::Aggregate) -> ParseResult<String> {
|
|
1137
|
+
if used.reference {
|
|
1138
|
+
return Ok(format!("Reference<{}>", camel(&used.words)));
|
|
1139
|
+
}
|
|
1140
|
+
if let Some(found) = scalar(&used.words) {
|
|
1141
|
+
return Ok(found.to_string());
|
|
1142
|
+
}
|
|
1143
|
+
let name = camel(&used.words);
|
|
1144
|
+
if agg.value_objects.iter().any(|vo| vo.name == name) || self.types.contains(&name) {
|
|
1145
|
+
return Ok(name);
|
|
1146
|
+
}
|
|
1147
|
+
let mut known: Vec<String> = vec![SCALARS.to_string()];
|
|
1148
|
+
known.extend(agg.value_objects.iter().map(|vo| spoken(&vo.name)));
|
|
1149
|
+
Err(self.error(
|
|
1150
|
+
used.line,
|
|
1151
|
+
used.col,
|
|
1152
|
+
format!(
|
|
1153
|
+
"I don't know a type called '{}'. The types here are: {}",
|
|
1154
|
+
used.words,
|
|
1155
|
+
known.join(", ")
|
|
1156
|
+
),
|
|
1157
|
+
))
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
fn commands_of(&self, st: &mut AggState) -> ParseResult<Vec<ir::Command>> {
|
|
1161
|
+
let mut commands = Vec::new();
|
|
1162
|
+
for spec in std::mem::take(&mut st.commands) {
|
|
1163
|
+
let mut command = ir::Command {
|
|
1164
|
+
name: spec.name.clone(),
|
|
1165
|
+
role: spec.role,
|
|
1166
|
+
roles: spec.roles,
|
|
1167
|
+
goal: spec.goal,
|
|
1168
|
+
references: spec.references,
|
|
1169
|
+
givens: spec.givens,
|
|
1170
|
+
ensures: spec.ensures,
|
|
1171
|
+
from: spec.from,
|
|
1172
|
+
provenance: spec.provenance,
|
|
1173
|
+
idempotent: spec.idempotent,
|
|
1174
|
+
emits: spec.emits,
|
|
1175
|
+
..Default::default()
|
|
1176
|
+
};
|
|
1177
|
+
let fields: Vec<String> = st.agg.attributes.iter().map(|a| a.name.clone()).collect();
|
|
1178
|
+
let mut given: Vec<String> = Vec::new();
|
|
1179
|
+
for arg in &spec.args {
|
|
1180
|
+
let (name, optional) = optional_argument(&arg.name, &fields);
|
|
1181
|
+
let Some(attribute) = st.agg.attributes.iter().find(|a| a.name == name) else {
|
|
1182
|
+
return Err(self.unknown_field(arg, &fields));
|
|
1183
|
+
};
|
|
1184
|
+
command.attributes.push(ir::Attribute {
|
|
1185
|
+
name: attribute.name.clone(),
|
|
1186
|
+
type_name: attribute.type_name.clone(),
|
|
1187
|
+
list: attribute.list,
|
|
1188
|
+
optional,
|
|
1189
|
+
..Default::default()
|
|
1190
|
+
});
|
|
1191
|
+
given.push(name);
|
|
1192
|
+
}
|
|
1193
|
+
for (mut attribute, used) in spec.takes {
|
|
1194
|
+
if used.variants.is_some() {
|
|
1195
|
+
return Err(self.error(used.line, used.col, "a command's argument names one aggregate; `one of …` belongs in an aggregate's `It has:`"));
|
|
1196
|
+
}
|
|
1197
|
+
attribute.type_name = self.type_named(&used, &st.agg)?;
|
|
1198
|
+
given.push(attribute.name.clone());
|
|
1199
|
+
command.attributes.push(attribute);
|
|
1200
|
+
}
|
|
1201
|
+
let mut state_fields = fields.clone();
|
|
1202
|
+
state_fields.extend(
|
|
1203
|
+
st.lifecycle
|
|
1204
|
+
.as_ref()
|
|
1205
|
+
.map(|lifecycle| lifecycle.field.clone()),
|
|
1206
|
+
);
|
|
1207
|
+
command.mutations =
|
|
1208
|
+
self.mutations_of(&spec.name, spec.changes, &given, &state_fields)?;
|
|
1209
|
+
commands.push(command);
|
|
1210
|
+
}
|
|
1211
|
+
Ok(commands)
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
fn lifecycle_of(&self, st: &mut AggState) -> ParseResult<()> {
|
|
1215
|
+
let Some(spec) = st.lifecycle.take() else {
|
|
1216
|
+
return Ok(());
|
|
1217
|
+
};
|
|
1218
|
+
let known: Vec<String> = st.agg.commands.iter().map(|c| c.name.clone()).collect();
|
|
1219
|
+
let mut lifecycle = ir::Lifecycle {
|
|
1220
|
+
field: spec.field,
|
|
1221
|
+
default: spec.default,
|
|
1222
|
+
marks: spec.marks,
|
|
1223
|
+
..Default::default()
|
|
1224
|
+
};
|
|
1225
|
+
for t in spec.transitions {
|
|
1226
|
+
if !known.contains(&t.command) {
|
|
1227
|
+
let shown: Vec<String> = known.iter().map(|name| spoken(name)).collect();
|
|
1228
|
+
return Err(self.error(
|
|
1229
|
+
t.line,
|
|
1230
|
+
t.col,
|
|
1231
|
+
format!(
|
|
1232
|
+
"'{}' moves the page between states, but no command by that name is declared. Commands here: {}",
|
|
1233
|
+
spoken(&t.command),
|
|
1234
|
+
shown.join(", ")
|
|
1235
|
+
),
|
|
1236
|
+
));
|
|
1237
|
+
}
|
|
1238
|
+
lifecycle.transitions.push(ir::StateTransitionRow {
|
|
1239
|
+
command: t.command,
|
|
1240
|
+
to_state: t.to,
|
|
1241
|
+
from_state: Some(t.from),
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
st.agg.lifecycle = Some(lifecycle);
|
|
1245
|
+
Ok(())
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/// An argument as written (`optional description` -> `description`, optional) unless a field of the
|
|
1250
|
+
/// whole name exists.
|
|
1251
|
+
fn optional_argument(written: &str, fields: &[String]) -> (String, bool) {
|
|
1252
|
+
if fields.iter().any(|field| field == written) {
|
|
1253
|
+
return (written.to_string(), false);
|
|
1254
|
+
}
|
|
1255
|
+
written.strip_prefix("optional_").map_or_else(
|
|
1256
|
+
|| (written.to_string(), false),
|
|
1257
|
+
|name| (name.to_string(), true),
|
|
1258
|
+
)
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
impl ir::Bluebook {
|
|
1262
|
+
/// Adds the capability row a `key is Verb` line under `It provides …:` says.
|
|
1263
|
+
fn provisions_push(&mut self, capability: &str, row: &Matched) {
|
|
1264
|
+
self.provides.push(ir::Provision {
|
|
1265
|
+
capability: capability.to_string(),
|
|
1266
|
+
key: row.text_of("key"),
|
|
1267
|
+
verb: row.text_of("verb"),
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
/// What the words of a type say beyond the type: a list, or a link to another aggregate.
|
|
1273
|
+
struct Shape {
|
|
1274
|
+
/// The words once the form is taken off: `list of tag` -> `tag`.
|
|
1275
|
+
words: String,
|
|
1276
|
+
list: bool,
|
|
1277
|
+
/// `reference_to` for `reference to …`, `has_many` for `has many …`, `one_of` for `one of …`.
|
|
1278
|
+
relationship: Option<&'static str>,
|
|
1279
|
+
/// Names an aggregate: `reference to`, `link to` and `has many`.
|
|
1280
|
+
reference: bool,
|
|
1281
|
+
/// The aggregates a `one of a or b` says, as names.
|
|
1282
|
+
variants: Option<Vec<String>>,
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
impl Shape {
|
|
1286
|
+
fn apply(&self, attribute: &mut ir::Attribute) {
|
|
1287
|
+
attribute.list = self.list;
|
|
1288
|
+
attribute.relationship = self.relationship.map(str::to_string);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/// Reads `list of …`, `reference to …` and `has many …` off the front of a type phrase.
|
|
1293
|
+
fn shape_of(words: &str) -> Shape {
|
|
1294
|
+
let forms: [(&str, bool, Option<&'static str>, bool); 6] = [
|
|
1295
|
+
("list of ", true, None, false),
|
|
1296
|
+
("reference to ", false, Some("reference_to"), true),
|
|
1297
|
+
("link to ", false, None, true),
|
|
1298
|
+
("has many ", true, Some("has_many"), true),
|
|
1299
|
+
("has one ", false, Some("has_one"), true),
|
|
1300
|
+
("belongs to ", false, Some("belongs_to"), true),
|
|
1301
|
+
];
|
|
1302
|
+
for (prefix, list, relationship, reference) in forms {
|
|
1303
|
+
if let Some(inner) = words.strip_prefix(prefix) {
|
|
1304
|
+
return Shape {
|
|
1305
|
+
words: inner.trim().to_string(),
|
|
1306
|
+
list,
|
|
1307
|
+
relationship,
|
|
1308
|
+
reference,
|
|
1309
|
+
variants: None,
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if let Some(inner) = words.strip_prefix("one of ") {
|
|
1314
|
+
let variants = inner.split(" or ").map(|name| camel(name.trim())).collect();
|
|
1315
|
+
return Shape {
|
|
1316
|
+
words: inner.trim().to_string(),
|
|
1317
|
+
list: false,
|
|
1318
|
+
relationship: Some("one_of"),
|
|
1319
|
+
reference: false,
|
|
1320
|
+
variants: Some(variants),
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
Shape {
|
|
1324
|
+
words: words.to_string(),
|
|
1325
|
+
list: false,
|
|
1326
|
+
relationship: None,
|
|
1327
|
+
reference: false,
|
|
1328
|
+
variants: None,
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/// The fields a `runs with` line passes: `the permit` as itself, `the cap from the limit` under
|
|
1333
|
+
/// the command's name for it.
|
|
1334
|
+
fn passed_fields(m: &Matched) -> Vec<PassedField> {
|
|
1335
|
+
let col = m.col_of("fields");
|
|
1336
|
+
m.capture("fields")
|
|
1337
|
+
.items
|
|
1338
|
+
.iter()
|
|
1339
|
+
.map(|item| {
|
|
1340
|
+
let (key, from) = item
|
|
1341
|
+
.split_once(" from the ")
|
|
1342
|
+
.unwrap_or((item.as_str(), item.as_str()));
|
|
1343
|
+
let field = FieldUse {
|
|
1344
|
+
name: snake(key),
|
|
1345
|
+
line: m.line,
|
|
1346
|
+
col,
|
|
1347
|
+
};
|
|
1348
|
+
(field, format!(":{}", snake(from)))
|
|
1349
|
+
})
|
|
1350
|
+
.collect()
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/// The fields a list slot names, each with where it was written.
|
|
1354
|
+
pub(super) fn field_uses(m: &Matched, slot: &str) -> Vec<FieldUse> {
|
|
1355
|
+
let capture = m.capture(slot);
|
|
1356
|
+
let col = m.col_of(slot);
|
|
1357
|
+
capture
|
|
1358
|
+
.items
|
|
1359
|
+
.iter()
|
|
1360
|
+
.map(|item| FieldUse {
|
|
1361
|
+
name: snake(item),
|
|
1362
|
+
line: m.line,
|
|
1363
|
+
col,
|
|
1364
|
+
})
|
|
1365
|
+
.collect()
|
|
1366
|
+
}
|